Initial commit
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -36,3 +36,5 @@
|
||||
|
||||
helloworld*
|
||||
env.txt
|
||||
build/
|
||||
|
||||
|
||||
@@ -1,15 +1,52 @@
|
||||
|
||||
import os
|
||||
|
||||
Help("""
|
||||
|
||||
This is the third scons example. In this example we see more things that we
|
||||
can do with scons. Namely: arguments, variant build directory, and install.
|
||||
|
||||
One can add the help for the expected build arguments using this help
|
||||
function call
|
||||
|
||||
DEBUG=1,0 - enable debug build, default 1
|
||||
ASSERT=1,0 - enable run time assertion, default 1 in DEBUG=1 and 0 otherwise
|
||||
COMPILER=compilerName - compiler name
|
||||
BUILDNAME=buildName - build name
|
||||
|
||||
""")
|
||||
|
||||
#
|
||||
# Processing arguments
|
||||
#
|
||||
debugArg = ARGUMENTS.get('DEBUG', '1')
|
||||
if debugArg not in ['0', '1']:
|
||||
raise RuntimeError('Check the DEBUG input argument.')
|
||||
|
||||
assertArg = '1' if debugArg == '1' else ARGUMENTS.get('ASSERT', '0')
|
||||
if assertArg not in ['0', '1']:
|
||||
raise RuntimeError('Check the ASSERT input argument.')
|
||||
|
||||
compilerName = ARGUMENTS.get('COMPILER', '')
|
||||
buildName = ARGUMENTS.get('BUILDNAME', 'default')
|
||||
|
||||
#
|
||||
# Initializing the environment
|
||||
#
|
||||
env = Environment(CC='clang',
|
||||
CXX='clang')
|
||||
|
||||
if compilerName == 'gcc':
|
||||
env.Replace(CC='gcc')
|
||||
env.Replace(CXX='g++')
|
||||
|
||||
srcDir = Dir('#').abspath
|
||||
|
||||
buildDir =
|
||||
|
||||
|
||||
env = Environment()
|
||||
|
||||
open('env.txt', 'w').write(env.Dump())
|
||||
|
||||
#
|
||||
# Add build targets
|
||||
#
|
||||
env.Program(target='helloworld',
|
||||
source=['main.cpp', 'foo.cpp'])
|
||||
|
||||
envClang = env.Clone()
|
||||
envClang.Replace(CXX='clang')
|
||||
|
||||
envClang.Program(target='helloworld-clang',
|
||||
source=['main.cpp', 'foo.cpp'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user