gedeng/SConstruct
2021-03-20 16:55:43 +01:00

41 lines
1.2 KiB
Python

#!python
def add_third_party_includes(env):
env.Append(CPPPATH=['cpp/', 'cpp/vendor/spdlog/include'])
# Create the environment and create a Compilation Database for use in VSCodium
env = Environment(tools=['default', 'compilation_db'])
env.CompilationDatabase()
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
env.Append(CPPPATH=['cpp/', 'include/'])
add_third_party_includes(env)
# Build the library
gedeng = env.SharedLibrary('lib/gedeng', Glob('cpp/*.cpp'))
env.Install('test/bin/lib/', gedeng)
# Test environment setup
testEnv = Environment(tools=['default', 'compilation_db'])
testEnv.CompilationDatabase()
testEnv.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
testEnv.Append(CPPPATH=['include/', 'test/'])
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/\''
])
add_third_party_includes(testEnv)
# 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'))