Search code examples
haxehxml

Compile to multiple languages with a single .hxml file in Haxe


Here's the basic Haxe "Hello World!" program:

class Main 
{
    public static function main() 
    {
        trace("Hello world");
    }
}

Here's the build file for the above program:

-main Main
-java java

Now I want to compile this program to Java, Javascript, and C++ with a single .hxml file. How should the .hxml file be formatted, in this case?


Solution

  • You should use the command "--next" to specify the next compile target. So:

    -main Main
    -java java
    
    --next
    
    -main Main
    -cpp cpp
    
    --next
    -flash out.swf