You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mats Wichmann edited this page Oct 1, 2021
·
3 revisions
SCons has built-in facilities to save variables to a file and load them back - especially useful to store information like installation prefix (if you want to make an uninstall target, for instance), or the results of a configure step.
First create a Variables object
# specify the name of the file in which variables are/will be storedvars=Variables('build-setup.conf')
# Register which variables we're interested in and# get values from a saved file if any.vars.Add('config', help='', default='release')
vars.Add('prefix', help='', default='/usr/local')
vars.Add('platform', help='', default='auto')
vars.Add('glut_enabled', help='', default=False)
vars.Add('havegettext', help='', default='')
# update these variables in your environmentvars.Update(env)
# do your stuff with the variablesifenv['config'] =="debug":
env.Append(CCFLAGS=['-g', '-Wfatal-errors'])
elifenv['config'] =="release":
env.Append(CCFLAGS=['-O3', '-DNDEBUG'])
# change variables if needed (e.g. if you're running a# 'configure' step, or if environment changed)ifchanging_values:
env['platform'] ="unix"# save new valuesvars.Save('build-setup.conf', env)