Add test application; fix linking issues with it

This commit is contained in:
karl 2021-03-20 15:50:02 +01:00
parent 59b432abc7
commit 5d64b4c239
4 changed files with 29 additions and 6 deletions

View File

@ -8,19 +8,25 @@ env.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
env.Append(CPPPATH=['cpp/', 'include/']) env.Append(CPPPATH=['cpp/', 'include/'])
# Build the library # Build the library
env.SharedLibrary('lib/ged', Glob('cpp/*.cpp')) gedeng = env.SharedLibrary('lib/gedeng', Glob('cpp/*.cpp'))
env.Install('test/bin/lib/', gedeng)
# Build the test libraries # Test environment setup
testEnv = Environment(tools=['default', 'compilation_db']) testEnv = Environment(tools=['default', 'compilation_db'])
testEnv.CompilationDatabase() testEnv.CompilationDatabase()
testEnv.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"]) testEnv.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
testEnv.Append(CPPPATH=['test/', 'include/']) testEnv.Append(CPPPATH=['include/', 'test/'])
testEnv.Append(LIBPATH=['lib/']) testEnv.Append(LIBPATH=['lib/'])
testEnv.Append(LIBS=['ged']) testEnv.Append(LIBS=['gedeng'])
testEnv.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"]) # Make the test executables search for the gedeng lib in their ./lib folder
testEnv.Append(LINKFLAGS=[
'-Wl,--disable-new-dtags,-rpath,\'$$ORIGIN/lib/\''
])
# Build the test programs # Build the test programs
catch_cpp = "test/catch_amalgamated.cpp" catch_cpp = "test/catch_amalgamated.cpp"
testEnv.Program('test/bin/vector-test.out', [catch_cpp, 'test/vector-test.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'))

View File

@ -3,6 +3,7 @@
namespace Gedeng { namespace Gedeng {
class Application { class Application {
public:
Application() = default; Application() = default;
// Virtual since this class will be inherited by user-created applications // Virtual since this class will be inherited by user-created applications

16
test/test-app/main.cpp Normal file
View File

@ -0,0 +1,16 @@
#include <Gedeng.h>
class TestApp : public Gedeng::Application {
public:
TestApp() = default;
~TestApp() = default;
};
int main() {
TestApp *app = new TestApp();
app->run();
delete app;
}