From 7a86c199b04dd668eb6ac5b0cf438bb5cc1a30ef Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 20 Feb 2017 18:07:54 +0100 Subject: [PATCH] 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 --- tests/CMakeLists.txt | 1 + tests/test_globals.cpp | 9 +++++++++ tests/test_globals.hpp | 5 +---- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 tests/test_globals.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 839dc190..69256caa 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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" diff --git a/tests/test_globals.cpp b/tests/test_globals.cpp new file mode 100644 index 00000000..68f200d4 --- /dev/null +++ b/tests/test_globals.cpp @@ -0,0 +1,9 @@ +#include "test_globals.hpp" + +#include + +#if RW_TEST_WITH_DATA +std::string Global::getGamePath() { + return GameConfig("openrw.ini").getGameDataPath(); +} +#endif diff --git a/tests/test_globals.hpp b/tests/test_globals.hpp index e476997d..1deb5525 100644 --- a/tests/test_globals.hpp +++ b/tests/test_globals.hpp @@ -2,7 +2,6 @@ #define _TESTGLOBABLS_HPP_ #include -#include #include #include #include @@ -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() {