7.2 Global Compiler Flags

Starting from Haxe 3.0, you can get the list of supported compiler flags by running haxe --help-defines

FlagArgumentDescriptionPlatforms
absolute-pathPrint absolute file path in trace output.all
advanced-telemetryAllow the SWF to be measured with Monocle tool.flash
analyzer-optimizePerform advanced optimizations.all
analyzer-times<level: 0 | 1 | 2>Record detailed timers for the analyzerall
annotate-sourceAdd additional comments to generated source code.cpp
check-xml-proxyCheck the used fields of the XML proxy.all
core-apiDefined in the core API context.all
core-api-serializeMark some generated core API classes with the Serializable attribute on C#.cs
cppiaGenerate cpp instruction assembly.all
cs-ver<version>The C# version to target.cs
nocppiaastUse legacy cppia generation.all
dce<mode: std | full | no>Set the dead code elimination mode. (default: std) See cr-dce.all
dce-debugShow DCE log. See cr-dce.all
debugActivated when compiling with -debug.all
disable-unicode-stringsDisable Unicode support in String type.cpp
displayActivated during completion. See cr-completion.all
display-stdinRead the contents of a file specified in --display from standard input.all
dll-exportGenCPP experimental linking.cpp
dll-importHandle Haxe-generated .NET DLL imports.cs
doc-genDo not perform any removal/change in order to correctly generate documentation.all
dump<mode: pretty | record | position | legacy>Dump typed AST in dump subdirectory using specified mode or non-prettified default.all
dump-path<path>Path to generate dumps to (default: "dump").all
dump-dependenciesDump the classes dependencies in a dump subdirectory.all
dump-ignore-var-idsRemove variable IDs from non-pretty dumps (helps with diff).all
dynamic-interface-closuresUse slow path for interface closures to save space.cpp
erase-genericsErase generic classes on C#.cs
eval-call-stack-depth<depth>Set maximum call stack depth for eval. (default: 1000)eval
eval-debuggerSupport debugger in macro/interp mode. Allows host:port value to open a socket. Implies eval-stack.eval
eval-print-depth<depth>Set maximum print depth (before replacing with '<...>') for eval. (default: 5)eval
eval-pretty-printEnable indented output for eval printing.eval
eval-stackRecord stack information in macro/interp mode.eval
eval-timesRecord per-method execution times in macro/interp mode. Implies eval-stack.eval
filter-timesRecord per-filter execution times upon --times.all
fast-castEnables an experimental casts cleanup on C# and Java.cs, java
fdbEnable full flash debug infos for FDB interactive debugging.flash
file-extensionOutput filename extension for cpp source code.cpp
flash-strictMore strict typing for flash target.flash
flash-use-stageKeep the SWF library initial stage.flash
force-lib-checkForce the compiler to check --net-lib and --java-lib added classes (internal).cs, java
force-native-propertyTag all properties with :nativeProperty metadata for 3.1 compatibility.cpp
gencommon-debugGenCommon internal.cs, java
haxe3compatGives warnings about transition from Haxe 3.x to Haxe 4.0.all
haxe-bootGive the name 'haxe' to the flash boot class instead of a generated name.flash
haxe-verThe current Haxe version value as decimal number. E.g. 3.407 for 3.4.7.all
haxeThe current Haxe version value in SemVer format.all
haxe-nextEnable experimental features that are meant to be released on next Haxe version.all
HAXE_OUTPUT_FILE<name>Force the full output name of the executable/library without library prefix and debug suffix.cpp
HAXE_OUTPUT_PART<name>Output name of the executable/library. (default: main class name)cpp
hl-ver<version>The HashLink version to target. (default: 1.10.0)hl
hxcpp-api-levelProvided to allow compatibility between hxcpp versions.cpp
HXCPP-GC-GENERATIONALExperimental Garbage Collector.cpp
HXCPP-DEBUGGERInclude additional information for hxcpp-debugger.cpp
hxcpp-smart-stringsUse wide strings in hxcpp. (Turned on by default unless -D disable-unicode-strings is specified.)cpp
include-prefixPrepend path to generated include files.cpp
interpThe code is compiled to be run with --interp.all
jar-legacy-loaderUse the legacy loader to load .jar files on the JVM target.java
java-ver<version: 5-7>Sets the Java version to be targeted.java
js-classicDon't use a function wrapper and strict mode in JS output.js
js-es<version: 3 | 5 | 6>Generate JS compliant with given ES standard version. (default: 5) See target-javascript-es6.js
js-enums-as-arraysGenerate enum representation as array instead of as object.js
js_globalCustomizes the global object name.js
js-unflattenGenerate nested objects for packages and types.js
js-source-mapGenerate JavaScript source map even in non-debug mode. Deprecated in favor of -D source-map.js
source-mapGenerate source map for compiled files.php, js
jvmGenerate jvm directly.java
jvm.compression-levelSet the compression level of the generated file between 0 (no compression) and 9 (highest compression). Default: 6java
jvm.dynamic-levelControls the amount of dynamic support code being generated. 0 = none, 1 = field read/write optimization (default), 2 = compile-time method closuresjava
keep-old-outputKeep old source files in the output directory.cs, java
loop-unroll-max-cost<cost>Maximum cost (number of expressions * iterations) before loop unrolling is canceled. (default: 250)all
lua-jitEnable the jit compiler for lua (version 5.2 only).lua
lua-vanillaGenerate code lacking compiled extern lib support (e.g. utf8).lua
lua-ver<version>The lua version to target.lua
macroDefined when code is compiled in the macro context. See macro.all
macro-timesDisplay per-macro timing when used with --times.all
net-ver<version: 20-50>Sets the .NET version to be targeted.cs
netcore-ver<version: x.x.x>Sets the .NET core version to be targetedcs
net-target<name>Sets the .NET target. netcore (.NET core), xbox, micro (Micro Framework), compact (Compact Framework) are some valid values. (default: net)cs
neko-sourceOutput neko source instead of bytecode.neko
neko-no-haxelib-pathsDisable hard-coded Haxelib ndll paths.neko
neko-v1Keep Neko 1.x compatibility.neko
network-sandboxUse local network sandbox instead of local file access one.flash
no-compilationDisable final compilation.cs, java, cpp, hl
no-debugRemove all debug macros from cpp output.all
no-deprecation-warningsDo not warn if fields annotated with @:deprecated are used.all
no-flash-overrideChange overrides on some basic classes into HX suffixed methodsflash
no-optDisable optimizations.all
no-inlineDisable inlining. See class-field-inline.all
keep-inline-positionsDon't substitute positions of inlined expressions with the position of the place of inlining. See class-field-inline.all
no-rootGenerate top-level types into the haxe.root namespace.cs
no-macro-cacheDisable macro context caching.all
no-swf-compressDisable SWF output compression.flash
no-tracesDisable all trace calls.all
objcSets the hxcpp output to Objective-C++ classes. Must be defined for interop.cpp
old-error-formatUse Haxe 3.x zero-based column error messages instead of new one-based format.all
php-prefix<dot-separated namespace>Root namespace for generated php classes. E.g. if compiled with-D php-prefix=some.sub, then all classes will be generated in \some\sub namespace.php
php-lib<folder name>Select the name for the php lib folder.php
php-front<filename>Select the name for the php front file. (default: index.php)php
python-version<version>The python version to target. (default: 3.3)python
real-positionDisables Haxe source mapping when targetting C#, removes position comments in Java and Php output.cs, java, php
replace-filesGenCommon internal.cs, java
retain-untyped-metaPrevents arbitrary expression metadata from being discarded upon typing.all
scriptableGenCPP internal.cpp
shallow-exposeExpose types to surrounding scope of Haxe generated closure without writing to window object.js
source-headerPrint value as comment on top of generated files, use '' value to disable.all
source-map-contentInclude the Haxe sources as part of the JS source map.js
staticDefined if the current target is static.all
std-encoding-utf8Force utf8 encoding for stdin, stdout and stderrjava, cs, python
swcOutput a SWC instead of a SWF.flash
swf-compress-level<level: 1-9>Set the amount of compression for the SWF output.flash
swf-debug-password<password>Set a password for debugging.flash
swf-direct-blitUse hardware acceleration to blit graphics.flash
swf-gpuUse GPU compositing features when drawing graphics.flash
swf-headerdefine SWF header (width:height:fps:color)flash
swf-metadata<file>Include contents of the given file as metadata in the SWF.flash
swf-preloader-frameInsert empty first frame in SWF.flash
swf-protectedCompile Haxe private as protected in the SWF instead of public.flash
swf-script-timeout<time in seconds>Maximum ActionScript processing time before script stuck dialog box displays.flash
swf-use-doabcUse DoAbc SWF-tag instead of DoAbcDefine.flash
sysDefined for all system platforms.all
unsafeAllow unsafe code when targeting C#.cs
use-nekocUse nekoc compiler instead of the internal one.neko
utf16Defined for all platforms that use UTF-16 string encoding with UCS-2 API.all
vcprojGenCPP internal.cpp
warn-var-shadowingWarn about shadowing variable declarations.all
no-treDisable tail recursion elimination.all
message.reporting<mode: classic | pretty | indent>Select message reporting mode for compiler output. (default: classic)all
message.no-colorDisable ANSI color codes in message reporting.all
message.log-filePath to a text file to write message reporting to, in addition to regular output.all
message.log-format<format: classic | pretty | indent>Select message reporting mode for message log file. (default: indent)all