compiler cli - BSVino/JaiPrimer GitHub Wiki
The compiler has the following command-line syntax.
jai.exe <filename> <std_args> -- <user_args>
Where:
- <filename> is the entry point of the program, usually a path with file name with the .jai extension
- <std_args> are the standard arguments of the compiler
- <user_args> are the arguments defined by the programmer and used by the metaprogramming routines
The compiler standard arguments are only a few because most of the settings are accessible directly in the code. So even for batch automated build processing of different versions of the program is more effective to use user_args.
| std_args | Meaning |
|---|---|
| -no_color | The error messages output will be monochrome |
The user-defined arguments used by metaprogramming must be the last ones and must be separated by the -- symbol.
User-defined arguments can be whatever and can be accessed by the call to:
args : [..]string = compiler_get_command_line_arguments();
Reference: Youtube video 2018/06/06
A convenient way to set up different versions of a program by specifying different user_args is by creating a series of tiny wrapper files and passing the arguments to the compiler using code:
#import "Compiler";
args :: {:string: "x64", "os=linux", "-speed", "ver=1.0.2", "deploy=steam" };
#run {
compiler_set_command_line_arguments(args);
add_build_file("\mygame\src\mygame.jai");
};
Reference: Youtube video 2018/06/06
All this allows the programmer to deal with different operating systems without the need for using other different tools to build the programs.
The entire language can work also as a scripting tool for operations automation.