haXe Compiler

Command Line Arguments

Here is a list of the different arguments that you are able to pass to the HaXe compiler.

These arguments can also be placed into a text file of one per line with the extension hxml. This file can then be passed directly to the haxe compiler as a build script.

Targets

These are the different targets and options provided with HaXe 2.05.

Each target and it's options may only be used once per call the compiler. --next can be used in hxml files to utilize multiple calls with one command.

C++

See: hxcpp for more information on setting up your environment to compile the C++ files.

  • -cpp : compile code to C++ files

Javascript

See: Getting started with haXe/JS.

  • -js : compile code to JavaScript file
  • --js-namespace <namespace> : create a namespace where root types are defined

Neko

See: Getting started with haXe/Neko.

  • -neko : compile code to Neko Binary
  • -x : shortcut for compiling and executing a neko file
  • --neko-source : keep generated neko source

Flash

See: Getting started with haXe/Flash.

  • -as3 : generate AS3 code into target directory
  • -swf : compile code to Flash SWF file
  • -swf9 : compile code to Flash9 SWF file (Deprecated: Use -swf-version instead)
  • -swf-version : change the SWF version (6 to 10). Implies the `-D flashN` switch, where `N` is the SWF version specified
  • -swf-header : define SWF header (width:height:fps:color)
  • -swf-lib : add the SWF library to the compiled SWF
  • --flash-strict : more type strict flash API
  • --flash-use-stage : place objects found on the stage of the SWF lib

PHP

See: Getting started with haXe/PHP.

  • -php : generate PHP code into target directory
  • --php-front : select the name for the PHP front file
  • --php-lib : It's the path generated library, stored by defaut in the 'lib' sub directory.

XML

  • -xml : generate XML types description

Compilation Options

  • -main : select startup class
  • -lib : use an haxelib library (-lib libname:version)
  • -D : define a conditional compilation flag
    See: Conditional Compilation
  • -resource [@name] : add a named resource file
  • -debug : add debug information to the compiled code
  • --no-opt : disable code optimizations
  • --no-traces : don’t compile trace calls in the program
  • --no-inline : disable inlining
  • --remap : remap a package to another one
  • -cp : add a directory to find source files

Macro Options

  • ???

Compiler Interaction Options

  • --display : display code tips (see the introductory blog post here)
  • -v : turn on verbose mode
  • -prompt : prompt on error
  • --times : measure compilation times
  • -help : Display this list of options
  • --help : Display this list of options

Batch Processing Commands

  • -cmd : run the specified command after successful compilation (Note: Version 2.04 and earlier will only run after a successful compile. Will not run without a target)
  • --gen-hx-classes : generate hx headers from SWF9 file
  • --next : separate several haxe compilations
  • --no-output : compiles but does not generate any file
version #11738, modified 2011-11-11 05:48:07 by jjdonald