SCons: Use list in Append() to ensure proper argument spacing

Otherwise we can end up with `scons CXXFLAGS="some-arg"` giving
a `some-arg-std=c++11` argument when `-std=c++11` is Append()'ed.
This commit is contained in:
Rémi Verschelde
2018-04-07 15:51:36 +02:00
parent 3909d80360
commit 539664ecd6

View File

@@ -46,7 +46,7 @@ env.VariantDir('#build/obj', 'src')
env.VariantDir('#build/obj/test', 'test') env.VariantDir('#build/obj/test', 'test')
if env['debug']: if env['debug']:
env.Append(CCFLAGS = '-g') env.Append(CCFLAGS=['-g'])
# This command generates the header with git revision information # This command generates the header with git revision information
def gen_gitrev(env, target, source): def gen_gitrev(env, target, source):
@@ -83,7 +83,7 @@ if platform == "posix":
/usr/include /usr/include
""")) """))
if platform == "darwin": if platform == "darwin":
env.Append(CXXFLAGS="-std=c++11 -stdlib=libc++ -include global.hpp", RPATH='../Frameworks') env.Append(CXXFLAGS=["-std=c++11","-stdlib=libc++","-include","global.hpp"], RPATH='../Frameworks')
env["CC"] = 'clang' env["CC"] = 'clang'
env["CXX"] = 'clang++' env["CXX"] = 'clang++'
env.Append(BUILDERS={ env.Append(BUILDERS={
@@ -166,8 +166,8 @@ if platform == "darwin":
elif platform == "win32": elif platform == "win32":
if 'msvc' in env['TOOLS']: if 'msvc' in env['TOOLS']:
env.Append( env.Append(
LINKFLAGS='/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup /MACHINE:X86', LINKFLAGS=['/SUBSYSTEM:WINDOWS','/ENTRY:mainCRTStartup','/MACHINE:X86'],
CXXFLAGS='/EHsc /MD /FIglobal.hpp', CXXFLAGS=['/EHsc','/MD','/FIglobal.hpp'],
LIBPATH=("C:\Program Files (x86)\Microsoft Visual Studio " + env['MSVC_VERSION'] + "\VC\lib"), LIBPATH=("C:\Program Files (x86)\Microsoft Visual Studio " + env['MSVC_VERSION'] + "\VC\lib"),
LIBS=Split(""" LIBS=Split("""
kernel32 kernel32
@@ -185,11 +185,11 @@ elif platform == "win32":
""") """)
) )
else: else:
env.Append(CXXFLAGS="-include global.hpp") env.Append(CXXFLAGS=["-include","global.hpp"])
def build_app_package(env, source, build_dir, info): def build_app_package(env, source, build_dir, info):
env.Install(build_dir, source) env.Install(build_dir, source)
elif platform == "posix": elif platform == "posix":
env.Append(CXXFLAGS="-include global.hpp") env.Append(CXXFLAGS=["-include","global.hpp"])
def build_app_package(env, source, build_dir, info): def build_app_package(env, source, build_dir, info):
env.Install(build_dir, source) env.Install(build_dir, source)
@@ -197,41 +197,41 @@ env.AddMethod(build_app_package, "Package")
# Allow user to specify additional library/include paths # Allow user to specify additional library/include paths
env.Append( env.Append(
LIBPATH = ARGUMENTS.get('LIBPATH', '').split(path.pathsep), LIBPATH=ARGUMENTS.get('LIBPATH', '').split(path.pathsep),
CPPPATH = ARGUMENTS.get('INCLUDEPATH', '').split(path.pathsep) CPPPATH=ARGUMENTS.get('INCLUDEPATH', '').split(path.pathsep)
) )
if platform == 'darwin': if platform == 'darwin':
env.Append(FRAMEWORKPATH=ARGUMENTS.get('FRAMEWORKPATH', '').split(path.pathsep)) env.Append(FRAMEWORKPATH=ARGUMENTS.get('FRAMEWORKPATH', '').split(path.pathsep))
# If any package managers are installed, add their dirs too. # If any package managers are installed, add their dirs too.
if subprocess.call(['which', '-s', 'port']) == 0: # MacPorts if subprocess.call(['which', '-s', 'port']) == 0: # MacPorts
env.Append( env.Append(
LIBPATH = '/opt/local/lib', LIBPATH=['/opt/local/lib'],
CPPPATH = '/opt/local/include', CPPPATH=['/opt/local/include'],
FRAMEWORKPATH = '/opt/local/Library/Frameworks' FRAMEWORKPATH=['/opt/local/Library/Frameworks']
) )
if subprocess.call(['which', '-s', 'fink']) == 0: # Fink if subprocess.call(['which', '-s', 'fink']) == 0: # Fink
env.Append( env.Append(
LIBPATH = '/sw/lib', LIBPATH=['/sw/lib'],
CPPPATH = '/sw/include' CPPPATH=['/sw/include']
) )
# pretty sketchy, but should point to your boost install # pretty sketchy, but should point to your boost install
if subprocess.call(['which', '-s', 'brew']) == 0: # HomeBrew if subprocess.call(['which', '-s', 'brew']) == 0: # HomeBrew
brew_boost_version = '1.58.0' brew_boost_version = '1.58.0'
env.Append( env.Append(
LIBPATH = '/usr/local/Cellar/boost/'+brew_boost_version+'/lib', LIBPATH=['/usr/local/Cellar/boost/'+brew_boost_version+'/lib'],
CPPPATH = '/usr/local/Cellar/boost/'+brew_boost_version+'/include') CPPPATH=['/usr/local/Cellar/boost/'+brew_boost_version+'/include'])
# Sometimes it's easier just to copy the dependencies into the repo dir # Sometimes it's easier just to copy the dependencies into the repo dir
# We try to auto-detect this. # We try to auto-detect this.
if path.exists('deps/lib'): if path.exists('deps/lib'):
env.Append(LIBPATH='deps/lib') env.Append(LIBPATH=['deps/lib'])
if platform == 'darwin': if platform == 'darwin':
env.Append(FRAMEWORKPATH='deps/lib') env.Append(FRAMEWORKPATH=['deps/lib'])
if path.exists('deps/include'): if path.exists('deps/include'):
env.Append(CPPPATH='deps/include') env.Append(CPPPATH=['deps/include'])
# Include directories # Include directories
@@ -314,11 +314,11 @@ if not env.GetOption('clean'):
env = conf.Finish() env = conf.Finish()
env.Append(CPPDEFINES="TIXML_USE_TICPP") env.Append(CPPDEFINES=["TIXML_USE_TICPP"])
if platform == "win32": if platform == "win32":
# For the *resource.h headers # For the *resource.h headers
env.Append(CPPPATH="#rsrc/menus") env.Append(CPPPATH=["#rsrc/menus"])
if platform == "darwin": if platform == "darwin":
env.Append(LIBS=Split(""" env.Append(LIBS=Split("""