From f8577d36117c005828bd2bb9dfe29c8a944eb9a0 Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Wed, 14 Aug 2024 22:29:52 -0700 Subject: [PATCH] Move examples to tests/examples subfolder --- docs/pages/userdocs/hdf5io.dox | 2 +- tests/CMakeLists.txt | 22 ++++++++++++++++--- .../test_HDF5IO_examples.cpp} | 0 3 files changed, 20 insertions(+), 4 deletions(-) rename tests/{testHDF5IO_docs_examples.cpp => examples/test_HDF5IO_examples.cpp} (100%) diff --git a/docs/pages/userdocs/hdf5io.dox b/docs/pages/userdocs/hdf5io.dox index 455b21f4..a47807f2 100644 --- a/docs/pages/userdocs/hdf5io.dox +++ b/docs/pages/userdocs/hdf5io.dox @@ -3,7 +3,7 @@ * * Coming soon * - * \snippet tests/testHDF5IO_docs_examples.cpp example_HDF5_with_SWMR_mode + * \snippet tests/examples/test_HDF5IO_examples.cpp example_HDF5_with_SWMR_mode * * - Initial size (data is expandable so doesn't matter too much), but if know it then we can set it * - What chunking to use? diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b3f611bf..e0f756b7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -18,13 +18,21 @@ add_executable(aq-nwb_test testHDF5IO.cpp testNWBFile.cpp testNWBRecording.cpp - testHDF5IO_docs_examples.cpp - ) + examples/test_HDF5IO_examples.cpp # Include examples source file +) + +# Ensure the aq-nwb_test target can include headers from the current directory and Catch2 +target_include_directories(aq-nwb_test PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} # Include current directory + ${CATCH2_INCLUDE_DIR} # Include Catch2 headers, if found by find_package +) + target_link_libraries( aq-nwb_test PRIVATE aq-nwb_lib Catch2::Catch2WithMain ) + target_compile_features(aq-nwb_test PRIVATE cxx_std_17) catch_discover_tests(aq-nwb_test) @@ -32,11 +40,19 @@ catch_discover_tests(aq-nwb_test) # ---- Custom Executable ---- add_executable(reader_executable - reader.cpp) + reader.cpp +) + +# Ensure the reader_executable target can include headers from the current directory +target_include_directories(reader_executable PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} # Include current directory +) + target_link_libraries( reader_executable PRIVATE aq-nwb_lib ) + target_compile_features(reader_executable PRIVATE cxx_std_17) # ---- End-of-file commands ---- diff --git a/tests/testHDF5IO_docs_examples.cpp b/tests/examples/test_HDF5IO_examples.cpp similarity index 100% rename from tests/testHDF5IO_docs_examples.cpp rename to tests/examples/test_HDF5IO_examples.cpp