7.2 Global Compiler Flags

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

absolute_pathPrint absolute file path in trace output.all
advanced-telemetryAllow the SWF to be measured with Monocle tool.flash
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_verThe 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_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_stackRecord stack information in macro/interp mode.eval
eval_timesRecord per-method execution times in macro/interp mode. Implies eval_stack.eval
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
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
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 number>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_unflattenGenerate nested objects for packages and types.js
js_source_mapGenerate JavaScript source map even in non-debug mode.js
jvmGenerate jvm directly.java
source_mapGenerate source map for compiled files.php
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-45>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_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_coptDisable completion optimization (for debug purposes).all
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
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-constructor-inlineUse old constructor inlining logic (from Haxe 3.4.2) instead of the reworked version.all
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
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
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_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