CMake style

This commit is contained in:
Shahram Najm 2020-03-30 14:07:31 +01:00
parent 4f5511599e
commit 0a874742a4
16 changed files with 91 additions and 139 deletions

View File

@ -55,7 +55,8 @@ check_c_source_compiles(
static inline foo_t static_foo(){return 0;} static inline foo_t static_foo(){return 0;}
foo_t foo(){return 0;} foo_t foo(){return 0;}
int main(int argc, char *argv[]){return 0;} int main(int argc, char *argv[]){return 0;}
" ECCODES_HAVE_C_INLINE ) " ECCODES_HAVE_C_INLINE
)
include(eccodes_test_endiness) include(eccodes_test_endiness)
if( EC_OS_NAME MATCHES "windows" ) if( EC_OS_NAME MATCHES "windows" )

View File

@ -1,4 +1,6 @@
file( GLOB_RECURSE bamboo_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" ) file( GLOB_RECURSE bamboo_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" )
ecbuild_add_resources( TARGET ${PROJECT_NAME}_bamboo ecbuild_add_resources(
SOURCES_DONT_PACK ${bamboo_files} ) TARGET ${PROJECT_NAME}_bamboo
SOURCES_DONT_PACK ${bamboo_files}
)

View File

@ -2,17 +2,17 @@
# Download all the BUFR data and reference files from website # Download all the BUFR data and reference files from website
# #
FILE(READ "bufr_data_files.txt" bufr_files_to_download) file(READ "bufr_data_files.txt" bufr_files_to_download)
# Convert file contents into a CMake list (where each element in the list # Convert file contents into a CMake list (where each element in the list
# is one line of the file) # is one line of the file)
STRING(REGEX REPLACE "\n" ";" bufr_files_to_download "${bufr_files_to_download}") string(REGEX REPLACE "\n" ";" bufr_files_to_download "${bufr_files_to_download}")
FILE(READ "bufr_ref_files.txt" bufr_refs_to_download) file(READ "bufr_ref_files.txt" bufr_refs_to_download)
STRING(REGEX REPLACE "\n" ";" bufr_refs_to_download "${bufr_refs_to_download}") string(REGEX REPLACE "\n" ";" bufr_refs_to_download "${bufr_refs_to_download}")
# Exceptional case: download bufr files which have to be treated specially # Exceptional case: download bufr files which have to be treated specially
LIST(APPEND bufr_refs_to_download "vos308014_v3_26.bufr") # See test ecc-197 list(APPEND bufr_refs_to_download "vos308014_v3_26.bufr") # See test ecc-197
if( ENABLE_EXTRA_TESTS ) if( ENABLE_EXTRA_TESTS )
ecbuild_get_test_multidata( ecbuild_get_test_multidata(
@ -23,7 +23,7 @@ if( ENABLE_EXTRA_TESTS )
endif() endif()
# Copy other files - e.g. text files etc from the source data/bufr dir # Copy other files - e.g. text files etc from the source data/bufr dir
LIST(APPEND other_files list(APPEND other_files
bufr_data_files.txt bufr_data_files.txt
bufr_ref_files.txt bufr_ref_files.txt
) )

View File

@ -1,12 +1,11 @@
# data/gts/CMakeLists.txt # data/gts/CMakeLists.txt
# Download all the GTS data and reference files from website # Download all the GTS data and reference files from website
# #
file(READ "gts_data_files.txt" gts_files_to_download)
string(REGEX REPLACE "\n" ";" gts_files_to_download "${gts_files_to_download}")
FILE(READ "gts_data_files.txt" gts_files_to_download) file(READ "gts_ref_files.txt" gts_refs_to_download)
STRING(REGEX REPLACE "\n" ";" gts_files_to_download "${gts_files_to_download}") string(REGEX REPLACE "\n" ";" gts_refs_to_download "${gts_refs_to_download}")
FILE(READ "gts_ref_files.txt" gts_refs_to_download)
STRING(REGEX REPLACE "\n" ";" gts_refs_to_download "${gts_refs_to_download}")
if( ENABLE_EXTRA_TESTS ) if( ENABLE_EXTRA_TESTS )
ecbuild_get_test_multidata( ecbuild_get_test_multidata(
@ -17,7 +16,7 @@ if( ENABLE_EXTRA_TESTS )
endif() endif()
# Copy other files - e.g. text files etc from the source data/gts dir # Copy other files - e.g. text files etc from the source data/gts dir
LIST(APPEND other_files list(APPEND other_files
gts_data_files.txt gts_data_files.txt
gts_ref_files.txt gts_ref_files.txt
) )

View File

@ -2,15 +2,13 @@
# Download all the METAR data and reference files from website # Download all the METAR data and reference files from website
# #
FILE(READ "metar_data_files.txt" metar_files_to_download) file(READ "metar_data_files.txt" metar_files_to_download)
# Convert file contents into a CMake list (where each element in the list # Convert file contents into a CMake list (where each element in the list
# is one line of the file) # is one line of the file)
STRING(REGEX REPLACE "\n" ";" metar_files_to_download "${metar_files_to_download}") string(REGEX REPLACE "\n" ";" metar_files_to_download "${metar_files_to_download}")
FILE(READ "metar_ref_files.txt" metar_refs_to_download)
STRING(REGEX REPLACE "\n" ";" metar_refs_to_download "${metar_refs_to_download}")
file(READ "metar_ref_files.txt" metar_refs_to_download)
string(REGEX REPLACE "\n" ";" metar_refs_to_download "${metar_refs_to_download}")
if( ENABLE_EXTRA_TESTS ) if( ENABLE_EXTRA_TESTS )
ecbuild_get_test_multidata( ecbuild_get_test_multidata(
@ -21,7 +19,7 @@ if( ENABLE_EXTRA_TESTS )
endif() endif()
# Copy other files - e.g. text files etc from the source data/metar dir # Copy other files - e.g. text files etc from the source data/metar dir
LIST(APPEND other_files list(APPEND other_files
metar_data_files.txt metar_data_files.txt
metar_ref_files.txt metar_ref_files.txt
) )

View File

@ -13,9 +13,8 @@ endif()
####### #######
# Copy other files - e.g. reference data, text files etc from the source data dir # Copy other files - e.g. reference data, text files etc from the source data dir
LIST(APPEND other_files list(APPEND other_files
tigge_data_files.txt tigge_data_files.txt)
)
foreach( file ${other_files} ) foreach( file ${other_files} )
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR} ) execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR} )
endforeach() endforeach()

View File

@ -49,26 +49,24 @@ list( APPEND test_bins
bufr_read_synop bufr_read_synop
bufr_read_temp bufr_read_temp
bufr_set_keys bufr_set_keys
bufr_subset bufr_subset )
)
foreach( tool ${test_bins} ) foreach( tool ${test_bins} )
ecbuild_add_executable( TARGET c_${tool} ecbuild_add_executable( TARGET c_${tool}
NOINSTALL NOINSTALL
SOURCES ${tool}.c SOURCES ${tool}.c
LIBS eccodes LIBS eccodes )
)
endforeach() endforeach()
# Now add each test (shell scripts) # Now add each test (shell scripts)
######################################################################## ########################################################################
list( APPEND tests_basic list(APPEND tests_basic
grib_multi grib_multi
grib_set_data grib_set_data
large_grib1 large_grib1
grib_sections_copy grib_sections_copy
get_product_kind_samples get_product_kind_samples
) )
list( APPEND tests_extra list(APPEND tests_extra
grib_iterator grib_iterator
grib_get_keys grib_get_keys
grib_print_data grib_print_data
@ -105,34 +103,30 @@ list( APPEND tests_extra
foreach( test ${tests_basic} ) foreach( test ${tests_basic} )
ecbuild_add_test( TARGET eccodes_c_${test} ecbuild_add_test( TARGET eccodes_c_${test}
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh )
)
endforeach() endforeach()
foreach( test ${tests_extra} ) foreach( test ${tests_extra} )
ecbuild_add_test( TARGET eccodes_c_${test} ecbuild_add_test( TARGET eccodes_c_${test}
TYPE SCRIPT TYPE SCRIPT
CONDITION ENABLE_EXTRA_TESTS CONDITION ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs )
)
endforeach() endforeach()
######################################################################## ########################################################################
# Tests which are conditional # Tests which are conditional
if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS ) if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS )
# For POSIX threads # For POSIX threads
LIST(APPEND pthread_tests grib_pthreads bufr_pthreads) list(APPEND pthread_tests grib_pthreads bufr_pthreads)
foreach( test ${pthread_tests} ) foreach( test ${pthread_tests} )
ecbuild_add_executable( TARGET c_${test} ecbuild_add_executable( TARGET c_${test}
NOINSTALL NOINSTALL
SOURCES ${test}.c SOURCES ${test}.c
LIBS eccodes LIBS eccodes )
)
ecbuild_add_test( TARGET eccodes_c_${test} ecbuild_add_test( TARGET eccodes_c_${test}
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs )
)
endforeach() endforeach()
endif() endif()

View File

@ -10,8 +10,7 @@ execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_S
list( APPEND tests_basic list( APPEND tests_basic
grib_set_pv grib_set_pv
grib_set_data grib_set_data
grib_ecc-671 grib_ecc-671 )
)
list( APPEND tests_extra list( APPEND tests_extra
grib_index grib_index
grib_copy_message grib_copy_message
@ -52,8 +51,7 @@ list( APPEND tests_extra
bufr_set_keys bufr_set_keys
bufr_copy_keys bufr_copy_keys
bufr_subset bufr_subset
get_product_kind get_product_kind )
)
foreach( tool ${tests_basic} ) foreach( tool ${tests_basic} )
ecbuild_add_test( TARGET eccodes_f_${tool} ecbuild_add_test( TARGET eccodes_f_${tool}
@ -62,8 +60,7 @@ foreach( tool ${tests_basic} )
LIBS eccodes_f90 eccodes LIBS eccodes_f90 eccodes
CONDITION HAVE_FORTRAN CONDITION HAVE_FORTRAN
RESOURCES bufr_read_scatterometer_f.ref RESOURCES bufr_read_scatterometer_f.ref
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh )
)
endforeach() endforeach()
foreach( tool ${tests_extra} ) foreach( tool ${tests_extra} )
ecbuild_add_test( TARGET eccodes_f_${tool} ecbuild_add_test( TARGET eccodes_f_${tool}
@ -73,8 +70,7 @@ foreach( tool ${tests_extra} )
CONDITION HAVE_FORTRAN AND ENABLE_EXTRA_TESTS CONDITION HAVE_FORTRAN AND ENABLE_EXTRA_TESTS
RESOURCES bufr_read_scatterometer_f.ref RESOURCES bufr_read_scatterometer_f.ref
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh
TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs TEST_DEPENDS eccodes_download_gribs eccodes_download_bufrs )
)
endforeach() endforeach()
# Executables without a shell script # Executables without a shell script
@ -84,22 +80,19 @@ ecbuild_add_executable( TARGET eccodes_f_new_from_file
SOURCES new_from_file.f90 SOURCES new_from_file.f90
CONDITION HAVE_FORTRAN CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes LIBS eccodes_f90 eccodes )
)
ecbuild_add_executable( TARGET eccodes_f_grib_set_gvc ecbuild_add_executable( TARGET eccodes_f_grib_set_gvc
NOINSTALL NOINSTALL
SOURCES grib_set_gvc.f90 SOURCES grib_set_gvc.f90
CONDITION HAVE_FORTRAN CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes LIBS eccodes_f90 eccodes )
)
ecbuild_add_executable( TARGET eccodes_f_grib_print_data_static ecbuild_add_executable( TARGET eccodes_f_grib_print_data_static
NOINSTALL NOINSTALL
SOURCES grib_print_data_static.f90 SOURCES grib_print_data_static.f90
CONDITION HAVE_FORTRAN CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes LIBS eccodes_f90 eccodes )
)
# # Note extra dependency # # Note extra dependency

View File

@ -7,7 +7,7 @@ execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_S
# Build the executables used by test scripts # Build the executables used by test scripts
################################################ ################################################
list( APPEND test_bins list(APPEND test_bins
grib_keys_iterator grib_keys_iterator
grib_print_data grib_print_data
grib_iterator grib_iterator
@ -19,21 +19,20 @@ foreach( tool ${test_bins} )
NOINSTALL NOINSTALL
SOURCES ${tool}.c SOURCES ${tool}.c
CONDITION HAVE_PYTHON CONDITION HAVE_PYTHON
LIBS eccodes LIBS eccodes )
)
list( APPEND ptools p_${tool} ) list( APPEND ptools p_${tool} )
endforeach() endforeach()
# Now add each test # Now add each test
################################################# #################################################
list( APPEND tests_basic list(APPEND tests_basic
grib_set_pv grib_set_pv
grib_read_sample grib_read_sample
bufr_read_sample bufr_read_sample
bufr_ecc-869 bufr_ecc-869
) )
list( APPEND tests_extra list(APPEND tests_extra
grib_clone grib_clone
grib_count_messages grib_count_messages
grib_get_message_offset grib_get_message_offset
@ -81,8 +80,7 @@ foreach( test ${tests_basic} )
DEPENDS ${ptools} DEPENDS ${ptools}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
CONDITION HAVE_PYTHON CONDITION HAVE_PYTHON
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} )
)
endforeach() endforeach()
foreach( test ${tests_extra} ) foreach( test ${tests_extra} )
ecbuild_add_test( TARGET eccodes_p_${test}_test ecbuild_add_test( TARGET eccodes_p_${test}_test
@ -91,8 +89,7 @@ foreach( test ${tests_extra} )
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
CONDITION HAVE_PYTHON AND ENABLE_EXTRA_TESTS CONDITION HAVE_PYTHON AND ENABLE_EXTRA_TESTS
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs eccodes_download_bufrs TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs eccodes_download_bufrs )
)
endforeach() endforeach()
# Add test which requires input CSV file # Add test which requires input CSV file
@ -103,8 +100,7 @@ ecbuild_add_test( TARGET eccodes_p_bufr_encode_flight_test
CONDITION HAVE_PYTHON AND ENABLE_EXTRA_TESTS CONDITION HAVE_PYTHON AND ENABLE_EXTRA_TESTS
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
RESOURCES flight_data.csv RESOURCES flight_data.csv
TEST_DEPENDS eccodes_download_bufrs TEST_DEPENDS eccodes_download_bufrs )
)
# Conditional tests # Conditional tests
ecbuild_add_test( TARGET eccodes_p_grib_ccsds_test ecbuild_add_test( TARGET eccodes_p_grib_ccsds_test
@ -113,5 +109,4 @@ ecbuild_add_test( TARGET eccodes_p_grib_ccsds_test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ccsds.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ccsds.sh
CONDITION HAVE_PYTHON AND HAVE_AEC AND ENABLE_EXTRA_TESTS CONDITION HAVE_PYTHON AND HAVE_AEC AND ENABLE_EXTRA_TESTS
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
TEST_DEPENDS eccodes_download_gribs TEST_DEPENDS eccodes_download_gribs )
)

View File

@ -7,7 +7,6 @@ list( APPEND ifs_samples_${_basedir}
${CMAKE_CURRENT_SOURCE_DIR}/gg_sfc.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/gg_sfc.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/sh_ml.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/sh_ml.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/sh_sfc.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/sh_sfc.tmpl
${ECCODES_SAMPLES_FILES} ${ECCODES_SAMPLES_FILES} )
)
install_samples( ifs_samples_${_basedir} ${_destination_install} ${_destination_build} ) install_samples( ifs_samples_${_basedir} ${_destination_install} ${_destination_build} )

