gedeng/SConstruct

51 lines
1.4 KiB
Python
Raw Normal View History

#!python
2021-03-20 17:05:33 +01:00
# General utility functions
2021-03-20 16:55:43 +01:00
def add_third_party_includes(env):
env.Append(CPPPATH=['cpp/', 'cpp/vendor/spdlog/include'])
2021-03-20 17:05:33 +01:00
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
env = Environment(tools=['default', 'compilation_db'])
env.CompilationDatabase()
env.Append(CPPPATH=['cpp/', 'include/'])
2021-03-15 13:50:07 +01:00
2021-03-20 16:55:43 +01:00
add_third_party_includes(env)
2021-03-20 17:05:33 +01:00
add_strict_compile_flags(env)
2021-03-20 16:55:43 +01:00
# Build the library
gedeng = env.SharedLibrary('lib/gedeng', Glob('cpp/*.cpp'))
2021-03-20 17:05:33 +01:00
# Install the library to the test application's build directory
env.Install('test/bin/lib/', gedeng)
2021-03-20 17:05:33 +01:00
# -------------------------------------------------------------------------------
# Test environment setup
2021-03-20 17:05:33 +01:00
testEnv = Environment(tools=['default'])
testEnv.Append(CPPPATH=['include/', 'test/'])
2021-03-20 17:05:33 +01:00
# Link to the Gedeng library
testEnv.Append(LIBPATH=['lib/'])
testEnv.Append(LIBS=['gedeng'])
# Make the test executables search for the gedeng lib in their ./lib folder
testEnv.Append(LINKFLAGS=[
'-Wl,--disable-new-dtags,-rpath,\'$$ORIGIN/lib/\''
])
2021-03-20 16:55:43 +01:00
add_third_party_includes(testEnv)
2021-03-20 17:05:33 +01:00
add_strict_compile_flags(testEnv)
2021-03-20 16:55:43 +01:00
# Build the test programs
catch_cpp = "test/catch_amalgamated.cpp"
testEnv.Program('test/bin/vector-test.out', [catch_cpp, 'test/vector/vector-test.cpp'])
testEnv.Program('test/bin/test-app.out', Glob('test/test-app/*.cpp'))