Skip to content

Build Events

Demez edited this page Jun 12, 2020 · 1 revision

Build events act like functions, and all text in them is called in the systems terminal

Defining a build event:

// defined in the root of the script
// The entries after the event name (in this case, foobar) are parameter names.
// Each parameter acts as a local macro
build_event "foobar" "ARG_01"
{
    "echo $ARG_01"
}

Each argument in a build event acts as a local macro, only defined in that scope

Build Events are called in any of these build steps:

  • pre_build - This is ran before building is started
  • post_build - This is ran after building is finished
  • pre_link - This is ran before linking is started

Examples of Calling build events:

configuration
{
    // these are sections to use a build event in
    pre_build
    {
        // This the "direct literal" call
        foobar "example"
        
        // If you call this with a direct literal, it won't try to expand the wildcard
        // to match files in the directory -- it will literally pass in *.cpp.
        foobar "*.cpp"
        
        // To pass multiple files into a build event, use this bracket syntax,
        // it only works if the build event has 1 argument
        foobar
        {
            "file1.h"
            "file2.h"
            // wildcards are supported using this syntax
            "*.cpp"
        }
        
        // If you want to use wildcards, but in a single line, you can do this:
        foobar { "*.cpp" }
    }
}
Clone this wiki locally