diff --git a/include/highfive/bits/H5DataType_misc.hpp b/include/highfive/bits/H5DataType_misc.hpp index 619e51e71..8098a675c 100644 --- a/include/highfive/bits/H5DataType_misc.hpp +++ b/include/highfive/bits/H5DataType_misc.hpp @@ -520,7 +520,3 @@ inline DataType create_datatype() { } } // namespace HighFive - -#ifdef H5_USE_HALF_FLOAT -#include -#endif diff --git a/include/highfive/bits/H5Inspector_misc.hpp b/include/highfive/bits/H5Inspector_misc.hpp index ac3872dda..d85a4de12 100644 --- a/include/highfive/bits/H5Inspector_misc.hpp +++ b/include/highfive/bits/H5Inspector_misc.hpp @@ -640,11 +640,3 @@ struct inspector { } // namespace details } // namespace HighFive - -#ifdef H5_USE_BOOST -#include -#endif - -#ifdef H5_USE_EIGEN -#include -#endif diff --git a/include/highfive/boost.hpp b/include/highfive/boost.hpp index 8992159a2..3dd4c9f9e 100644 --- a/include/highfive/boost.hpp +++ b/include/highfive/boost.hpp @@ -1,5 +1,4 @@ #pragma once -#ifdef H5_USE_BOOST #include "bits/H5Inspector_decl.hpp" #include "H5Exception.hpp" @@ -160,5 +159,3 @@ struct inspector> { } // namespace details } // namespace HighFive - -#endif diff --git a/include/highfive/eigen.hpp b/include/highfive/eigen.hpp index c47095dde..f91dab24c 100644 --- a/include/highfive/eigen.hpp +++ b/include/highfive/eigen.hpp @@ -1,5 +1,4 @@ #pragma once -#ifdef H5_USE_EIGEN #include "bits/H5Inspector_decl.hpp" #include "H5Exception.hpp" @@ -89,5 +88,3 @@ struct inspector> { } // namespace details } // namespace HighFive - -#endif diff --git a/include/highfive/half_float.hpp b/include/highfive/half_float.hpp index 998e693ff..dc2464c22 100644 --- a/include/highfive/half_float.hpp +++ b/include/highfive/half_float.hpp @@ -1,5 +1,4 @@ #pragma once -#ifdef H5_USE_HALF_FLOAT #include @@ -16,6 +15,5 @@ inline AtomicType::AtomicType() { // Floating point exponent bias detail::h5t_set_ebias(_hid, 15); } -} // namespace HighFive -#endif +} // namespace HighFive diff --git a/src/examples/boost_multi_array_2D.cpp b/src/examples/boost_multi_array_2D.cpp index 4bec1ec12..508c3a880 100644 --- a/src/examples/boost_multi_array_2D.cpp +++ b/src/examples/boost_multi_array_2D.cpp @@ -8,11 +8,9 @@ */ #include -#undef H5_USE_BOOST -#define H5_USE_BOOST - #include #include +#include using namespace HighFive; diff --git a/src/examples/boost_multiarray_complex.cpp b/src/examples/boost_multiarray_complex.cpp index 37481db62..34f18f551 100644 --- a/src/examples/boost_multiarray_complex.cpp +++ b/src/examples/boost_multiarray_complex.cpp @@ -9,12 +9,9 @@ #include #include -#undef H5_USE_BOOST -#define H5_USE_BOOST - #include -#include +#include typedef std::complex complex_t; diff --git a/src/examples/boost_ublas_double.cpp b/src/examples/boost_ublas_double.cpp index b025475b9..3889df680 100644 --- a/src/examples/boost_ublas_double.cpp +++ b/src/examples/boost_ublas_double.cpp @@ -8,11 +8,10 @@ */ #include -#undef H5_USE_BOOST -#define H5_USE_BOOST - #include +#include + // In some versions of Boost (starting with 1.64), you have to include the serialization header // before ublas #include diff --git a/src/examples/create_dataset_half_float.cpp b/src/examples/create_dataset_half_float.cpp index 837c58704..015776699 100644 --- a/src/examples/create_dataset_half_float.cpp +++ b/src/examples/create_dataset_half_float.cpp @@ -12,6 +12,7 @@ #include #include +#include const std::string FILE_NAME("create_dataset_half_float_example.h5"); const std::string DATASET_NAME("dset"); diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index a105e331e..18110d83f 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -46,6 +46,18 @@ option(HIGHFIVE_TEST_SINGLE_INCLUDES "Enable testing single includes" FALSE) if(HIGHFIVE_TEST_SINGLE_INCLUDES) file(GLOB public_headers LIST_DIRECTORIES false RELATIVE ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include/highfive/*.hpp) foreach(PUBLIC_HEADER ${public_headers}) + if(PUBLIC_HEADER STREQUAL "highfive/boost.hpp" AND NOT HIGHFIVE_USE_BOOST) + continue() + endif() + + if(PUBLIC_HEADER STREQUAL "highfive/half_float.hpp" AND NOT HIGHFIVE_USE_HALF_FLOAT) + continue() + endif() + + if(PUBLIC_HEADER STREQUAL "highfive/eigen.hpp" AND NOT HIGHFIVE_USE_EIGEN) + continue() + endif() + get_filename_component(CLASS_NAME ${PUBLIC_HEADER} NAME_WE) configure_file(tests_import_public_headers.cpp "tests_${CLASS_NAME}.cpp" @ONLY) add_executable("tests_include_${CLASS_NAME}" "${CMAKE_CURRENT_BINARY_DIR}/tests_${CLASS_NAME}.cpp") diff --git a/tests/unit/data_generator.hpp b/tests/unit/data_generator.hpp index 9a6712d53..f5dc681c5 100644 --- a/tests/unit/data_generator.hpp +++ b/tests/unit/data_generator.hpp @@ -8,7 +8,7 @@ #include #ifdef H5_USE_BOOST -#include +#include #endif #include diff --git a/tests/unit/tests_high_five.hpp b/tests/unit/tests_high_five.hpp index 9d259c8d1..fa0cfd714 100644 --- a/tests/unit/tests_high_five.hpp +++ b/tests/unit/tests_high_five.hpp @@ -43,6 +43,8 @@ using base_test_types = std::tuple; #ifdef H5_USE_HALF_FLOAT +#include + using float16_t = half_float::half; using numerical_test_types = decltype(std::tuple_cat(std::declval(), std::tuple())); diff --git a/tests/unit/tests_high_five_base.cpp b/tests/unit/tests_high_five_base.cpp index c4c953ae1..8cba8f205 100644 --- a/tests/unit/tests_high_five_base.cpp +++ b/tests/unit/tests_high_five_base.cpp @@ -27,6 +27,15 @@ #include #include "tests_high_five.hpp" +#ifdef H5_USE_BOOST +#include +#endif + +#ifdef H5_USE_EIGEN +#include +#endif + + using namespace HighFive; using Catch::Matchers::Equals; diff --git a/tests/unit/tests_high_five_multi_dims.cpp b/tests/unit/tests_high_five_multi_dims.cpp index 08fbea9ce..31757d6c5 100644 --- a/tests/unit/tests_high_five_multi_dims.cpp +++ b/tests/unit/tests_high_five_multi_dims.cpp @@ -15,6 +15,7 @@ #ifdef H5_USE_BOOST #include +#include #endif #include