2018-03-10 02:31:58 +08:00
|
|
|
cmake_minimum_required (VERSION 3.10)
|
2010-09-01 04:15:13 +08:00
|
|
|
PROJECT (HDF5_HL_TEST)
|
2010-05-14 00:01:50 +08:00
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# Notes: When creating unit test executables they should be prefixed
|
|
|
|
# with "hl_". This allows for easier filtering of the test suite when
|
|
|
|
# using ctest. An example would be
|
|
|
|
# ctest -R hl_
|
|
|
|
# which would only run the High Level based unit tests.
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Generate the H5srcdir_str.h file containing user settings needed by compilation
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-03-12 05:14:57 +08:00
|
|
|
set (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
|
2014-03-12 06:07:13 +08:00
|
|
|
configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# Macro used to add a unit test
|
|
|
|
# --------------------------------------------------------------------
|
2013-08-20 05:49:44 +08:00
|
|
|
MACRO (HL_ADD_EXE hl_name)
|
2014-03-12 05:14:57 +08:00
|
|
|
add_executable (hl_${hl_name} ${hl_name}.c)
|
2018-04-18 04:57:51 +08:00
|
|
|
set_property(TARGET hl_${hl_name} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
|
2015-08-05 23:56:58 +08:00
|
|
|
TARGET_C_PROPERTIES (hl_${hl_name} STATIC " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
target_link_libraries (hl_${hl_name}
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_HL_LIB_TARGET}
|
|
|
|
${HDF5_TEST_LIB_TARGET}
|
2016-05-05 00:14:45 +08:00
|
|
|
${HDF5_LIB_TARGET}
|
2010-05-14 00:01:50 +08:00
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
|
2017-01-11 07:09:53 +08:00
|
|
|
ENDMACRO ()
|
2010-05-14 00:01:50 +08:00
|
|
|
|
2015-08-05 23:56:58 +08:00
|
|
|
MACRO (HL_ADD_SHEXE hl_name)
|
|
|
|
add_executable (hl_${hl_name} ${hl_name}.c)
|
2018-04-18 04:57:51 +08:00
|
|
|
set_property(TARGET hl_${hl_name} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
|
2015-08-05 23:56:58 +08:00
|
|
|
TARGET_C_PROPERTIES (hl_${hl_name} SHARED " " " ")
|
|
|
|
target_link_libraries (hl_${hl_name}
|
|
|
|
${HDF5_HL_LIBSH_TARGET}
|
|
|
|
${HDF5_TEST_LIBSH_TARGET}
|
2016-05-05 00:14:45 +08:00
|
|
|
${HDF5_LIBSH_TARGET}
|
2015-08-05 23:56:58 +08:00
|
|
|
)
|
|
|
|
set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
|
2017-01-11 07:09:53 +08:00
|
|
|
ENDMACRO ()
|
2015-08-05 23:56:58 +08:00
|
|
|
|
2013-08-20 05:49:44 +08:00
|
|
|
HL_ADD_EXE (test_lite)
|
2016-05-05 00:14:45 +08:00
|
|
|
HL_ADD_EXE (test_image)
|
|
|
|
HL_ADD_EXE (test_file_image)
|
2013-08-20 05:49:44 +08:00
|
|
|
HL_ADD_EXE (test_table)
|
2016-05-05 00:14:45 +08:00
|
|
|
HL_ADD_EXE (test_ds)
|
|
|
|
HL_ADD_EXE (test_dset_opt)
|
|
|
|
HL_ADD_EXE (test_ld)
|
|
|
|
HL_ADD_EXE (test_dset_append)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
2016-03-05 04:12:05 +08:00
|
|
|
# test_packet has two source files
|
|
|
|
add_executable (hl_test_packet test_packet.c test_packet_vlen.c)
|
2018-04-18 04:57:51 +08:00
|
|
|
set_property(TARGET hl_test_packet APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
|
2016-03-05 04:12:05 +08:00
|
|
|
TARGET_C_PROPERTIES (hl_test_packet STATIC " " " ")
|
|
|
|
target_link_libraries (hl_test_packet
|
|
|
|
${HDF5_HL_LIB_TARGET}
|
|
|
|
${HDF5_TEST_LIB_TARGET}
|
2016-05-05 00:14:45 +08:00
|
|
|
${HDF5_LIB_TARGET}
|
2016-03-05 04:12:05 +08:00
|
|
|
)
|
|
|
|
set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl)
|
|
|
|
|
2010-05-14 00:01:50 +08:00
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# This executable is used to generate test files for the test_ds test.
|
|
|
|
# It should only be run during development when new test files are needed
|
|
|
|
# --------------------------------------------------------------------
|
2015-08-05 23:56:58 +08:00
|
|
|
if (HDF5_BUILD_GENERATORS)
|
2014-03-12 05:14:57 +08:00
|
|
|
add_executable (hl_gen_test_ds gen_test_ds.c)
|
2018-04-18 04:57:51 +08:00
|
|
|
set_property(TARGET hl_gen_test_ds APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
|
2015-04-02 05:02:43 +08:00
|
|
|
TARGET_C_PROPERTIES (hl_gen_test_ds STATIC " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
target_link_libraries (hl_gen_test_ds
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_HL_LIB_TARGET}
|
|
|
|
${HDF5_TEST_LIB_TARGET}
|
2016-05-05 00:14:45 +08:00
|
|
|
${HDF5_LIB_TARGET}
|
2010-05-14 00:01:50 +08:00
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen)
|
2016-05-05 00:14:45 +08:00
|
|
|
|
|
|
|
add_executable (hl_gen_test_ld gen_test_ld.c)
|
2018-04-18 04:57:51 +08:00
|
|
|
set_property(TARGET hl_gen_test_ld APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
|
2016-05-05 00:14:45 +08:00
|
|
|
TARGET_C_PROPERTIES (hl_gen_test_ld STATIC " " " ")
|
|
|
|
target_link_libraries (hl_gen_test_ld
|
|
|
|
${HDF5_HL_LIB_TARGET}
|
|
|
|
${HDF5_TEST_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
|
|
|
)
|
|
|
|
set_target_properties (hl_gen_test_ld PROPERTIES FOLDER test/hl/gen)
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2013-08-20 05:49:44 +08:00
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
include (CMakeTests.cmake)
|