| 1 | module pref |
| 2 | |
| 3 | import os |
| 4 | |
| 5 | pub 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] |
| 12 | pub 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 | |