mirror of https://github.com/ecmwf/eccodes.git
ECC-1142: CMake: add option to build tools (ON by default)
This commit is contained in:
parent
d738937dd0
commit
9e1221c8f8
|
@ -82,6 +82,10 @@ ecbuild_add_option( FEATURE EXAMPLES
|
|||
DESCRIPTION "Build the examples"
|
||||
DEFAULT ON )
|
||||
|
||||
ecbuild_add_option( FEATURE BUILD_TOOLS
|
||||
DESCRIPTION "Build the command line tools"
|
||||
DEFAULT ON )
|
||||
|
||||
ecbuild_add_option( FEATURE JPG
|
||||
DESCRIPTION "Support for JPG decoding/encoding"
|
||||
DEFAULT ON )
|
||||
|
@ -399,7 +403,9 @@ include_directories( ${ECCODES_INCLUDE_DIRS} ${ECCODES_EXTRA_INCLUDE_DIRS} )
|
|||
add_subdirectory( definitions ) # must be before memfs
|
||||
add_subdirectory( memfs )
|
||||
add_subdirectory( src )
|
||||
add_subdirectory( tools )
|
||||
if( HAVE_BUILD_TOOLS )
|
||||
add_subdirectory( tools )
|
||||
endif()
|
||||
add_subdirectory( fortran )
|
||||
|
||||
if( PYTHON_VERSION_MAJOR GREATER 2 )
|
||||
|
|
|
@ -59,13 +59,13 @@ endforeach()
|
|||
|
||||
# Now add each test (shell scripts)
|
||||
########################################################################
|
||||
list(APPEND tests_sanity
|
||||
if( HAVE_BUILD_TOOLS )
|
||||
list(APPEND tests_sanity
|
||||
grib_set_data
|
||||
large_grib1
|
||||
grib_sections_copy
|
||||
get_product_kind_samples
|
||||
)
|
||||
list(APPEND tests_extra
|
||||
get_product_kind_samples)
|
||||
list(APPEND tests_extra
|
||||
grib_iterator
|
||||
grib_get_keys
|
||||
grib_print_data
|
||||
|
@ -97,8 +97,40 @@ list(APPEND tests_extra
|
|||
bufr_read_temp
|
||||
bufr_set_keys
|
||||
bufr_subset
|
||||
get_product_kind
|
||||
)
|
||||
get_product_kind)
|
||||
else()
|
||||
# No tools
|
||||
list(APPEND tests_sanity
|
||||
grib_set_data
|
||||
get_product_kind_samples)
|
||||
list(APPEND tests_extra
|
||||
grib_iterator
|
||||
grib_get_keys
|
||||
grib_print_data
|
||||
grib_set_keys
|
||||
grib_keys_iterator
|
||||
grib_precision
|
||||
grib_ensemble_index
|
||||
grib_set_pv
|
||||
grib_list
|
||||
grib_get_data
|
||||
grib_nearest_multiple
|
||||
grib_multi
|
||||
set_missing
|
||||
bufr_attributes
|
||||
bufr_expanded
|
||||
bufr_get_keys
|
||||
bufr_get_string_array
|
||||
bufr_keys_iterator
|
||||
bufr_missing
|
||||
bufr_read_header
|
||||
bufr_read_scatterometer
|
||||
bufr_read_synop
|
||||
bufr_read_temp
|
||||
bufr_set_keys
|
||||
bufr_subset
|
||||
get_product_kind)
|
||||
endif()
|
||||
|
||||
foreach( test ${tests_sanity} )
|
||||
ecbuild_add_test( TARGET eccodes_c_${test}
|
||||
|
|
|
@ -6,12 +6,13 @@ configure_file( include.ctest.sh.in include.ctest.sh @ONLY )
|
|||
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include.sh ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
|
||||
# Build the executables used by test scripts
|
||||
################################################
|
||||
list( APPEND tests_sanity
|
||||
#############################################
|
||||
if( HAVE_BUILD_TOOLS )
|
||||
list( APPEND tests_sanity
|
||||
grib_set_pv
|
||||
grib_set_data
|
||||
grib_ecc-671 )
|
||||
list( APPEND tests_extra
|
||||
list( APPEND tests_extra
|
||||
grib_index
|
||||
grib_copy_message
|
||||
bufr_copy_message
|
||||
|
@ -52,6 +53,44 @@ list( APPEND tests_extra
|
|||
bufr_copy_keys
|
||||
bufr_subset
|
||||
get_product_kind )
|
||||
else()
|
||||
# No tools
|
||||
list( APPEND tests_sanity
|
||||
grib_set_pv
|
||||
grib_set_data
|
||||
grib_ecc-671 )
|
||||
list( APPEND tests_extra
|
||||
grib_index
|
||||
grib_get_keys
|
||||
grib_get_data
|
||||
get_pl
|
||||
get_pv
|
||||
grib_keys_iterator
|
||||
grib_multi
|
||||
grib_nearest
|
||||
grib_precision
|
||||
grib_print_data
|
||||
grib_set_missing
|
||||
grib_samples
|
||||
grib_count_messages
|
||||
grib_count_messages_multi
|
||||
read_from_file
|
||||
grib_clone
|
||||
bufr_attributes
|
||||
bufr_clone
|
||||
bufr_expanded
|
||||
bufr_get_keys
|
||||
bufr_get_string_array
|
||||
bufr_keys_iterator
|
||||
bufr_read_header
|
||||
bufr_read_scatterometer
|
||||
bufr_read_synop
|
||||
bufr_read_temp
|
||||
bufr_read_tropical_cyclone
|
||||
bufr_set_keys
|
||||
bufr_subset
|
||||
get_product_kind )
|
||||
endif()
|
||||
|
||||
foreach( tool ${tests_sanity} )
|
||||
ecbuild_add_test( TARGET eccodes_f_${tool}
|
||||
|
|
|
@ -25,14 +25,15 @@ endforeach()
|
|||
|
||||
|
||||
# Now add each test
|
||||
#################################################
|
||||
list(APPEND tests_basic
|
||||
################################################
|
||||
if( HAVE_BUILD_TOOLS )
|
||||
list(APPEND tests_basic
|
||||
grib_set_pv
|
||||
grib_read_sample
|
||||
bufr_read_sample
|
||||
bufr_ecc-869
|
||||
)
|
||||
list(APPEND tests_extra
|
||||
)
|
||||
list(APPEND tests_extra
|
||||
grib_clone
|
||||
grib_count_messages
|
||||
grib_get_message_offset
|
||||
|
@ -64,7 +65,42 @@ list(APPEND tests_extra
|
|||
gts_get_keys
|
||||
metar_get_keys
|
||||
bufr_ecc-448
|
||||
)
|
||||
)
|
||||
else()
|
||||
# No tools
|
||||
list(APPEND tests_basic
|
||||
grib_read_sample
|
||||
bufr_read_sample
|
||||
)
|
||||
list(APPEND tests_extra
|
||||
grib_clone
|
||||
grib_count_messages
|
||||
grib_get_keys
|
||||
grib_index
|
||||
grib_iterator
|
||||
grib_keys_iterator
|
||||
grib_multi_write
|
||||
grib_nearest
|
||||
grib_print_data
|
||||
grib_samples
|
||||
bufr_attributes
|
||||
bufr_clone
|
||||
bufr_expanded
|
||||
bufr_get_keys
|
||||
bufr_keys_iterator
|
||||
bufr_read_header
|
||||
bufr_read_scatterometer
|
||||
bufr_read_tropical_cyclone
|
||||
bufr_read_synop
|
||||
bufr_read_temp
|
||||
bufr_set_keys
|
||||
bufr_subset
|
||||
get_product_kind
|
||||
gts_get_keys
|
||||
metar_get_keys
|
||||
bufr_ecc-448
|
||||
)
|
||||
endif()
|
||||
|
||||
# The high level python test requires new features in the unittest
|
||||
# which are only there for python 2.7 onwards
|
||||
|
@ -97,7 +133,7 @@ ecbuild_add_test( TARGET eccodes_p_bufr_encode_flight_test
|
|||
TYPE SCRIPT
|
||||
DEPENDS ${ptools}
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_encode_flight.sh
|
||||
CONDITION HAVE_PYTHON AND ENABLE_EXTRA_TESTS
|
||||
CONDITION HAVE_PYTHON AND ENABLE_EXTRA_TESTS AND HAVE_BUILD_TOOLS
|
||||
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
|
||||
RESOURCES flight_data.csv
|
||||
TEST_DEPENDS eccodes_download_bufrs )
|
||||
|
|
|
@ -47,8 +47,10 @@ endforeach()
|
|||
|
||||
# Now add each test (shell scripts)
|
||||
#################################################
|
||||
# These tests do not require any data downloads
|
||||
list(APPEND tests_no_data_reqd
|
||||
if( HAVE_BUILD_TOOLS )
|
||||
|
||||
# These tests do not require any data downloads
|
||||
list(APPEND tests_no_data_reqd
|
||||
unit_tests
|
||||
julian
|
||||
grib_dump_samples
|
||||
|
@ -77,8 +79,8 @@ list(APPEND tests_no_data_reqd
|
|||
grib_grid_space_view
|
||||
grib_g1fcperiod)
|
||||
|
||||
# These tests do require data downloads
|
||||
list(APPEND tests_data_reqd
|
||||
# These tests do require data downloads
|
||||
list(APPEND tests_data_reqd
|
||||
grib_data_quality_checks
|
||||
grib_bpv_limit
|
||||
grib_complex
|
||||
|
@ -193,35 +195,35 @@ list(APPEND tests_data_reqd
|
|||
codes_split_file
|
||||
grib_mars_types)
|
||||
|
||||
if( HAVE_FORTRAN AND ENABLE_EXTRA_TESTS )
|
||||
if( HAVE_FORTRAN AND ENABLE_EXTRA_TESTS )
|
||||
list(APPEND tests_data_reqd bufr_dump_encode_fortran)
|
||||
list(APPEND tests_data_reqd bufr_dump_decode_fortran)
|
||||
endif()
|
||||
if( ENABLE_EXTRA_TESTS )
|
||||
endif()
|
||||
if( ENABLE_EXTRA_TESTS )
|
||||
list(APPEND tests_data_reqd grib_util_set_spec)
|
||||
list(APPEND tests_data_reqd grib_padding)
|
||||
list(APPEND tests_data_reqd grib_tigge_conversions)
|
||||
list(APPEND tests_data_reqd bufr_dump_encode_C)
|
||||
list(APPEND tests_data_reqd bufr_dump_decode_C)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# These tests do not require any data downloads
|
||||
foreach( test ${tests_no_data_reqd} )
|
||||
# These tests do not require any data downloads
|
||||
foreach( test ${tests_no_data_reqd} )
|
||||
ecbuild_add_test( TARGET eccodes_t_${test}
|
||||
TYPE SCRIPT
|
||||
LABELS "sanity"
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh )
|
||||
endforeach()
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_check_gaussian_grids
|
||||
endforeach()
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_check_gaussian_grids
|
||||
TYPE SCRIPT
|
||||
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_gaussian_grids.sh )
|
||||
|
||||
|
||||
# Note: making the test dependent on the grib files (with DEPENDS)
|
||||
# means they will be downloaded at "make" time
|
||||
# rather than when you do "ctest". Use TEST_DEPENDS instead
|
||||
foreach( test ${tests_data_reqd} )
|
||||
# Note: making the test dependent on the grib files (with DEPENDS)
|
||||
# means they will be downloaded at "make" time
|
||||
# rather than when you do "ctest". Use TEST_DEPENDS instead
|
||||
foreach( test ${tests_data_reqd} )
|
||||
ecbuild_add_test( TARGET eccodes_t_${test}
|
||||
TYPE SCRIPT
|
||||
CONDITION ENABLE_EXTRA_TESTS
|
||||
|
@ -229,17 +231,17 @@ foreach( test ${tests_data_reqd} )
|
|||
RESOURCES asca_139.t1.ref
|
||||
TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs
|
||||
eccodes_download_bufrs eccodes_download_metars eccodes_download_gts )
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
if( HAVE_FORTRAN AND ENABLE_EXTRA_TESTS )
|
||||
if( HAVE_FORTRAN AND ENABLE_EXTRA_TESTS )
|
||||
set_tests_properties( eccodes_t_bufr_dump_encode_fortran PROPERTIES TIMEOUT 2500 )
|
||||
endif()
|
||||
if( ENABLE_EXTRA_TESTS )
|
||||
endif()
|
||||
if( ENABLE_EXTRA_TESTS )
|
||||
set_tests_properties( eccodes_t_bufr_dump_encode_C PROPERTIES TIMEOUT 2500 )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if( HAVE_PYTHON AND ENABLE_EXTRA_TESTS )
|
||||
if( HAVE_PYTHON AND ENABLE_EXTRA_TESTS )
|
||||
list( APPEND ptests bufr_dump_encode_python bufr_dump_decode_python )
|
||||
foreach( test ${ptests} )
|
||||
ecbuild_add_test( TARGET eccodes_t_${test}
|
||||
|
@ -248,32 +250,32 @@ if( HAVE_PYTHON AND ENABLE_EXTRA_TESTS )
|
|||
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} PYTHONPATH=${PROJECT_BINARY_DIR}/python
|
||||
TEST_DEPENDS eccodes_download_bufrs )
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###########################################
|
||||
# Note: the reference file is in the tests dir not data dir!
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_grid_lamb_az_eq_area
|
||||
###########################################
|
||||
# Note: the reference file is in the tests dir not data dir!
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_grid_lamb_az_eq_area
|
||||
TYPE SCRIPT
|
||||
CONDITION ENABLE_EXTRA_TESTS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_grid_lamb_az_eq_area.sh
|
||||
RESOURCES grib_lamb_az_eq_area.ref
|
||||
TEST_DEPENDS eccodes_download_gribs )
|
||||
|
||||
# These ones are conditional
|
||||
###########################################
|
||||
ecbuild_add_test( TARGET eccodes_t_tools_data_from_stdin
|
||||
# These ones are conditional
|
||||
###########################################
|
||||
ecbuild_add_test( TARGET eccodes_t_tools_data_from_stdin
|
||||
TYPE SCRIPT
|
||||
CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools_data_from_stdin.sh
|
||||
TEST_DEPENDS eccodes_download_bufrs )
|
||||
|
||||
ecbuild_add_test( TARGET eccodes_t_bufr_ecc-197
|
||||
ecbuild_add_test( TARGET eccodes_t_bufr_ecc-197
|
||||
TYPE SCRIPT
|
||||
CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_ecc-197.sh
|
||||
TEST_DEPENDS eccodes_download_bufrs )
|
||||
|
||||
if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS )
|
||||
if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS )
|
||||
ecbuild_add_executable( TARGET grib_encode_pthreads
|
||||
NOINSTALL
|
||||
SOURCES grib_encode_pthreads.c
|
||||
|
@ -296,46 +298,65 @@ if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS )
|
|||
TYPE SCRIPT
|
||||
TEST_DEPENDS eccodes_download_bufrs
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_threads_ecc-604.sh )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_to_netcdf
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_to_netcdf
|
||||
TYPE SCRIPT
|
||||
CONDITION HAVE_NETCDF AND ENABLE_EXTRA_TESTS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_to_netcdf.sh
|
||||
TEST_DEPENDS eccodes_download_gribs )
|
||||
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_jpeg
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_jpeg
|
||||
TYPE SCRIPT
|
||||
CONDITION HAVE_JPEG AND ENABLE_EXTRA_TESTS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_jpeg.sh
|
||||
TEST_DEPENDS eccodes_download_gribs )
|
||||
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_png
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_png
|
||||
TYPE SCRIPT
|
||||
CONDITION HAVE_PNG AND ENABLE_EXTRA_TESTS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_png.sh
|
||||
TEST_DEPENDS eccodes_download_gribs )
|
||||
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_ccsds
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_ccsds
|
||||
TYPE SCRIPT
|
||||
CONDITION HAVE_AEC AND ENABLE_EXTRA_TESTS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ccsds.sh
|
||||
TEST_DEPENDS eccodes_download_gribs )
|
||||
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_check_param_concepts
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_check_param_concepts
|
||||
TYPE SCRIPT
|
||||
CONDITION ENABLE_EXTRA_TESTS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_param_concepts.sh )
|
||||
|
||||
ecbuild_add_test( TARGET eccodes_t_bufr_split_by_rdbSubtype
|
||||
ecbuild_add_test( TARGET eccodes_t_bufr_split_by_rdbSubtype
|
||||
TYPE SCRIPT
|
||||
CONDITION ENABLE_EXTRA_TESTS AND ECCODES_INSTALL_EXTRA_TOOLS
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_split_by_rdbSubtype.sh
|
||||
TEST_DEPENDS eccodes_download_bufrs )
|
||||
|
||||
# Performance test. Must have -DENABLE_GRIB_TIMER=ON
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_ecc-386
|
||||
# Performance test. Must have -DENABLE_GRIB_TIMER=ON
|
||||
ecbuild_add_test( TARGET eccodes_t_grib_ecc-386
|
||||
TYPE SCRIPT
|
||||
CONDITION ENABLE_EXTRA_TESTS AND ENABLE_GRIB_TIMER
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ecc-386.sh
|
||||
TEST_DEPENDS eccodes_download_gribs )
|
||||
else()
|
||||
# No tools
|
||||
list(APPEND tests_no_tools
|
||||
unit_tests
|
||||
julian
|
||||
bufr_check_descriptors
|
||||
grib_sh_imag
|
||||
grib_2nd_order_numValues
|
||||
grib_sh_ieee64
|
||||
)
|
||||
|
||||
foreach( test ${tests_no_tools} )
|
||||
ecbuild_add_test( TARGET eccodes_t_${test}
|
||||
TYPE SCRIPT
|
||||
LABELS "sanity"
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh )
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
|
|
|
@ -1,31 +1,33 @@
|
|||
# tigge
|
||||
if( HAVE_BUILD_TOOLS )
|
||||
|
||||
# library
|
||||
ecbuild_add_library(TARGET tigge_tools
|
||||
# library
|
||||
ecbuild_add_library(TARGET tigge_tools
|
||||
TYPE STATIC
|
||||
NOINSTALL
|
||||
SOURCES tigge_tools.c tigge_tools.h)
|
||||
|
||||
# executables
|
||||
ecbuild_add_executable(TARGET tigge_check
|
||||
# executables
|
||||
ecbuild_add_executable(TARGET tigge_check
|
||||
SOURCES tigge_check.c
|
||||
INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS}
|
||||
LIBS eccodes tigge_tools)
|
||||
|
||||
ecbuild_add_executable(TARGET tigge_name
|
||||
ecbuild_add_executable(TARGET tigge_name
|
||||
SOURCES tigge_name.c
|
||||
INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS}
|
||||
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
|
||||
LIBS eccodes tigge_tools)
|
||||
|
||||
ecbuild_add_executable(TARGET tigge_accumulations
|
||||
ecbuild_add_executable(TARGET tigge_accumulations
|
||||
SOURCES tigge_accumulations.c
|
||||
INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS}
|
||||
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
|
||||
LIBS eccodes tigge_tools)
|
||||
|
||||
ecbuild_add_executable(TARGET tigge_split
|
||||
ecbuild_add_executable(TARGET tigge_split
|
||||
SOURCES tigge_split.c
|
||||
INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS}
|
||||
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
|
||||
LIBS eccodes tigge_tools)
|
||||
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue