Skip to content

Commit

Permalink
Made location of .scons-option-cache modifiable from command line.
Browse files Browse the repository at this point in the history
  • Loading branch information
loonycyborg authored and irydacea committed Jun 12, 2014
1 parent 1d54d37 commit e545e18
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions SConstruct
Expand Up @@ -15,8 +15,9 @@ from subprocess import Popen, PIPE, call
from os import access, F_OK

# Warn user of current set of build options.
if os.path.exists('.scons-option-cache'):
optfile = file('.scons-option-cache')
AddOption('--option-cache', dest='option_cache', nargs=1, type = 'string', action = 'store', metavar = 'FILE', help='file with cached construction variables', default = '.scons-option-cache')
if os.path.exists(GetOption("option_cache")):
optfile = file(GetOption("option_cache"))
print "Saved options:", optfile.read().replace("\n", ", ")[:-2]
optfile.close()

Expand All @@ -37,7 +38,7 @@ except KeyError:
# Build-control options
#

opts = Variables('.scons-option-cache')
opts = Variables(GetOption("option_cache"))

def OptionalPath(key, val, env):
if val:
Expand Down Expand Up @@ -119,7 +120,7 @@ if env["lockfile"]:
import atexit
atexit.register(os.remove, lockfile)

opts.Save('.scons-option-cache', env)
opts.Save(GetOption("option_cache"), env)
env.SConsignFile("$build_dir/sconsign.dblite")

# Make sure the user's environment is always available
Expand Down Expand Up @@ -195,8 +196,8 @@ You can make the following special build targets:
Files made by targets marked with '(*)' are cleaned by 'scons -c all'
Options are cached in a file named .scons-option-cache and persist to later
invocations. The file is editable. Delete it to start fresh. Current option
values can be listed with 'scons -h'.
invocations. The file is editable. Delete it to start fresh. You can also use a different file by
specifying --option-cache=FILE command line argument. Current option values can be listed with 'scons -h'.
If you set CXXFLAGS and/or LDFLAGS in the environment, the values will
be appended to the appropriate variables within scons.
Expand Down

0 comments on commit e545e18

Please sign in to comment.