Skip to content

Commit

Permalink
this should work on windows as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mhekkel committed Mar 9, 2024
1 parent 3b92367 commit bd8e68d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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$<$<CONFIG:Debug>:Debug>DLL")
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()

# Create a revision file, containing the current git version info
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ else()
target_compile_definitions(unit-test-dssp PUBLIC CATCH22=1)
endif()

add_test(NAME unit-test-dssp COMMAND $<TARGET_FILE:unit-test-dssp> --data-dir ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME unit-test-dssp COMMAND $<TARGET_FILE:unit-test-dssp>
--data-dir ${CMAKE_CURRENT_SOURCE_DIR}/test
--rsrc-dir ${CMAKE_CURRENT_BINARY_DIR}/_deps/cifpp-src/rsrc)
7 changes: 7 additions & 0 deletions test/unit-test-dssp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}

Expand Down

0 comments on commit bd8e68d

Please sign in to comment.