eccodes/examples/C/CMakeLists.txt

139 lines
3.7 KiB
CMake
Raw Normal View History

2014-03-31 12:57:06 +00:00
# examples/C/CMakeLists.txt
# Configure the file which all CMake tests will include
configure_file( include.ctest.sh.in include.ctest.sh @ONLY )
2015-07-02 12:02:54 +00:00
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include.sh ${CMAKE_CURRENT_BINARY_DIR} )
2014-03-31 12:57:06 +00:00
# Build the executables used by test scripts
2016-05-24 13:27:46 +00:00
########################################################################
2014-03-31 12:57:06 +00:00
list( APPEND test_bins
grib_nearest
grib_set_bitmap
grib_iterator
grib_get_keys
grib_print_data
grib_set_keys
2015-03-18 13:48:30 +00:00
grib_index
2014-03-31 12:57:06 +00:00
set_missing
grib_keys_iterator
grib_set_data
2014-03-31 12:57:06 +00:00
mars_param
values_check
box
grib_multi
2014-03-31 12:57:06 +00:00
multi2
grib_multi_write
grib_precision
grib_set_pv
2015-03-18 14:35:13 +00:00
grib_list
grib_get_data
2014-03-31 12:57:06 +00:00
sections_copy
grib_iterator_bitmap
2014-03-31 12:57:06 +00:00
large_grib1
grib_clone
grib_copy_message
grib_ensemble_index
get_product_kind
bufr_copy_data
bufr_attributes
2015-02-04 15:58:52 +00:00
bufr_clone
bufr_expanded
2015-02-06 11:44:01 +00:00
bufr_get_keys
2015-02-06 16:38:23 +00:00
bufr_keys_iterator
bufr_missing
bufr_read_header
bufr_read_scatterometer
bufr_read_synop
bufr_read_temp
2015-02-06 14:23:28 +00:00
bufr_set_keys
bufr_subset
2014-03-31 12:57:06 +00:00
)
foreach( tool ${test_bins} )
2015-03-18 14:35:13 +00:00
ecbuild_add_executable( TARGET c_${tool}
2014-03-31 12:57:06 +00:00
NOINSTALL
SOURCES ${tool}.c
2015-02-13 18:04:42 +00:00
LIBS eccodes
2014-03-31 12:57:06 +00:00
)
endforeach()
2015-01-24 19:00:15 +00:00
# Now add each test (shell scripts)
2016-05-24 13:27:46 +00:00
########################################################################
2014-03-31 16:15:20 +00:00
list( APPEND tests
grib_iterator
grib_get_keys
grib_print_data
grib_set_keys
grib_keys_iterator
grib_multi
grib_multi_write
grib_precision
2015-03-18 14:35:13 +00:00
grib_clone
grib_copy_message
grib_ensemble_index
2015-03-18 14:35:13 +00:00
grib_set_pv
2016-01-05 14:32:24 +00:00
grib_set_bitmap
2015-03-18 14:35:13 +00:00
grib_list
grib_get_data
2014-03-31 16:15:20 +00:00
large_grib1
set_missing
sections_copy
bufr_attributes
bufr_copy_data
2015-02-04 15:58:52 +00:00
bufr_clone
bufr_expanded
2015-02-06 11:44:01 +00:00
bufr_get_keys
2015-02-06 16:38:23 +00:00
bufr_keys_iterator
bufr_missing
bufr_read_header
bufr_read_scatterometer
bufr_read_synop
bufr_read_temp
2015-02-06 14:23:28 +00:00
bufr_set_keys
bufr_subset
get_product_kind
2014-03-31 12:57:06 +00:00
)
2014-07-28 09:27:13 +00:00
foreach( test ${tests} )
2015-07-14 16:11:57 +00:00
ecbuild_add_test( TARGET eccodes_c_${test}
2016-05-24 13:27:46 +00:00
TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs
2014-03-31 16:15:20 +00:00
)
endforeach()
2014-03-31 12:57:06 +00:00
2016-05-24 13:27:46 +00:00
########################################################################
# Tests which are conditional
if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS )
# This one only for POSIX threads
ecbuild_add_executable( TARGET c_grib_pthreads
NOINSTALL
SOURCES grib_pthreads.c
LIBS eccodes
)
ecbuild_add_test( TARGET eccodes_c_grib_pthreads
TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_pthreads.sh
)
2016-11-18 18:09:15 +00:00
# TODO
# ecbuild_add_executable( TARGET c_bufr_pthreads
# NOINSTALL
# SOURCES bufr_pthreads.c
# LIBS eccodes
# )
# ecbuild_add_test( TARGET eccodes_c_bufr_pthreads
# TYPE SCRIPT
# COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_pthreads.sh
# )
2016-05-24 13:27:46 +00:00
endif()
2014-03-31 12:57:06 +00:00
2016-05-24 13:27:46 +00:00
########################################################################
2014-03-31 12:57:06 +00:00
# Tests with no script
2016-05-24 13:27:46 +00:00
ecbuild_add_test(
TARGET eccodes_c_new_sample
SOURCES new_sample.c
LIBS eccodes
ARGS "out.grib"
ENVIRONMENT "ECCODES_SAMPLES_PATH=${PROJECT_SOURCE_DIR}/samples" "ECCODES_DEFINITION_PATH=${PROJECT_SOURCE_DIR}/definitions"
2014-03-31 16:15:20 +00:00
)