v2 / vlib / v / pref / build_flags.v
23 lines · 20 sloc · 610 bytes · 469e268c799d054724cb68b04e4af2c1551fda56
Raw
1module pref
2
3import os
4
5pub fn get_build_facts_and_defines() ([]string, []string) {
6 facts := os.getenv('VBUILD_FACTS').split_any(',')
7 defines := os.getenv('VBUILD_DEFINES').split_any(',')
8 return facts, defines
9}
10
11@[manualfree]
12pub fn set_build_flags_and_defines(facts []string, defines []string) {
13 sfacts := facts.join(',')
14 sdefines := defines.join(',')
15 os.setenv('VBUILD_FACTS', sfacts, true)
16 os.setenv('VBUILD_DEFINES', sdefines, true)
17 $if trace_vbuild ? {
18 eprintln('> VBUILD_FACTS: ${sfacts}')
19 eprintln('> VBUILD_DEFINES: ${sdefines}')
20 }
21 unsafe { sdefines.free() }
22 unsafe { sfacts.free() }
23}
24