Skip to content

add_executable

Declaration

add_executable :: fn (name: string) Assembly

Description

Add new executable assembly into the current compilation queue. Assembly with specified name is compiled into binary or it can be just executed in compile-time without any output created. Assemblies are compiled after build_entry function execution in order they are added.

Arguments

  • name Name of the assembly (used also as name of the output file).

Result

Assembly handle.

Example

build :: fn () #build_entry {
    exe :: add_executable("MyProgram");
    add_unit(exe, "src/main.bl");

    mode :: get_build_mode(exe);
    switch mode {
        BuildMode.Debug {
            set_output_dir(exe, "build/debug");
        }

        BuildMode.ReleaseSmall,
        BuildMode.ReleaseFast {
            set_output_dir(exe, "build/release");
        }
    }
}

Declared in: build.bl