View File

@ -7,7 +7,6 @@ list( APPEND ifs_samples_${_basedir}
${CMAKE_CURRENT_SOURCE_DIR}/gg_sfc.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/gg_sfc.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/sh_ml.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/sh_ml.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/sh_sfc.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/sh_sfc.tmpl
${ECCODES_SAMPLES_FILES} ${ECCODES_SAMPLES_FILES} )
)
install_samples( ifs_samples_${_basedir} ${_destination_install} ${_destination_build} ) install_samples( ifs_samples_${_basedir} ${_destination_install} ${_destination_build} )

View File

@ -7,7 +7,6 @@ list( APPEND ifs_samples_${_basedir}
${CMAKE_CURRENT_SOURCE_DIR}/gg_sfc.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/gg_sfc.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/sh_ml.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/sh_ml.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/sh_sfc.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/sh_sfc.tmpl
${ECCODES_SAMPLES_FILES} ${ECCODES_SAMPLES_FILES} )
)
install_samples( ifs_samples_${_basedir} ${_destination_install} ${_destination_build} ) install_samples( ifs_samples_${_basedir} ${_destination_install} ${_destination_build} )

View File

@ -7,7 +7,6 @@ list( APPEND ifs_samples_${_basedir}
${CMAKE_CURRENT_SOURCE_DIR}/gg_sfc.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/gg_sfc.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/sh_ml.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/sh_ml.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/sh_sfc.tmpl ${CMAKE_CURRENT_SOURCE_DIR}/sh_sfc.tmpl
${ECCODES_SAMPLES_FILES} ${ECCODES_SAMPLES_FILES} )
)
install_samples( ifs_samples_${_basedir} ${_destination_install} ${_destination_build} ) install_samples( ifs_samples_${_basedir} ${_destination_install} ${_destination_build} )

