Actually use the library in the test binaries

This commit is contained in:
karl 2021-03-20 14:02:35 +01:00
parent ce448f06de
commit b9dfd40089
3 changed files with 21 additions and 6 deletions

View File

@ -1,7 +1,10 @@
# GED Engine Snippets
## Building
Run `scons` in the root directory. This will generate the shared library as well as executables which run tests.
Run `scons` in the root directory. This will generate two things:
1. the shared library in `lib/`
2. test binaries in `test/bin/` which use the library created in step 1
## Developing
The `scons` command also generates a `compile_commands.json` which can be used by the VSCodium extension `clangd` for autocompletion, debugging, etc.

View File

@ -7,9 +7,21 @@ env.CompilationDatabase()
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
env.Append(CPPPATH=['.', 'include'])
# Build the library
env.SharedLibrary('lib/ged', Glob('cpp/*.cpp'))
# Build the test libraries
testEnv = DefaultEnvironment(tools=['default', 'compilation_db'])
testEnv.CompilationDatabase()
testEnv.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
testEnv.Append(CPPPATH=['test/', 'include/'])
testEnv.Append(LIBPATH=['lib/'])
testEnv.Append(LIBS=['ged'])
testEnv.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
testEnv.Append(CPPPATH=['.', 'include'])
# Build the test programs
catch_cpp = "test/catch_amalgamated.cpp"
Program('vector-test.out', [catch_cpp, 'test/vector-test.cpp'])
# Build the library
SharedLibrary('ged', Glob('cpp/*.cpp'))
testEnv.Program('test/bin/vector-test.out', [catch_cpp, 'test/vector-test.cpp'])

View File

@ -1,4 +1,4 @@
#include "Vector.h"
#include <Vector.h>
#include <iostream>
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this