Initial commit

This commit is contained in:
Bassem Girgis
2017-09-26 23:34:25 -05:00
parent e854943328
commit 0393cd381b
2 changed files with 50 additions and 11 deletions

2
.gitignore vendored
View File

@@ -36,3 +36,5 @@
helloworld* helloworld*
env.txt env.txt
build/

View File

@@ -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() #
# Add build targets
open('env.txt', 'w').write(env.Dump()) #
env.Program(target='helloworld', env.Program(target='helloworld',
source=['main.cpp', 'foo.cpp']) source=['main.cpp', 'foo.cpp'])
envClang = env.Clone()
envClang.Replace(CXX='clang')
envClang.Program(target='helloworld-clang',
source=['main.cpp', 'foo.cpp'])