View File

@ -7,19 +7,19 @@ if( HAVE_PYTHON )
# preparing for generating setup.py # preparing for generating setup.py
if( HAVE_LIBJASPER ) if( HAVE_LIBJASPER )
get_filename_component(JASPER_DIR ${JASPER_INCLUDE_DIR} PATH ) get_filename_component( JASPER_DIR ${JASPER_INCLUDE_DIR} PATH )
endif() endif()
if( HAVE_LIBOPENJPEG ) if( HAVE_LIBOPENJPEG )
# Get the name of the OpenJPEG library: version dependent! # Get the name of the OpenJPEG library: version dependent!
# E.g. openjpeg (version 1.5) or openjp2 (version 2.x) # E.g. openjpeg (version 1.5) or openjp2 (version 2.x)
get_filename_component(OPENJPEG_LIB_DIR ${OPENJPEG_LIBRARY} PATH ) get_filename_component( OPENJPEG_LIB_DIR ${OPENJPEG_LIBRARY} PATH )
get_filename_component(OJ_NAME_WE ${OPENJPEG_LIBRARY} NAME_WE ) get_filename_component( OJ_NAME_WE ${OPENJPEG_LIBRARY} NAME_WE )
STRING(REGEX REPLACE "^lib" "" OJ_WITHOUT_LIB ${OJ_NAME_WE}) string(REGEX REPLACE "^lib" "" OJ_WITHOUT_LIB ${OJ_NAME_WE})
endif() endif()
if( HAVE_AEC ) if( HAVE_AEC )
get_filename_component(AEC_DIR ${AEC_INCLUDE_DIR} PATH ) get_filename_component( AEC_DIR ${AEC_INCLUDE_DIR} PATH )
endif() endif()
configure_file( setup.py.in setup.py ) configure_file( setup.py.in setup.py )

