GRIB-711: CMake build: should not need to download data to compile

This commit is contained in:
Shahram Najm 2015-03-10 15:52:33 +00:00
parent fd2531c7cf
commit 549fc7fa3a
7 changed files with 24 additions and 45 deletions

View File

@ -95,15 +95,10 @@ if( HAVE_AEC )
LIST(APPEND files_to_download ccsds.grib2) LIST(APPEND files_to_download ccsds.grib2)
endif() endif()
ecbuild_get_test_multidata( TARGET get_gribs
foreach( f ${files_to_download} ) NOCHECK
set(tgt data_${f}) NAMES ${files_to_download}
# Download the file and create a dummy target for it )
ecbuild_get_test_data(TARGET "${tgt}" NAME "${f}" DIRNAME ${PROJECT_NAME}/data NOCHECK)
# Add to list of targets
LIST(APPEND tgts "${tgt}")
endforeach()
# 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
@ -151,7 +146,3 @@ 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()
# debug_var(tgts)
# Another dummy target which depends on all previous targets
#add_custom_target( get_gribs ALL DEPENDS ${tgts} )
add_custom_target( get_gribs DEPENDS ${tgts} )

View File

@ -412,17 +412,8 @@ set(bufr_refs_to_download
syno_multi.bufr syno_multi.bufr
) )
foreach( f ${bufr_files_to_download} ${bufr_refs_to_download} ) ecbuild_get_test_multidata(
set(tgt bufr_data_${f}) TARGET get_bufrs
# Download the file and create a dummy target for it NOCHECK
ecbuild_get_test_data(TARGET "${tgt}" NAMES ${bufr_files_to_download} ${bufr_refs_to_download}
NAME "${f}" )
DIRNAME ${PROJECT_NAME}/data/bufr
NOCHECK)
# Add to list of targets
LIST(APPEND tgts "${tgt}")
endforeach()
add_custom_target( get_bufrs DEPENDS ${tgts} )

View File

@ -244,17 +244,7 @@ set(tigge_files_to_download
tiggelam_cnmc_sfc.grib tiggelam_cnmc_sfc.grib
) )
foreach( f ${tigge_files_to_download} ) ecbuild_get_test_multidata( TARGET get_tigge_gribs
set(tgt tigge_data_${f}) NOCHECK
# Download the file and create a dummy target for it NAMES ${tigge_files_to_download}
ecbuild_get_test_data(TARGET "${tgt}" )
NAME "${f}"
DIRNAME ${PROJECT_NAME}/data/tigge
NOCHECK)
# Add to list of targets
LIST(APPEND tgts "${tgt}")
endforeach()
add_custom_target( get_tigge_gribs DEPENDS ${tgts} )

View File

@ -88,6 +88,7 @@ foreach( test ${tests} )
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
RESOURCES include.sh RESOURCES include.sh
TEST_DEPENDS get_gribs get_bufrs
) )
endforeach() endforeach()

View File

@ -67,6 +67,7 @@ foreach( tool ${tests} )
CONDITION EC_HAVE_FORTRAN CONDITION EC_HAVE_FORTRAN
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh
RESOURCES include.sh RESOURCES include.sh
TEST_DEPENDS get_gribs get_bufrs
) )
endforeach() endforeach()

View File

@ -57,5 +57,6 @@ foreach( test ${tests} )
CONDITION HAVE_PYTHON CONDITION HAVE_PYTHON
RESOURCES include.sh ${test}.py RESOURCES include.sh ${test}.py
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
TEST_DEPENDS get_gribs get_tigge_gribs get_bufrs
) )
endforeach() endforeach()

View File

@ -76,15 +76,15 @@ list( APPEND tests
unit_tests unit_tests
) )
# Note: making the test dependent on the grib files (with DEPENDS)
# means they will be downloaded at "make" time
# rather than when you do "make test". Use TEST_DEPENDS instead
foreach( test ${tests} ) foreach( test ${tests} )
# Note: making the test dependent on the grib data files
# means they will be downloaded at "make" time
# rather than when you do "make test"
ecbuild_add_test( TARGET t_${test} ecbuild_add_test( TARGET t_${test}
TYPE SCRIPT TYPE SCRIPT
DEPENDS get_gribs get_tigge_gribs get_bufrs
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
RESOURCES include.sh number_compare.pl RESOURCES include.sh number_compare.pl
TEST_DEPENDS get_gribs get_tigge_gribs get_bufrs
) )
endforeach() endforeach()
@ -94,6 +94,7 @@ ecbuild_add_test( TARGET t_lamb_az_eq_area
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lamb_az_eq_area.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lamb_az_eq_area.sh
RESOURCES include.sh lamb_az_eq_area.ref RESOURCES include.sh lamb_az_eq_area.ref
TEST_DEPENDS get_gribs
) )
# These ones are conditional # These ones are conditional
@ -102,6 +103,7 @@ ecbuild_add_test( TARGET t_grib_to_netcdf
CONDITION HAVE_NETCDF CONDITION HAVE_NETCDF
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_to_netcdf.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_to_netcdf.sh
RESOURCES include.sh RESOURCES include.sh
TEST_DEPENDS get_gribs
) )
ecbuild_add_test( TARGET t_jpeg ecbuild_add_test( TARGET t_jpeg
@ -109,6 +111,7 @@ ecbuild_add_test( TARGET t_jpeg
CONDITION HAVE_JPEG CONDITION HAVE_JPEG
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/jpeg.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/jpeg.sh
RESOURCES include.sh RESOURCES include.sh
TEST_DEPENDS get_gribs
) )
ecbuild_add_test( TARGET t_ccsds ecbuild_add_test( TARGET t_ccsds
@ -116,5 +119,6 @@ ecbuild_add_test( TARGET t_ccsds
CONDITION HAVE_AEC CONDITION HAVE_AEC
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ccsds.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ccsds.sh
RESOURCES include.sh RESOURCES include.sh
TEST_DEPENDS get_gribs
) )