diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2013-08-26 15:35:15 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2013-08-26 15:35:15 (GMT) |
commit | 8194f34ef79a58dc5e57b374873be4e50ad7ad7b (patch) | |
tree | 876b1d75477a2babe7fd8a7ef555611825e52526 /hl | |
parent | a17e786cd732ca3af91ebb473a0bd116f391c94a (diff) | |
download | hdf5-8194f34ef79a58dc5e57b374873be4e50ad7ad7b.zip hdf5-8194f34ef79a58dc5e57b374873be4e50ad7ad7b.tar.gz hdf5-8194f34ef79a58dc5e57b374873be4e50ad7ad7b.tar.bz2 |
[svn-r24072] Merge trunk cmake changes to 1.8 branch.
Also add default switch blocks to h5import.
Merge h5dump any_path option from trunk.
Tested: local linux
Diffstat (limited to 'hl')
-rw-r--r-- | hl/c++/examples/CMakeLists.txt | 2 | ||||
-rw-r--r-- | hl/c++/examples/CMakeTests.cmake | 8 | ||||
-rw-r--r-- | hl/c++/test/CMakeLists.txt | 36 | ||||
-rw-r--r-- | hl/c++/test/CMakeTests.cmake | 8 | ||||
-rw-r--r-- | hl/examples/CMakeLists.txt | 36 | ||||
-rw-r--r-- | hl/examples/CMakeTests.cmake | 28 | ||||
-rw-r--r-- | hl/fortran/examples/CMakeLists.txt | 10 | ||||
-rw-r--r-- | hl/fortran/examples/CMakeTests.cmake | 10 | ||||
-rw-r--r-- | hl/fortran/test/CMakeLists.txt | 22 | ||||
-rw-r--r-- | hl/fortran/test/CMakeTests.cmake | 28 | ||||
-rw-r--r-- | hl/test/CMakeLists.txt | 70 | ||||
-rw-r--r-- | hl/test/CMakeTests.cmake | 70 | ||||
-rw-r--r-- | hl/tools/CMakeLists.txt | 30 | ||||
-rw-r--r-- | hl/tools/CMakeTests.cmake | 40 |
14 files changed, 245 insertions, 153 deletions
diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index aa4221f..f762839 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -22,5 +22,5 @@ TARGET_LINK_LIBRARIES ( SET_TARGET_PROPERTIES (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) IF (BUILD_TESTING) - ADD_TEST (NAME cpp_hl_ex_ptExampleFL COMMAND $<TARGET_FILE:ptExampleFL>) + INCLUDE (CMakeTests.cmake) ENDIF (BUILD_TESTING) diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake new file mode 100644 index 0000000..95cc8b4 --- /dev/null +++ b/hl/c++/examples/CMakeTests.cmake @@ -0,0 +1,8 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +ADD_TEST (NAME cpp_hl_ex_ptExampleFL COMMAND $<TARGET_FILE:ptExampleFL>) diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 6633426..46229ba 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -11,23 +11,21 @@ INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/c++/src) # Add in the unit tests for the packet table c++ wrapper # -------------------------------------------------------------------- -IF (BUILD_TESTING) - INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) - INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/test) - INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) +INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/test) +INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src) - ADD_EXECUTABLE (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) - TARGET_C_PROPERTIES (hl_ptableTest " " " ") - TARGET_NAMING (hl_ptableTest ${LIB_TYPE}) - TARGET_LINK_LIBRARIES ( - hl_ptableTest - ${HDF5_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_HL_CPP_LIB_TARGET} - ) - SET_TARGET_PROPERTIES (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) - - ADD_TEST (NAME hl_ptableTest COMMAND $<TARGET_FILE:hl_ptableTest>) -ENDIF (BUILD_TESTING) +ADD_EXECUTABLE (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) +TARGET_C_PROPERTIES (hl_ptableTest " " " ") +TARGET_NAMING (hl_ptableTest ${LIB_TYPE}) +TARGET_LINK_LIBRARIES ( + hl_ptableTest + ${HDF5_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_HL_CPP_LIB_TARGET} +) +SET_TARGET_PROPERTIES (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) + +INCLUDE (CMakeTests.cmake) diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake new file mode 100644 index 0000000..cb9454b --- /dev/null +++ b/hl/c++/test/CMakeTests.cmake @@ -0,0 +1,8 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + + ADD_TEST (NAME hl_ptableTest COMMAND $<TARGET_FILE:hl_ptableTest>) diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index b702754..36c799d 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -1,20 +1,6 @@ cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_EXAMPLES ) -SET (HDF5_TEST_FILES -) - -FOREACH (h5_file ${HDF5_TEST_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file}") - ADD_CUSTOM_COMMAND ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} - ) -ENDFOREACH (h5_file ${HDF5_TEST_FILES}) - #----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- @@ -46,30 +32,10 @@ FOREACH (example ${examples}) TARGET_C_PROPERTIES (hl_ex_${example} " " " ") TARGET_LINK_LIBRARIES (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_TARGET_PROPERTIES (hl_ex_${example} PROPERTIES FOLDER examples/hl) - - IF (BUILD_TESTING) - ADD_TEST (NAME hl_ex_${example} COMMAND $<TARGET_FILE:hl_ex_${example}>) - ENDIF (BUILD_TESTING) ENDFOREACH (example ${examples}) IF (BUILD_TESTING) - SET_TESTS_PROPERTIES (hl_ex_ex_lite2 PROPERTIES DEPENDS hl_ex_ex_lite1) -ENDIF (BUILD_TESTING) -IF (BUILD_TESTING) - SET (HDF5_TEST_FILES - image24pixel.txt - image8.txt - ) + INCLUDE (CMakeTests.cmake) - FOREACH (h5_file ${HDF5_TEST_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file}") - ADD_CUSTOM_COMMAND ( - TARGET hl_ex_ex_ds1 - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} - ) - ENDFOREACH (h5_file ${HDF5_TEST_FILES}) ENDIF (BUILD_TESTING) diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake new file mode 100644 index 0000000..e1ccba0 --- /dev/null +++ b/hl/examples/CMakeTests.cmake @@ -0,0 +1,28 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +SET (HDF5_TEST_FILES + image24pixel.txt + image8.txt +) + +FOREACH (h5_file ${HDF5_TEST_FILES}) + SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") + #MESSAGE (STATUS " Copying ${h5_file}") + ADD_CUSTOM_COMMAND ( + TARGET hl_ex_ex_ds1 + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} + ) +ENDFOREACH (h5_file ${HDF5_TEST_FILES}) + +FOREACH (example ${examples}) + ADD_TEST (NAME hl_ex_${example} COMMAND $<TARGET_FILE:hl_ex_${example}>) +ENDFOREACH (example ${examples}) + +SET_TESTS_PROPERTIES (hl_ex_ex_lite2 PROPERTIES DEPENDS hl_ex_ex_lite1) diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index df7fd24..0f663c7 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -27,8 +27,10 @@ FOREACH (example ${examples}) SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran) - IF (BUILD_TESTING) - ADD_TEST (NAME hl_f90_ex_${example} COMMAND $<TARGET_FILE:hl_f90_ex_${example}>) - ENDIF (BUILD_TESTING) - ENDFOREACH (example ${examples}) + +IF (BUILD_TESTING) + + INCLUDE (CMakeTests.cmake) + +ENDIF (BUILD_TESTING) diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake new file mode 100644 index 0000000..7e6c348 --- /dev/null +++ b/hl/fortran/examples/CMakeTests.cmake @@ -0,0 +1,10 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +FOREACH (example ${examples}) + ADD_TEST (NAME hl_f90_ex_${example} COMMAND $<TARGET_FILE:hl_f90_ex_${example}>) +ENDFOREACH (example ${examples}) diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 7e7aa1d..2084162 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -6,20 +6,6 @@ PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) -# Remove any output file left over from previous test run -ADD_TEST ( - NAME hl_fortran_test-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - dsetf1.h5 - dsetf2.h5 - dsetf3.h5 - dsetf4.h5 - dsetf5.h5 - f1image.h5 - f1tab.h5 -) - #-- Adding test for hl_f90_tstds ADD_EXECUTABLE (hl_f90_tstds tstds.f90) TARGET_NAMING (hl_f90_tstds ${LIB_TYPE}) @@ -28,8 +14,6 @@ TARGET_LINK_LIBRARIES (hl_f90_tstds ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TAR SET_TARGET_PROPERTIES (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran) -ADD_TEST (NAME hl_f90_tstds COMMAND $<TARGET_FILE:hl_f90_tstds>) - #-- Adding test for hl_f90_tstlite ADD_EXECUTABLE (hl_f90_tstlite tstlite.f90) TARGET_NAMING (hl_f90_tstlite ${LIB_TYPE}) @@ -38,8 +22,6 @@ TARGET_LINK_LIBRARIES (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_T SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) -ADD_TEST (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) - #-- Adding test for hl_f90_tstimage ADD_EXECUTABLE (hl_f90_tstimage tstimage.f90) TARGET_NAMING (hl_f90_tstimage ${LIB_TYPE}) @@ -48,8 +30,6 @@ TARGET_LINK_LIBRARIES (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB SET_TARGET_PROPERTIES (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran) -ADD_TEST (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) - #-- Adding test for hl_f90_tsttable ADD_EXECUTABLE (hl_f90_tsttable tsttable.f90) TARGET_NAMING (hl_f90_tsttable ${LIB_TYPE}) @@ -58,4 +38,4 @@ TARGET_LINK_LIBRARIES (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_ SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran) -ADD_TEST (NAME hl_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>) +INCLUDE (CMakeTests.cmake) diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake new file mode 100644 index 0000000..96209aa --- /dev/null +++ b/hl/fortran/test/CMakeTests.cmake @@ -0,0 +1,28 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +# Remove any output file left over from previous test run +ADD_TEST ( + NAME hl_fortran_test-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + dsetf1.h5 + dsetf2.h5 + dsetf3.h5 + dsetf4.h5 + dsetf5.h5 + f1image.h5 + f1tab.h5 +) + +ADD_TEST (NAME hl_f90_tstds COMMAND $<TARGET_FILE:hl_f90_tstds>) + +ADD_TEST (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) + +ADD_TEST (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) + +ADD_TEST (NAME hl_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>) diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 9cb61e0..f969dbf 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -20,7 +20,7 @@ INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- -MACRO (HL_ADD_TEST hl_name files) +MACRO (HL_ADD_EXE hl_name) ADD_EXECUTABLE (hl_${hl_name} ${hl_name}.c) TARGET_NAMING (hl_${hl_name} ${LIB_TYPE}) TARGET_C_PROPERTIES (hl_${hl_name} " " " ") @@ -30,66 +30,14 @@ MACRO (HL_ADD_TEST hl_name files) ${HDF5_TEST_LIB_TARGET} ) SET_TARGET_PROPERTIES (hl_${hl_name} PROPERTIES FOLDER test/hl) +ENDMACRO (HL_ADD_EXE) - ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (hl_${hl_name} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - - # -------------------------------------------------------------------- - #-- Copy the necessary files. - # -------------------------------------------------------------------- - FOREACH (h5_file ${files}) - SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}") - ADD_CUSTOM_COMMAND ( - TARGET hl_${hl_name} - PRE_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest} - ) - - ENDFOREACH (h5_file ${HL_REFERENCE_TEST_FILES}) -ENDMACRO (HL_ADD_TEST) - -# Remove any output file left over from previous test run -ADD_TEST ( - NAME hl_test-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - combine_tables1.h5 - combine_tables2.h5 - test_detach.h5 - test_ds1.h5 - test_ds2.h5 - test_ds3.h5 - test_ds4.h5 - test_ds5.h5 - test_ds6.h5 - test_ds7.h5 - test_ds8.h5 - test_ds9.h5 - test_dectris.h5 - test_image1.h5 - test_image2.h5 - test_image3.h5 - test_lite1.h5 - test_lite2.h5 - test_packet_compress.h5 - test_packet_table.h5 - test_table.h5 -) -IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (hl_test-clear-objects PROPERTIES DEPENDS ${last_test}) -ENDIF (NOT "${last_test}" STREQUAL "") -SET (last_test "hl_test-clear-objects") - -HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5") -HL_ADD_TEST (test_dset_opt "") -HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri") -HL_ADD_TEST (test_lite "dtype_file.txt") -HL_ADD_TEST (test_packet "") -HL_ADD_TEST (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5") +HL_ADD_EXE (test_ds) +HL_ADD_EXE (test_dset_opt) +HL_ADD_EXE (test_image) +HL_ADD_EXE (test_lite) +HL_ADD_EXE (test_packet) +HL_ADD_EXE (test_table) # -------------------------------------------------------------------- # This executable is used to generate test files for the test_ds test. @@ -106,3 +54,5 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ) SET_TARGET_PROPERTIES (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen) ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) + +INCLUDE (CMakeTests.cmake) diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake new file mode 100644 index 0000000..aa9c1c3 --- /dev/null +++ b/hl/test/CMakeTests.cmake @@ -0,0 +1,70 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +# -------------------------------------------------------------------- +# Macro used to add a unit test +# -------------------------------------------------------------------- +MACRO (HL_ADD_TEST hl_name files) + ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (hl_${hl_name} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + + # -------------------------------------------------------------------- + #-- Copy the necessary files. + # -------------------------------------------------------------------- + FOREACH (h5_file ${files}) + SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}") + #MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}") + ADD_CUSTOM_COMMAND ( + TARGET hl_${hl_name} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest} + ) + + ENDFOREACH (h5_file ${HL_REFERENCE_TEST_FILES}) +ENDMACRO (HL_ADD_TEST) + +# Remove any output file left over from previous test run +ADD_TEST ( + NAME hl_test-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + combine_tables1.h5 + combine_tables2.h5 + test_detach.h5 + test_ds1.h5 + test_ds2.h5 + test_ds3.h5 + test_ds4.h5 + test_ds5.h5 + test_ds6.h5 + test_ds7.h5 + test_ds8.h5 + test_ds9.h5 + test_dectris.h5 + test_image1.h5 + test_image2.h5 + test_image3.h5 + test_lite1.h5 + test_lite2.h5 + test_packet_compress.h5 + test_packet_table.h5 + test_table.h5 +) +IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (hl_test-clear-objects PROPERTIES DEPENDS ${last_test}) +ENDIF (NOT "${last_test}" STREQUAL "") +SET (last_test "hl_test-clear-objects") + +HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5") +HL_ADD_TEST (test_dset_opt "") +HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri") +HL_ADD_TEST (test_lite "dtype_file.txt") +HL_ADD_TEST (test_packet "") +HL_ADD_TEST (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5") diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index 1deff23..256ff89 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -34,20 +34,24 @@ TARGET_C_PROPERTIES (h52gif " " " ") TARGET_LINK_LIBRARIES (h52gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) SET_TARGET_PROPERTIES (h52gif PROPERTIES FOLDER tools/hl) -# -------------------------------------------------------------------- -# This executable can generate the actual test files - Currently not -# used in the CMake Build system as we rely on the test files that are -# shipped with HDF5 source archives -# -------------------------------------------------------------------- -IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) - ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) - TARGET_NAMING (hl_h52gifgentest ${LIB_TYPE}) - TARGET_C_PROPERTIES (hl_h52gifgentest " " " ") - TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) - SET_TARGET_PROPERTIES (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) +IF (BUILD_TESTING) + # -------------------------------------------------------------------- + # This executable can generate the actual test files - Currently not + # used in the CMake Build system as we rely on the test files that are + # shipped with HDF5 source archives + # -------------------------------------------------------------------- + IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) + ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) + TARGET_NAMING (hl_h52gifgentest ${LIB_TYPE}) + TARGET_C_PROPERTIES (hl_h52gifgentest " " " ") + TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + SET_TARGET_PROPERTIES (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) -# ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) -ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) +# ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) + ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) + + INCLUDE (CMakeTests.cmake) +ENDIF (BUILD_TESTING) #----------------------------------------------------------------------------- # Add file(s) to CMake Install diff --git a/hl/tools/CMakeTests.cmake b/hl/tools/CMakeTests.cmake new file mode 100644 index 0000000..9f987fd --- /dev/null +++ b/hl/tools/CMakeTests.cmake @@ -0,0 +1,40 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +# Make testfiles dir under build dir +FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + +# +# copy test files from source to build dir +# + +ADD_CUSTOM_COMMAND ( + TARGET gif2h5 + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/testfiles/image1.gif ${PROJECT_BINARY_DIR}/testfiles/image1.gif +) + +ADD_CUSTOM_COMMAND ( + TARGET h52gif + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/testfiles/h52giftst.h5 ${PROJECT_BINARY_DIR}/testfiles/h52giftst.h5 +) + +# Remove any output file left over from previous test run +ADD_TEST ( + NAME HL_TOOLS-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + image1.gif + image1.h5 +) + +ADD_TEST (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image1.gif -i image) + +ADD_TEST (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5> testfiles/image1.gif image1.h5) |