2012-09-14 04:41:54 +08:00
|
|
|
IF(BUILD_SHARED_LIBS AND WIN32)
|
2014-04-03 04:26:42 +08:00
|
|
|
remove_definitions(-DDLL_EXPORT)
|
|
|
|
remove_definitions(-DDLL_NETCDF)
|
2012-09-14 04:41:54 +08:00
|
|
|
ENDIF()
|
2012-08-07 00:57:29 +08:00
|
|
|
|
2012-08-10 06:54:19 +08:00
|
|
|
ADD_CUSTOM_COMMAND(
|
2015-08-19 06:10:18 +08:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ctest.c
|
2014-06-07 03:57:02 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/ref_ctest.c"
|
2015-08-19 06:10:18 +08:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/ctest.c"
|
2014-04-03 04:26:42 +08:00
|
|
|
)
|
2012-08-10 06:54:19 +08:00
|
|
|
ADD_CUSTOM_COMMAND(
|
2015-08-19 06:10:18 +08:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ctest64.c
|
2014-06-07 03:57:02 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/ref_ctest64.c"
|
2015-08-19 06:10:18 +08:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/ctest64.c"
|
2014-04-03 04:26:42 +08:00
|
|
|
)
|
2012-08-08 06:58:15 +08:00
|
|
|
|
2012-08-22 04:08:53 +08:00
|
|
|
SET(ncdump_FILES ncdump.c vardata.c dumplib.c indent.c nctime0.c utils.c nciter.c)
|
|
|
|
SET(nccopy_FILES nccopy.c nciter.c chunkspec.c utils.c dimmap.c)
|
2012-08-08 06:58:15 +08:00
|
|
|
|
2012-09-14 04:41:54 +08:00
|
|
|
IF(USE_X_GETOPT)
|
2014-04-03 04:26:42 +08:00
|
|
|
SET(ncdump_FILES ${ncdump_FILES} XGetopt.c)
|
|
|
|
SET(nccopy_FILES ${nccopy_FILES} XGetopt.c)
|
2012-09-14 02:27:23 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
ADD_EXECUTABLE(ncdump ${ncdump_FILES})
|
|
|
|
ADD_EXECUTABLE(nccopy ${nccopy_FILES})
|
|
|
|
|
2012-08-11 05:44:00 +08:00
|
|
|
TARGET_LINK_LIBRARIES(ncdump netcdf ${ALL_TLL_LIBS})
|
|
|
|
TARGET_LINK_LIBRARIES(nccopy netcdf ${ALL_TLL_LIBS})
|
2012-08-04 06:24:29 +08:00
|
|
|
|
2015-01-28 04:57:51 +08:00
|
|
|
####
|
|
|
|
# We have to do a little tweaking
|
|
|
|
# to remove the Release/ and Debug/ directories
|
|
|
|
# in MSVC builds. This is required to get
|
|
|
|
# test scripts to work.
|
|
|
|
####
|
|
|
|
IF(MSVC)
|
2015-02-05 05:11:20 +08:00
|
|
|
SET_TARGET_PROPERTIES(ncdump PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2015-01-28 04:57:51 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2015-02-05 05:11:20 +08:00
|
|
|
SET_TARGET_PROPERTIES(ncdump PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2015-01-28 04:57:51 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(ncdump PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
2015-02-05 05:11:20 +08:00
|
|
|
SET_TARGET_PROPERTIES(nccopy PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2015-01-28 04:57:51 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2015-02-05 05:11:20 +08:00
|
|
|
SET_TARGET_PROPERTIES(nccopy PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2015-01-28 04:57:51 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(nccopy PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
2012-08-08 06:58:15 +08:00
|
|
|
IF(ENABLE_TESTS)
|
2014-04-03 04:26:42 +08:00
|
|
|
ADD_EXECUTABLE(rewrite-scalar rewrite-scalar.c)
|
|
|
|
ADD_EXECUTABLE(bom bom.c)
|
2016-01-06 13:26:20 +08:00
|
|
|
ADD_EXECUTABLE(tst_dimsizes tst_dimsizes.c)
|
2014-04-03 04:26:42 +08:00
|
|
|
TARGET_LINK_LIBRARIES(rewrite-scalar netcdf)
|
|
|
|
TARGET_LINK_LIBRARIES(bom netcdf)
|
2016-01-06 13:26:20 +08:00
|
|
|
TARGET_LINK_LIBRARIES(tst_dimsizes netcdf)
|
2015-01-28 05:20:24 +08:00
|
|
|
|
2016-08-08 23:24:19 +08:00
|
|
|
IF(USE_NETCDF4)
|
2016-05-04 11:17:06 +08:00
|
|
|
ADD_EXECUTABLE(tst_fileinfo tst_fileinfo.c)
|
|
|
|
TARGET_LINK_LIBRARIES(tst_fileinfo netcdf)
|
|
|
|
ENDIF()
|
|
|
|
|
2015-01-28 05:20:24 +08:00
|
|
|
IF(MSVC)
|
2015-02-05 05:11:20 +08:00
|
|
|
SET_TARGET_PROPERTIES(rewrite-scalar PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2015-01-28 05:20:24 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(rewrite-scalar PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(rewrite-scalar PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
2015-02-05 05:11:20 +08:00
|
|
|
SET_TARGET_PROPERTIES(bom PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2015-01-28 05:20:24 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2015-02-05 05:11:20 +08:00
|
|
|
SET_TARGET_PROPERTIES(bom PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2015-01-28 05:20:24 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(bom PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2016-01-06 13:26:20 +08:00
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES(tst_dimsizes PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(tst_dimsizes PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(tst_dimsizes PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2017-01-19 12:46:47 +08:00
|
|
|
|
2017-01-20 00:59:17 +08:00
|
|
|
IF(USE_NETCDF4)
|
|
|
|
SET_TARGET_PROPERTIES(tst_fileinfo PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(tst_fileinfo PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(tst_fileinfo PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
ENDIF()
|
2015-01-28 05:20:24 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2014-04-03 04:26:42 +08:00
|
|
|
# Base tests
|
|
|
|
# The tests are set up as a combination of shell scripts and executables that
|
|
|
|
# must be run in a particular order. It is painful but will use macros to help
|
|
|
|
# keep it from being too bad.
|
2015-02-05 05:11:20 +08:00
|
|
|
|
2014-04-03 04:26:42 +08:00
|
|
|
## Start adding tests in the appropriate order
|
|
|
|
add_sh_test(ncdump run_tests)
|
|
|
|
add_sh_test(ncdump tst_64bit)
|
|
|
|
add_bin_test(ncdump ctest)
|
|
|
|
add_bin_test(ncdump ctest64)
|
|
|
|
add_sh_test(ncdump tst_output)
|
|
|
|
add_sh_test(ncdump tst_lengths)
|
|
|
|
add_sh_test(ncdump tst_calendars)
|
|
|
|
add_bin_test(ncdump tst_utf8)
|
|
|
|
add_sh_test(ncdump run_utf8_tests)
|
2015-10-23 04:09:19 +08:00
|
|
|
IF(USE_NETCDF4)
|
|
|
|
add_sh_test(ncdump run_utf8_nc4_tests)
|
2017-01-20 00:59:17 +08:00
|
|
|
add_sh_test(ncdump tst_fileinfo)
|
2015-10-23 04:09:19 +08:00
|
|
|
ENDIF(USE_NETCDF4)
|
|
|
|
|
2014-04-03 04:26:42 +08:00
|
|
|
add_sh_test(ncdump tst_nccopy3)
|
|
|
|
add_sh_test(ncdump tst_charfill)
|
2015-01-31 00:40:48 +08:00
|
|
|
|
2015-05-30 03:34:35 +08:00
|
|
|
add_sh_test(ncdump tst_formatx3)
|
|
|
|
add_sh_test(ncdump tst_bom)
|
2016-01-09 03:55:11 +08:00
|
|
|
add_sh_test(ncdump tst_dimsizes)
|
2017-01-20 00:59:17 +08:00
|
|
|
|
2015-04-21 06:06:20 +08:00
|
|
|
# The following test script invokes
|
|
|
|
# gcc directly.
|
|
|
|
IF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
2015-05-30 03:34:35 +08:00
|
|
|
IF(ENABLE_LARGE_FILE_TESTS)
|
2015-04-21 06:06:20 +08:00
|
|
|
add_sh_test(ncdump tst_iter)
|
2015-05-30 03:34:35 +08:00
|
|
|
ENDIF(ENABLE_LARGE_FILE_TESTS)
|
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
2015-01-31 00:40:48 +08:00
|
|
|
|
2015-05-30 03:34:35 +08:00
|
|
|
IF(BUILD_DISKLESS)
|
2015-11-07 04:20:10 +08:00
|
|
|
add_sh_test(ncdump tst_inmemory_nc3)
|
|
|
|
IF(USE_NETCDF4)
|
|
|
|
add_sh_test(ncdump tst_inmemory_nc4)
|
|
|
|
ENDIF(USE_NETCDF4)
|
|
|
|
ENDIF(BUILD_DISKLESS)
|
2015-02-05 05:11:20 +08:00
|
|
|
|
2014-04-03 04:26:42 +08:00
|
|
|
IF(USE_NETCDF4)
|
|
|
|
add_bin_test(ncdump tst_create_files)
|
|
|
|
add_bin_test(ncdump tst_group_data)
|
|
|
|
add_bin_test(ncdump tst_enum_data)
|
|
|
|
add_bin_test(ncdump tst_opaque_data)
|
|
|
|
add_bin_test(ncdump tst_string_data)
|
|
|
|
add_bin_test(ncdump tst_vlen_data)
|
|
|
|
add_bin_test(ncdump tst_comp)
|
|
|
|
add_bin_test(ncdump tst_comp2)
|
|
|
|
add_bin_test(ncdump tst_nans)
|
|
|
|
add_bin_test(ncdump tst_h_scalar)
|
2015-02-05 05:11:20 +08:00
|
|
|
add_bin_test(ncdump tst_bug324)
|
2014-04-03 04:26:42 +08:00
|
|
|
add_sh_test(ncdump tst_formatx4)
|
|
|
|
# Add this test by hand, as it is also called from a script.
|
|
|
|
# Editing the script would break autotools compatibility.
|
2015-04-21 03:54:17 +08:00
|
|
|
add_bin_test_no_prefix(tst_special_atts)
|
|
|
|
add_bin_test_no_prefix(tst_compress)
|
|
|
|
add_bin_test_no_prefix(tst_chunking)
|
2015-02-05 05:11:20 +08:00
|
|
|
|
2016-04-29 04:41:42 +08:00
|
|
|
|
|
|
|
###
|
|
|
|
# This test fails on Visual Studio builds with bash.
|
|
|
|
# It passes, but technically fails because the scientific
|
|
|
|
# formatting omits a 0.
|
|
|
|
###
|
|
|
|
IF(EXTRA_TESTS AND NOT MSVC)
|
|
|
|
add_sh_test(ncdump run_back_comp_tests)
|
|
|
|
ENDIF()
|
|
|
|
|
2015-04-21 06:06:20 +08:00
|
|
|
# Known failure on MSVC; the number of 0's padding
|
|
|
|
# is different, but the result is actually correct.
|
2015-04-23 05:47:19 +08:00
|
|
|
#IF(NOT MSVC)
|
2016-04-29 04:41:42 +08:00
|
|
|
add_sh_test(ncdump tst_netcdf4)
|
|
|
|
add_bin_test(ncdump tst_h_rdc0)
|
2015-04-23 05:47:19 +08:00
|
|
|
#ENDIF()
|
2015-04-21 03:18:24 +08:00
|
|
|
|
2014-04-03 04:26:42 +08:00
|
|
|
add_bin_test(ncdump tst_unicode)
|
2015-04-21 03:18:24 +08:00
|
|
|
|
2015-04-21 06:06:20 +08:00
|
|
|
add_bin_test(ncdump tst_fillbug)
|
|
|
|
add_sh_test(ncdump_sh tst_fillbug)
|
2015-04-21 03:18:24 +08:00
|
|
|
|
2015-02-05 05:11:20 +08:00
|
|
|
IF(NOT MSVC)
|
2014-04-03 04:26:42 +08:00
|
|
|
add_sh_test(ncdump tst_netcdf4_4)
|
2015-02-05 05:11:20 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2016-04-29 04:41:42 +08:00
|
|
|
|
|
|
|
|
2015-02-03 01:37:51 +08:00
|
|
|
IF(NOT MSVC)
|
2015-04-21 03:15:02 +08:00
|
|
|
add_sh_test(ncdump tst_nccopy4)
|
2014-04-03 04:26:42 +08:00
|
|
|
ENDIF()
|
2015-04-21 03:15:02 +08:00
|
|
|
|
2014-04-03 04:26:42 +08:00
|
|
|
add_sh_test(ncdump tst_grp_spec)
|
|
|
|
add_sh_test(ncdump tst_mud)
|
|
|
|
add_sh_test(ncdump_shell tst_h_scalar)
|
2015-02-05 05:11:20 +08:00
|
|
|
|
2014-04-03 04:26:42 +08:00
|
|
|
ENDIF()
|
2015-02-05 05:11:20 +08:00
|
|
|
|
2014-04-03 04:26:42 +08:00
|
|
|
add_sh_test(ncdump tst_ncgen4_classic)
|
|
|
|
IF(USE_NETCDF4)
|
|
|
|
add_sh_test(ncdump tst_ncgen4)
|
|
|
|
ENDIF()
|
2012-08-10 06:54:19 +08:00
|
|
|
|
2015-11-20 04:44:07 +08:00
|
|
|
add_sh_test(ncdump tst_inttags)
|
|
|
|
IF(USE_NETCDF4)
|
|
|
|
add_sh_test(ncdump tst_inttags4)
|
|
|
|
ENDIF()
|
|
|
|
|
2012-08-10 06:54:19 +08:00
|
|
|
|
2012-08-08 06:58:15 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2012-09-20 05:32:28 +08:00
|
|
|
IF(MSVC)
|
2015-02-05 05:11:20 +08:00
|
|
|
SET_TARGET_PROPERTIES(ncdump
|
2014-04-03 04:26:42 +08:00
|
|
|
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
|
|
|
)
|
|
|
|
SET_TARGET_PROPERTIES(nccopy
|
|
|
|
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
|
|
|
)
|
2012-09-20 05:32:28 +08:00
|
|
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
2013-08-23 01:15:12 +08:00
|
|
|
INSTALL(TARGETS ncdump RUNTIME DESTINATION bin COMPONENT utilities)
|
|
|
|
INSTALL(TARGETS nccopy RUNTIME DESTINATION bin COMPONENT utilities)
|
2012-10-18 05:14:30 +08:00
|
|
|
SET(MAN_FILES nccopy.1 ncdump.1)
|
2013-06-04 00:42:04 +08:00
|
|
|
|
|
|
|
|
2015-02-05 05:11:20 +08:00
|
|
|
FILE(GLOB COPY_FILES ${CMAKE_BINARY_DIR}/ncgen/*.nc ${CMAKE_BINARY_DIR}/nc_test4/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.ncml ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.1)
|
2013-06-04 00:42:04 +08:00
|
|
|
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
|
|
|
|
|
2014-09-20 02:43:39 +08:00
|
|
|
ADD_SUBDIRECTORY(cdl)
|
|
|
|
ADD_SUBDIRECTORY(expected)
|
2013-06-04 00:42:04 +08:00
|
|
|
|
2012-08-28 05:49:09 +08:00
|
|
|
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
|
|
|
|
|
2015-02-05 05:11:20 +08:00
|
|
|
IF(NOT MSVC)
|
2014-04-03 04:26:42 +08:00
|
|
|
INSTALL(FILES ${MAN_FILES} DESTINATION "share/man/man1" COMPONENT documentation)
|
2013-06-04 00:42:04 +08:00
|
|
|
ENDIF()
|