View File

@ -34,22 +34,20 @@ list( APPEND test_bins
ieee ieee
grib_sh_imag grib_sh_imag
grib_lam_bf grib_lam_bf
grib_lam_gp grib_lam_gp )
)
foreach( tool ${test_bins} ) foreach( tool ${test_bins} )
# here we use the fact that each tool has only one C file that matches its name # here we use the fact that each tool has only one C file that matches its name
ecbuild_add_executable( TARGET ${tool} ecbuild_add_executable( TARGET ${tool}
NOINSTALL NOINSTALL
SOURCES ${tool}.c SOURCES ${tool}.c
LIBS eccodes LIBS eccodes )
)
endforeach() endforeach()
# Now add each test (shell scripts) # Now add each test (shell scripts)
################################################# #################################################
# These tests do not require any data downloads # These tests do not require any data downloads
list( APPEND tests_no_data_reqd list(APPEND tests_no_data_reqd
definitions definitions
grib_calendar grib_calendar
unit_tests unit_tests
@ -69,10 +67,10 @@ list( APPEND tests_no_data_reqd
grib_sh_imag grib_sh_imag
diag diag
grib_lambert_conformal grib_lambert_conformal
grib_g1fcperiod grib_g1fcperiod)
)
# These tests do require data downloads # These tests do require data downloads
list( APPEND tests_data_reqd list(APPEND tests_data_reqd
grib_data_quality_checks grib_data_quality_checks
bpv_limit bpv_limit
grib_complex grib_complex
@ -183,8 +181,8 @@ list( APPEND tests_data_reqd
grib_local_MeteoFrance grib_local_MeteoFrance
grib_neg_fctime grib_neg_fctime
codes_split_file codes_split_file
grib_mars_types 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_encode_fortran)
list(APPEND tests_data_reqd bufr_dump_decode_fortran) list(APPEND tests_data_reqd bufr_dump_decode_fortran)
@ -201,14 +199,12 @@ endif()
foreach( test ${tests_no_data_reqd} ) foreach( test ${tests_no_data_reqd} )
ecbuild_add_test( TARGET eccodes_t_${test} ecbuild_add_test( TARGET eccodes_t_${test}
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh )
)
endforeach() endforeach()
ecbuild_add_test( TARGET eccodes_t_grib_check_gaussian_grids ecbuild_add_test( TARGET eccodes_t_grib_check_gaussian_grids
TYPE SCRIPT TYPE SCRIPT
CONDITION ECCODES_INSTALL_EXTRA_TOOLS CONDITION ECCODES_INSTALL_EXTRA_TOOLS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_gaussian_grids.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_gaussian_grids.sh )
)
# Note: making the test dependent on the grib files (with DEPENDS) # Note: making the test dependent on the grib files (with DEPENDS)
@ -221,15 +217,14 @@ foreach( test ${tests_data_reqd} )
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
RESOURCES asca_139.t1.ref RESOURCES asca_139.t1.ref
TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs
eccodes_download_bufrs eccodes_download_metars eccodes_download_gts 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) set_tests_properties( eccodes_t_bufr_dump_encode_fortran PROPERTIES TIMEOUT 2500 )
endif() endif()
if( ENABLE_EXTRA_TESTS ) if( ENABLE_EXTRA_TESTS )
set_tests_properties ( eccodes_t_bufr_dump_encode_C PROPERTIES TIMEOUT 2500) set_tests_properties( eccodes_t_bufr_dump_encode_C PROPERTIES TIMEOUT 2500 )
endif() endif()
@ -240,8 +235,7 @@ if( HAVE_PYTHON AND ENABLE_EXTRA_TESTS )
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} PYTHONPATH=${PROJECT_BINARY_DIR}/${ECCODES_PYTHON_DIR} ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} PYTHONPATH=${PROJECT_BINARY_DIR}/${ECCODES_PYTHON_DIR}
TEST_DEPENDS eccodes_download_bufrs TEST_DEPENDS eccodes_download_bufrs )
)
endforeach() endforeach()
endif() endif()
@ -252,8 +246,7 @@ ecbuild_add_test( TARGET eccodes_t_grib_lamb_az_eq_area
CONDITION ENABLE_EXTRA_TESTS CONDITION ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_lamb_az_eq_area.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_lamb_az_eq_area.sh
RESOURCES grib_lamb_az_eq_area.ref RESOURCES grib_lamb_az_eq_area.ref
TEST_DEPENDS eccodes_download_gribs TEST_DEPENDS eccodes_download_gribs )
)
# These ones are conditional # These ones are conditional
########################################### ###########################################
@ -261,91 +254,77 @@ ecbuild_add_test( TARGET eccodes_t_tools_data_from_stdin
TYPE SCRIPT TYPE SCRIPT
CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools_data_from_stdin.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools_data_from_stdin.sh
TEST_DEPENDS eccodes_download_bufrs 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 TYPE SCRIPT
CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS CONDITION NOT ECCODES_ON_WINDOWS AND ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_ecc-197.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_ecc-197.sh
TEST_DEPENDS eccodes_download_bufrs 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 ecbuild_add_executable( TARGET grib_encode_pthreads
NOINSTALL NOINSTALL
SOURCES grib_encode_pthreads.c SOURCES grib_encode_pthreads.c
LIBS eccodes LIBS eccodes )
)
ecbuild_add_test( TARGET eccodes_t_grib_encode_pthreads ecbuild_add_test( TARGET eccodes_t_grib_encode_pthreads
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_encode_pthreads.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_encode_pthreads.sh )
)
foreach( test grib_ecc-604 grib_ecc-604-encode bufr_ecc-604 ) foreach( test grib_ecc-604 grib_ecc-604-encode bufr_ecc-604 )
ecbuild_add_executable( TARGET ${test} ecbuild_add_executable( TARGET ${test}
NOINSTALL NOINSTALL
SOURCES ${test}.c SOURCES ${test}.c
LIBS eccodes LIBS eccodes )
)
endforeach() endforeach()
ecbuild_add_test( TARGET eccodes_t_grib_ecc-604 ecbuild_add_test( TARGET eccodes_t_grib_ecc-604
TYPE SCRIPT TYPE SCRIPT
TEST_DEPENDS eccodes_download_gribs TEST_DEPENDS eccodes_download_gribs
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ecc-604.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ecc-604.sh )
)
ecbuild_add_test( TARGET eccodes_t_bufr_ecc-604 ecbuild_add_test( TARGET eccodes_t_bufr_ecc-604
TYPE SCRIPT TYPE SCRIPT
TEST_DEPENDS eccodes_download_bufrs TEST_DEPENDS eccodes_download_bufrs
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_ecc-604.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_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 TYPE SCRIPT
CONDITION HAVE_NETCDF AND ENABLE_EXTRA_TESTS CONDITION HAVE_NETCDF AND ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_to_netcdf.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_to_netcdf.sh
TEST_DEPENDS eccodes_download_gribs TEST_DEPENDS eccodes_download_gribs )
)
ecbuild_add_test( TARGET eccodes_t_grib_jpeg ecbuild_add_test( TARGET eccodes_t_grib_jpeg
TYPE SCRIPT TYPE SCRIPT
CONDITION HAVE_JPEG AND ENABLE_EXTRA_TESTS CONDITION HAVE_JPEG AND ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_jpeg.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_jpeg.sh
TEST_DEPENDS eccodes_download_gribs TEST_DEPENDS eccodes_download_gribs )
)
ecbuild_add_test( TARGET eccodes_t_grib_png ecbuild_add_test( TARGET eccodes_t_grib_png
TYPE SCRIPT TYPE SCRIPT
CONDITION HAVE_PNG AND ENABLE_EXTRA_TESTS CONDITION HAVE_PNG AND ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_png.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_png.sh
TEST_DEPENDS eccodes_download_gribs TEST_DEPENDS eccodes_download_gribs )
)
ecbuild_add_test( TARGET eccodes_t_grib_ccsds ecbuild_add_test( TARGET eccodes_t_grib_ccsds
TYPE SCRIPT TYPE SCRIPT
CONDITION HAVE_AEC AND ENABLE_EXTRA_TESTS CONDITION HAVE_AEC AND ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ccsds.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ccsds.sh
TEST_DEPENDS eccodes_download_gribs 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 TYPE SCRIPT
CONDITION ENABLE_EXTRA_TESTS CONDITION ENABLE_EXTRA_TESTS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_param_concepts.sh 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 TYPE SCRIPT
CONDITION ENABLE_EXTRA_TESTS AND ECCODES_INSTALL_EXTRA_TOOLS CONDITION ENABLE_EXTRA_TESTS AND ECCODES_INSTALL_EXTRA_TOOLS
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_split_by_rdbSubtype.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_split_by_rdbSubtype.sh
TEST_DEPENDS eccodes_download_bufrs TEST_DEPENDS eccodes_download_bufrs )
)
# Performance test. Must have -DENABLE_GRIB_TIMER=ON # Performance test. Must have -DENABLE_GRIB_TIMER=ON
ecbuild_add_test( TARGET eccodes_t_grib_ecc-386 ecbuild_add_test( TARGET eccodes_t_grib_ecc-386
TYPE SCRIPT TYPE SCRIPT
CONDITION ENABLE_EXTRA_TESTS AND ENABLE_GRIB_TIMER CONDITION ENABLE_EXTRA_TESTS AND ENABLE_GRIB_TIMER
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ecc-386.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ecc-386.sh
TEST_DEPENDS eccodes_download_gribs TEST_DEPENDS eccodes_download_gribs )
)

