编译参数

命令行参数

以下是所有可以传递给Haxe编译器的参数。

这些参数同时也可以放置在后缀为hxml的文本文件中,每行放置一个参数。这个文件可以被当作构建脚本传递给Haxe编译器。

编译目标

以下是Haxe 2.05提供的不同的编译目标和选项。

每个编译目标和它的选项需要进行一次编译,但例外的是在hxml文件中可以使用--next选项实现一个命令完成多次编译。

C++

参见: 如要获取编译C++文件的更多信息和设置方法请访问hxcpp

  • -cpp : 将代码编译为C++源代码。

Javascript

参见: 用Haxe/JS开发Javascript应用.

  • -js : 将代码编译为 JavaScript 代码。
  • --js-namespace <namespace> : 设定root类型的命名空间。

Neko

参见: Getting started with Haxe/Neko.

  • -neko : 将代码编译为Neko字节码。
  • -x : 在编译完成后运行编译出的文件。
  • --neko-source : 保留编译生成的neko源代码。

Flash

参见: Getting started with Haxe/Flash.

  • -as3 : 在目标目录中生成AS3代码。
  • -swf : 将代码编译成Flash SWF文件。
  • -swf9 : 将代码编译成Flash9 SWF文件。 (不推荐使用, 建议用 -swf-version 代替)
  • -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: 用Haxe/PHP开发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
  • -exclude : don’t generate code for classes listed in this 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

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 #12148, modified 2012-01-10 06:24:46 by arthur