Cleanup SConstruct

This commit is contained in:
karl 2021-03-20 17:05:33 +01:00
parent fb29ca07d5
commit c4a9ee1fab

View File

@ -1,28 +1,37 @@
#!python #!python
# General utility functions
def add_third_party_includes(env): def add_third_party_includes(env):
env.Append(CPPPATH=['cpp/', 'cpp/vendor/spdlog/include']) env.Append(CPPPATH=['cpp/', 'cpp/vendor/spdlog/include'])
def add_strict_compile_flags(env):
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
# Create the environment and create a Compilation Database for use in VSCodium # Create the environment and create a Compilation Database for use in VSCodium
env = Environment(tools=['default', 'compilation_db']) env = Environment(tools=['default', 'compilation_db'])
env.CompilationDatabase() env.CompilationDatabase()
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
env.Append(CPPPATH=['cpp/', 'include/']) env.Append(CPPPATH=['cpp/', 'include/'])
add_third_party_includes(env) add_third_party_includes(env)
add_strict_compile_flags(env)
# Build the library # Build the library
gedeng = env.SharedLibrary('lib/gedeng', Glob('cpp/*.cpp')) gedeng = env.SharedLibrary('lib/gedeng', Glob('cpp/*.cpp'))
# Install the library to the test application's build directory
env.Install('test/bin/lib/', gedeng) env.Install('test/bin/lib/', gedeng)
# Test environment setup # -------------------------------------------------------------------------------
testEnv = Environment(tools=['default', 'compilation_db'])
testEnv.CompilationDatabase() # Test environment setup
testEnv = Environment(tools=['default'])
testEnv.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
testEnv.Append(CPPPATH=['include/', 'test/']) testEnv.Append(CPPPATH=['include/', 'test/'])
# Link to the Gedeng library
testEnv.Append(LIBPATH=['lib/']) testEnv.Append(LIBPATH=['lib/'])
testEnv.Append(LIBS=['gedeng']) testEnv.Append(LIBS=['gedeng'])
@ -32,6 +41,7 @@ testEnv.Append(LINKFLAGS=[
]) ])
add_third_party_includes(testEnv) add_third_party_includes(testEnv)
add_strict_compile_flags(testEnv)
# Build the test programs # Build the test programs
catch_cpp = "test/catch_amalgamated.cpp" catch_cpp = "test/catch_amalgamated.cpp"