v.build_constraint #
fn new_environment #
fn new_environment(facts []string, defines []string) &Environment
new_environment creates a new Environment. facts
is a list of predefined platforms, compilers, build options etc, for example: ['linux', 'tinyc', 'prod', 'amd64'] defines
is a list of the user defines, for example: ['abc', 'gcboehm_opt', 'gg_record', 'show_fps']
struct Environment #
@[heap]
struct Environment {
pub mut:
facts map[string]bool
defines map[string]bool
}
Environment represents the current build environment.
fn (Environment) eval #
fn (b &Environment) eval(constraint string) !bool
eval evaluates the given build constraint
against the current environment. The constraint can be for example something simple like just linux
, but it can be also a more complex logic expression like: (windows && tinyc) || prod
fn (Environment) is_fact #
fn (b &Environment) is_fact(fact string) bool
is_fact checks whether the given fact
is present in the environment.
fn (Environment) is_define #
fn (b &Environment) is_define(define string) bool
is_define checks whether the given define
is present in the environment.