Section: build (Profile Enabled)

This section allows the user to configure the build step for C/C++/Assembly. This can be used to modify compiler/linker flags.

Key: build.sources (array of strings)

Paths to source directories to recursively scan for C/C++/Assembly source files. Sources generated by Megaton are automatically included and do not need to be specified. If the mod contains only Rust code, this can be omitted. Sources will be detected and matched based on file extension. The following extensions will be detected:

  • C: .c
  • C++: .cc, .c++, .cpp
  • Assembly: .s, .asm

Inheritance: Append

Default: []

Key: build.includes (array of strings)

Paths to include directories to be passed to the compiler as -I flags. Headers generated by Megaton are automatically included and do not need to be specified.

Inheritance: Append

Default: []

Key: build.libpaths (array of strings)

Paths to library directories to be passed to the compiler as -L flags.

Inheritance: Append

Default: []

Key: build.libraries (array of strings)

Libraries to be linked. These will be passed as -l flags to the linker. The names of libraries here must be discoverable in the directories specified in build.libpaths. For example, to link the library “foo”, add “foo” to this array and place the file libfoo.so in one of the library paths.

Inheritance: Append

Default: []

Key: build.objects (array of strings)

Additional .o and .a objects to link with, i.e. compiled objects that are not generated by Megaton.

Inheritance: Append

Default: []

Key: `build.flags’

Build flags to pass to the different tools on the build toolchain. All flags keys have the same inheritance behavior. In order to add a build flag, specify the value like this: [<"default">, -DDEBUG]. If the value is specified as [], The default flags will be disabled for that profile. See the Documentation to see what the default flags are.

Inheritance: Append

Default: [“”]

Key: build.flags.common

Flags for all tools except rust and cargo.

Key: build.flags.c

Flags for the C compiler.

Key: build.flags.cxx

Flags for the C++ compiler.

Key: build.flags.as

Flags for the assembler to use with assembly sources.

Key: build.flags.ld

Flags for the linker.

Key: build.flags.rust

Flags for rust. Corresponds to the RUSTFLAGS environment variable. Rust flags can also be specified in Cargo.toml, but placing them here allows them to be dynamically enabled using Megaton’s profile system.

Restrictions: Can only be specified if cargo.enabled = true

Key: build.flags.cargo

Flags to be passed to cargo, such as feature flags.

Restrictions: Can only be specified if cargo.enabled = true