From bd8e68d7d73cb87979200437412f8aa949cf81ed Mon Sep 17 00:00:00 2001 From: "Maarten L. Hekkelman" Date: Sat, 9 Mar 2024 14:19:01 +0100 Subject: [PATCH] this should work on windows as well --- .github/workflows/cmake-multi-platform.yml | 2 -- CMakeLists.txt | 9 ++++++++- test/CMakeLists.txt | 4 +++- test/unit-test-dssp.cpp | 7 +++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 8595093..7b7d50a 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -60,6 +60,4 @@ jobs: - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }}/test run: ctest --build-config Release --output-on-failure - env: - LIBCIFPP_DATA_DIR: ${{ steps.strings.outputs.build-output-dir }}/_deps/cifpp-src/rsrc diff --git a/CMakeLists.txt b/CMakeLists.txt index 438d9be..8bec009 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,12 @@ if(MSVC) get_WIN32_WINNT(ver) add_definitions(-D_WIN32_WINNT=${ver}) + + if(BUILD_SHARED_LIBS) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif() endif() # Create a revision file, containing the current git version info @@ -124,7 +130,8 @@ if(NOT PDB_REDO_META) cifpp ${EXLC} GIT_REPOSITORY https://github.com/pdb-redo/libcifpp.git - GIT_TAG v7.0.1) + GIT_TAG 92bd52d + ) FetchContent_MakeAvailable(cifpp) endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e40fb53..99a27f1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,4 +39,6 @@ else() target_compile_definitions(unit-test-dssp PUBLIC CATCH22=1) endif() -add_test(NAME unit-test-dssp COMMAND $ --data-dir ${CMAKE_CURRENT_SOURCE_DIR}) +add_test(NAME unit-test-dssp COMMAND $ + --data-dir ${CMAKE_CURRENT_SOURCE_DIR}/test + --rsrc-dir ${CMAKE_CURRENT_BINARY_DIR}/_deps/cifpp-src/rsrc) diff --git a/test/unit-test-dssp.cpp b/test/unit-test-dssp.cpp index 6a110b8..38ddd35 100644 --- a/test/unit-test-dssp.cpp +++ b/test/unit-test-dssp.cpp @@ -74,9 +74,13 @@ int main(int argc, char *argv[]) using namespace Catch::Clara; #endif + std::filesystem::path rsrc_dir; + auto cli = session.cli() // Get Catch2's command line parser | Opt(gTestDir, "data-dir") // bind variable to a new option, with a hint string ["-D"]["--data-dir"] // the option names it will respond to + | Opt(rsrc_dir, "rsrc-dir") // bind variable to a new option, with a hint string + ["-D"]["--rsrc-dir"] // the option names it will respond to ("The directory containing the data files"); // description string for the help output // Now pass the new composite back to Catch2 so it uses that @@ -87,6 +91,9 @@ int main(int argc, char *argv[]) if (returnCode != 0) // Indicates a command line error return returnCode; + if (not rsrc_dir.empty() and std::filesystem::exists(rsrc_dir)) + cif::add_data_directory(rsrc_dir); + return session.run(); }