Build system¶
#load "build/build.bl"
Compiler integrated build pipeline. Build pipline can be used to manage whole project compilation process directly in BL. All you need is to create the build file called build.bl and specify the build_entry function inside. When -b flag is used without need of specifying any files, the compiler will lookup build.bl file in the current directory and execute it in compile time. All compilation steps, assembly input and output can be specified here. Example: Build System.
Example of minimal build.bl:
build :: fn () #build_entry {
// create new executable assembly
exe :: add_executable("MyProgram");
// add 'main.bl' file into the assembly 'exe'
add_unit(exe, "main.bl");
}
Start build pipeline using our build.bl file:
$ blc -build
Compiler will automatically use build.bl file as build script and execute build function in compile time. SDK file build/build.bl containing compiler API for build pipeline manipulation is loaded implicitly.
Warning
Build API is available only in compile-time.
Basics¶
Create new assembly¶
Assembly is a single build target defined as consisting of build Units representing source files needed for compilation. It’s basically a target compiled into an executable or binary file. Use add_executable function to specify your assembly. There are several options related to assembly, described later in this documentation.
exe :: add_assembly("MyProgram");
Add file into assembly¶
Use add_unit function to add source files into the assembly. There is no need to add all files you want to use, general load and import will do so automatically. Only main or entry files must be included.
add_unit(exe, "main.bl");
Specify output directory¶
Output directory is a directory where all compiler-produced files will be written (i.e. native executables). Use set_output_dir function to specify this directory, current directory is used by default.
set_output_dir(exe, "bin");
Command line argumets¶
All argumets passed after -build|-b compiler flag are automatically forwarded into command_line_arguments global variable.