1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

tests: only include GameConfig.hpp in source file (no header file)

This reduces compile time from 1m19s to 9s when touching GameConfig.hpp.

(Executed from rwgame/build/tests)
before:
$ make >/dev/null
$ touch ../../rwgame/GameConfig.hpp
$ time make>/dev/null

real	1m18.643s
user	1m13.069s
sys	0m5.266s

after:
$ make >/dev/null
$ touch ../../rwgame/GameConfig.hpp
$ time make>/dev/null

real	0m9.247s
user	0m8.374s
sys	0m0.836s
This commit is contained in:
Anonymous Maarten 2017-02-20 18:07:54 +01:00 committed by Daniel Evans
parent b1976fbcf2
commit 7a86c199b0
3 changed files with 11 additions and 4 deletions

View File

@ -12,6 +12,7 @@ find_package(Boost COMPONENTS filesystem unit_test_framework REQUIRED)
set(TEST_SOURCES
"main.cpp"
"test_globals.cpp"
"test_animation.cpp"
"test_archive.cpp"
"test_buoyancy.cpp"

9
tests/test_globals.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "test_globals.hpp"
#include <GameConfig.hpp>
#if RW_TEST_WITH_DATA
std::string Global::getGamePath() {
return GameConfig("openrw.ini").getGameDataPath();
}
#endif

View File

@ -2,7 +2,6 @@
#define _TESTGLOBABLS_HPP_
#include <SDL2/SDL.h>
#include <GameConfig.hpp>
#include <GameWindow.hpp>
#include <boost/test/unit_test.hpp>
#include <core/Logger.hpp>
@ -105,9 +104,7 @@ public:
}
#if RW_TEST_WITH_DATA
static std::string getGamePath() {
return GameConfig("openrw.ini").getGameDataPath();
}
static std::string getGamePath();
#endif
static Global& get() {