Skip to content

Commit

Permalink
fixup: tests for optional deps.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Feb 16, 2024
1 parent 377800d commit 32cf5db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cmake/HighFiveOptionalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif()

if(NOT TARGET HighFiveEigenDependency)
add_library(HighFiveEigenDependency INTERFACE)
if(HIGHFIVE_TEST_EIGEN AND NOT TARGET HighFiveEigenDependency)
if(HIGHFIVE_TEST_EIGEN)
find_package(Eigen3 REQUIRED NO_MODULE)
target_link_libraries(HighFiveEigenDependency INTERFACE Eigen3::Eigen)
target_compile_definitions(HighFiveEigenDependency INTERFACE HIGHFIVE_TEST_EIGEN=1)
Expand All @@ -20,7 +20,7 @@ endif()

if(NOT TARGET HighFiveXTensorDependency)
add_library(HighFiveXTensorDependency INTERFACE)
if(HIGHFIVE_TEST_XTENSOR AND NOT TARGET HighFiveXTensorDependency)
if(HIGHFIVE_TEST_XTENSOR)
find_package(xtensor REQUIRED)
target_link_libraries(HighFiveXTensorDependency INTERFACE xtensor)
target_compile_definitions(HighFiveXTensorDependency INTERFACE HIGHFIVE_TEST_XTENSOR=1)
Expand All @@ -29,7 +29,7 @@ endif()

if(NOT TARGET HighFiveOpenCVDependency)
add_library(HighFiveOpenCVDependency INTERFACE)
if(HIGHFIVE_TEST_OPENCV AND NOT TARGET HighFiveOpenCVDependency)
if(HIGHFIVE_TEST_OPENCV)
find_package(OpenCV REQUIRED)
target_include_directories(HighFiveOpenCVDependency SYSTEM INTERFACE ${OpenCV_INCLUDE_DIRS})
target_link_libraries(HighFiveOpenCVDependency INTERFACE ${OpenCV_LIBS})
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/tests_high_five_easy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@

#include <stdio.h>

#include <highfive/H5Easy.hpp>

#ifdef HIGHFIVE_TEST_XTENSOR
#include <xtensor/xrandom.hpp>
#include <xtensor/xview.hpp>
#endif

#ifdef HIGHFIVE_TEST_EIGEN
#include <Eigen/Dense>
#endif


#include <highfive/H5Easy.hpp>

#include <catch2/catch_test_macros.hpp>

TEST_CASE("H5Easy_Compression") {
Expand Down

0 comments on commit 32cf5db

Please sign in to comment.