View File

@ -10,26 +10,22 @@ ecbuild_add_library(TARGET tigge_tools
ecbuild_add_executable(TARGET tigge_check ecbuild_add_executable(TARGET tigge_check
SOURCES tigge_check.c SOURCES tigge_check.c
INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS} INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS}
LIBS eccodes tigge_tools LIBS eccodes tigge_tools)
)
ecbuild_add_executable(TARGET tigge_name ecbuild_add_executable(TARGET tigge_name
SOURCES tigge_name.c SOURCES tigge_name.c
INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS} INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS}
CONDITION ECCODES_INSTALL_EXTRA_TOOLS CONDITION ECCODES_INSTALL_EXTRA_TOOLS
LIBS eccodes tigge_tools LIBS eccodes tigge_tools)
)
ecbuild_add_executable(TARGET tigge_accumulations ecbuild_add_executable(TARGET tigge_accumulations
SOURCES tigge_accumulations.c SOURCES tigge_accumulations.c
INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS} INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS}
CONDITION ECCODES_INSTALL_EXTRA_TOOLS CONDITION ECCODES_INSTALL_EXTRA_TOOLS
LIBS eccodes tigge_tools LIBS eccodes tigge_tools)
)
ecbuild_add_executable(TARGET tigge_split ecbuild_add_executable(TARGET tigge_split
SOURCES tigge_split.c SOURCES tigge_split.c
INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS} INCLUDES ${ECCODES_EXTRA_INCLUDE_DIRS}
CONDITION ECCODES_INSTALL_EXTRA_TOOLS CONDITION ECCODES_INSTALL_EXTRA_TOOLS
LIBS eccodes tigge_tools LIBS eccodes tigge_tools)
)