From b5f0057ac95db37dae17b8765396eb37ba9489a8 Mon Sep 17 00:00:00 2001 From: elsid Date: Thu, 21 Oct 2021 19:48:31 +0200 Subject: [PATCH] Fix tests on windows --- apps/openmw_test_suite/CMakeLists.txt | 15 +++++--------- apps/openmw_test_suite/esmloader/load.cpp | 10 +++++----- apps/openmw_test_suite/esmloader/settings.hpp | 20 ------------------- apps/openmw_test_suite/openmw_test_suite.cpp | 5 ----- components/esmloader/esmdata.hpp | 2 +- components/sqlite3/request.hpp | 1 + 6 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 apps/openmw_test_suite/esmloader/settings.hpp diff --git a/apps/openmw_test_suite/CMakeLists.txt b/apps/openmw_test_suite/CMakeLists.txt index 3d19834066..e82efaa718 100644 --- a/apps/openmw_test_suite/CMakeLists.txt +++ b/apps/openmw_test_suite/CMakeLists.txt @@ -77,17 +77,12 @@ if (GTEST_FOUND AND GMOCK_FOUND) endif (CMAKE_CL_64) endif (MSVC) - include(FetchContent) - FetchContent_Declare(example_suite_template_game - URL https://gitlab.com/OpenMW/example-suite/-/raw/8966dab24692555eec720c854fb0f73d108070cd/data/template.omwgame - URL_HASH MD5=bf3691034a38611534c74c3b89a7d2c3 - SOURCE_DIR fetched/example_suite_template_game - DOWNLOAD_NO_EXTRACT ON + file(DOWNLOAD + https://gitlab.com/OpenMW/example-suite/-/raw/8966dab24692555eec720c854fb0f73d108070cd/data/template.omwgame + ${CMAKE_CURRENT_BINARY_DIR}/data/template.omwgame + EXPECTED_MD5 bf3691034a38611534c74c3b89a7d2c3 ) - FetchContent_MakeAvailableExcludeFromAll(example_suite_template_game) - add_custom_target(example_suite_template_game SOURCES fetched/example_suite_template_game/template.omwgame) - - add_dependencies(openmw_test_suite example_suite_template_game) + target_compile_definitions(openmw_test_suite PRIVATE OPENMW_DATA_DIR="${CMAKE_CURRENT_BINARY_DIR}/data") endif() diff --git a/apps/openmw_test_suite/esmloader/load.cpp b/apps/openmw_test_suite/esmloader/load.cpp index 71a8d2534a..0f00847226 100644 --- a/apps/openmw_test_suite/esmloader/load.cpp +++ b/apps/openmw_test_suite/esmloader/load.cpp @@ -1,5 +1,3 @@ -#include "settings.hpp" - #include #include #include @@ -7,16 +5,18 @@ #include +#ifndef OPENMW_DATA_DIR +#error "OPENMW_DATA_DIR is not defined" +#endif + namespace { using namespace testing; using namespace EsmLoader; - using EsmLoaderTests::Settings; struct EsmLoaderTest : Test { - const boost::filesystem::path mDataDir {Settings::impl().mBasePath / "apps/openmw_test_suite/fetched/example_suite_template_game"}; - const Files::PathContainer mDataDirs {{mDataDir.string()}}; + const Files::PathContainer mDataDirs {{std::string(OPENMW_DATA_DIR)}}; const Files::Collections mFileCollections {mDataDirs, true}; const std::vector mContentFiles {{"template.omwgame"}}; }; diff --git a/apps/openmw_test_suite/esmloader/settings.hpp b/apps/openmw_test_suite/esmloader/settings.hpp deleted file mode 100644 index 0f36310bc6..0000000000 --- a/apps/openmw_test_suite/esmloader/settings.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef OPENMW_TEST_SUITE_LOAD_SETTINGS_H -#define OPENMW_TEST_SUITE_LOAD_SETTINGS_H - -#include - -namespace EsmLoaderTests -{ - struct Settings - { - boost::filesystem::path mBasePath; - - static Settings& impl() - { - static Settings value; - return value; - } - }; -} - -#endif diff --git a/apps/openmw_test_suite/openmw_test_suite.cpp b/apps/openmw_test_suite/openmw_test_suite.cpp index 5fb9bda901..7364b20fdb 100644 --- a/apps/openmw_test_suite/openmw_test_suite.cpp +++ b/apps/openmw_test_suite/openmw_test_suite.cpp @@ -1,9 +1,5 @@ -#include "esmloader/settings.hpp" - #include -#include - #ifdef WIN32 //we cannot use GTEST_API_ before main if we're building standalone exe application, //and we're linking GoogleTest / GoogleMock as DLLs and not linking gtest_main / gmock_main @@ -11,7 +7,6 @@ int main(int argc, char **argv) { #else GTEST_API_ int main(int argc, char **argv) { #endif - EsmLoaderTests::Settings::impl().mBasePath = boost::filesystem::path(argv[0]).parent_path(); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/components/esmloader/esmdata.hpp b/components/esmloader/esmdata.hpp index 624f50a5e6..afdcc1748d 100644 --- a/components/esmloader/esmdata.hpp +++ b/components/esmloader/esmdata.hpp @@ -15,7 +15,7 @@ namespace ESM struct GameSetting; struct Land; struct Static; - struct Variant; + class Variant; } namespace EsmLoader diff --git a/components/sqlite3/request.hpp b/components/sqlite3/request.hpp index 378dd5fdf7..339c7f7521 100644 --- a/components/sqlite3/request.hpp +++ b/components/sqlite3/request.hpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include