Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libjpeg-turbo8-dev libpng-dev
sudo apt-get install -y libjpeg-turbo8-dev libpng-dev catch2
- name: Build string_theory
run: |
mkdir -p build_deps && cd build_deps
Expand Down
34 changes: 25 additions & 9 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
include(FetchContent)
FetchContent_Declare(Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.10
)
FetchContent_MakeAvailable(Catch2)
find_package(Catch2 3.4 QUIET)
if(NOT Catch2_FOUND)
# Force Catch2 to be built as a static lib
set(BUILD_SHARED_LIBS__save ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)

include(FetchContent)
FetchContent_Declare(Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.11.0
)
FetchContent_MakeAvailable(Catch2)
list(APPEND CMAKE_MODULE_PATH "${catch2_SOURCE_DIR}/contrib")

set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS__save})
endif()

set(test_SOURCES
catch2_main.cpp
Test_Location.cpp
)
add_executable(test_HSPlasma ${test_SOURCES})
target_link_libraries(test_HSPlasma PRIVATE Catch2::Catch2 HSPlasma)
target_link_libraries(test_HSPlasma PRIVATE Catch2::Catch2WithMain HSPlasma)

if(WIN32 AND BUILD_SHARED_LIBS)
# Catch2 needs the HSPlasma DLL available to run <test_executable> --list-tests
add_custom_command(
TARGET test_HSPlasma PRE_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_FILE:HSPlasma> $<TARGET_FILE_DIR:test_HSPlasma>
)
endif()

# Integrate with CTest so we can use the built-in test targets
list(APPEND CMAKE_MODULE_PATH "${catch2_SOURCE_DIR}/contrib")
include(CTest)
include(Catch)
catch_discover_tests(test_HSPlasma)
2 changes: 1 addition & 1 deletion Tests/Test_Location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with HSPlasma. If not, see <http://www.gnu.org/licenses/>.
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include "PRP/KeyedObject/plLocation.h"

Expand Down
19 changes: 0 additions & 19 deletions Tests/catch2_main.cpp

This file was deleted.

Loading