Allow in-place build via scons --in-place
This commit is contained in:
parent
1ec64f4938
commit
2cead893fc
2 changed files with 16 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -21,4 +21,5 @@ Session.vim
|
||||||
cscope.out
|
cscope.out
|
||||||
build/
|
build/
|
||||||
.sconsign.dblite
|
.sconsign.dblite
|
||||||
|
*.os
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
|
||||||
19
SConstruct
19
SConstruct
|
|
@ -53,7 +53,12 @@ AddOption("--coverage",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Build with coverage instrumentation")
|
help="Build with coverage instrumentation")
|
||||||
|
|
||||||
env['BUILDDIR'] = 'build/$VARIANT'
|
AddOption("--in-place",
|
||||||
|
dest="in_place",
|
||||||
|
default=False,
|
||||||
|
action="store_true",
|
||||||
|
help="Build in-place, rather than in the build/<variant> tree")
|
||||||
|
|
||||||
|
|
||||||
dbg = env.Clone(VARIANT='debug')
|
dbg = env.Clone(VARIANT='debug')
|
||||||
dbg.Append(CCFLAGS=['-g'])
|
dbg.Append(CCFLAGS=['-g'])
|
||||||
|
|
@ -86,10 +91,16 @@ env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_"))
|
||||||
|
|
||||||
Export('env')
|
Export('env')
|
||||||
|
|
||||||
env.SConscript(["src/SConscript"], variant_dir='build/$VARIANT/src')
|
if not GetOption("in_place"):
|
||||||
env.SConscript(["examples/SConscript"], variant_dir='build/$VARIANT/examples')
|
env['BUILD_BASE'] = 'build/$VARIANT'
|
||||||
|
env.SConscript(["src/SConscript"], variant_dir='$BUILD_BASE/src')
|
||||||
|
env.SConscript(["examples/SConscript"], variant_dir='$BUILD_BASE/examples')
|
||||||
|
else:
|
||||||
|
env['BUILD_BASE'] = '.'
|
||||||
|
env.SConscript(["src/SConscript"])
|
||||||
|
env.SConscript(["examples/SConscript"])
|
||||||
|
|
||||||
env.Command('test', 'build/$VARIANT/src/test_suite', 'env LD_LIBRARY_PATH=build/$VARIANT/src $SOURCE')
|
env.Command('test', '$BUILD_BASE/src/test_suite', 'env LD_LIBRARY_PATH=$BUILD_BASE/src $SOURCE')
|
||||||
|
|
||||||
env.Alias("install", "$libpath")
|
env.Alias("install", "$libpath")
|
||||||
env.Alias("install", "$incpath")
|
env.Alias("install", "$incpath")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue