GRIB-786: Cmake performance

This commit is contained in:
Shahram Najm 2015-07-02 13:02:54 +01:00
parent 80f57efcb7
commit 9e2af2f8e7
12 changed files with 43 additions and 52 deletions

View File

@ -6,18 +6,17 @@ add_subdirectory(gts)
# Download all the binary GRIB data from website # Download all the binary GRIB data from website
#
FILE(READ "grib_data_files.txt" files_to_download) file(READ "grib_data_files.txt" files_to_download)
STRING(REGEX REPLACE "\n" ";" files_to_download "${files_to_download}") string(REGEX REPLACE "\n" ";" files_to_download "${files_to_download}")
if( HAVE_AEC ) if( HAVE_AEC )
LIST(APPEND files_to_download ccsds.grib2) list(APPEND files_to_download ccsds.grib2)
endif() endif()
# Download all data files doing md5 check on each # Download all data files doing md5 check on each
ecbuild_get_test_multidata( TARGET get_gribs ecbuild_get_test_multidata( TARGET get_gribs
NAMES ${files_to_download} NAMES ${files_to_download} )
)
# 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

View File

@ -1,10 +1,9 @@
# data/tigge/CMakeLists.txt # data/tigge/CMakeLists.txt
# Download all the TIGGE grib data from website # Download all the TIGGE grib data from website
#
FILE(READ "tigge_data_files.txt" tigge_files_to_download) file(READ "tigge_data_files.txt" tigge_files_to_download)
STRING(REGEX REPLACE "\n" ";" tigge_files_to_download "${tigge_files_to_download}") string(REGEX REPLACE "\n" ";" tigge_files_to_download "${tigge_files_to_download}")
# Download all data files doing md5 check on each # Download all data files doing md5 check on each
ecbuild_get_test_multidata( TARGET get_tigge_gribs ecbuild_get_test_multidata( TARGET get_tigge_gribs
NAMES ${tigge_files_to_download} NAMES ${tigge_files_to_download} )
)

View File

@ -19,6 +19,12 @@ install( DIRECTORY budg bufr cdf common grib1 grib2 gts mars metar tide hdf5 wr
PATTERN "4.2.192.*.table" EXCLUDE PATTERN "4.2.192.*.table" EXCLUDE
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ ) PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ )
# link to the definitions. See GRIB-786
file( MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME} )
execute_process( COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/definitions" )
# copy the definitions to the build directory # copy the definitions to the build directory
#file( COPY ${definition_files} ${table_files} ${text_files} #file( COPY ${definition_files} ${table_files} ${text_files}
# DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/definitions ) # DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/definitions )

View File

@ -3,6 +3,7 @@
# Configure the file which all CMake tests will include # Configure the file which all CMake tests will include
configure_file( include.ctest.sh.in include.ctest.sh @ONLY ) 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 # Build the executables used by test scripts
################################################ ################################################
@ -92,7 +93,6 @@ foreach( test ${tests} )
ecbuild_add_test( TARGET c_${test} ecbuild_add_test( TARGET c_${test}
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
RESOURCES include.sh
TEST_DEPENDS get_gribs get_bufrs TEST_DEPENDS get_gribs get_bufrs
) )
endforeach() endforeach()

View File

@ -10,7 +10,8 @@ fi
proj_dir=@PROJECT_SOURCE_DIR@ proj_dir=@PROJECT_SOURCE_DIR@
data_dir=@PROJECT_BINARY_DIR@/data data_dir=@PROJECT_BINARY_DIR@/data
def_dir="@PROJECT_SOURCE_DIR@/definitions" # use definitions from binary dir to test if installation will be correct
def_dir="@CMAKE_BINARY_DIR@/share/@PROJECT_NAME@/definitions"
ECCODES_DEFINITION_PATH="${def_dir}" ECCODES_DEFINITION_PATH="${def_dir}"
export ECCODES_DEFINITION_PATH export ECCODES_DEFINITION_PATH

View File

@ -3,6 +3,7 @@
# Configure the file which all CMake tests will include # Configure the file which all CMake tests will include
configure_file( include.ctest.sh.in include.ctest.sh @ONLY ) 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 # Build the executables used by test scripts
################################################ ################################################
@ -43,33 +44,14 @@ list( APPEND tests
get_product_kind get_product_kind
) )
# Simplify tests: no need to build executable and then test. All in one
# TODO
# ecbuild_add_test( TARGET test_f90_samples
# LINKER_LANGUAGE Fortran
# SOURCES samples.f90
# LIBS eccodes_f90 eccodes
# COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/samples.sh
# CONDITION HAVE_FORTRAN
# )
foreach( tool ${tests} ) foreach( tool ${tests} )
# Build the Fortran executable ecbuild_add_test( TARGET f_${tool}
ecbuild_add_executable( TARGET f_${tool}
NOINSTALL
SOURCES ${tool}.f90 SOURCES ${tool}.f90
CONDITION HAVE_FORTRAN
LINKER_LANGUAGE Fortran LINKER_LANGUAGE Fortran
LIBS eccodes_f90 eccodes LIBS eccodes_f90 eccodes
)
# Add the test which depends on the above executable
ecbuild_add_test( TARGET f_${tool}_test
TYPE SCRIPT
DEPENDS f_${tool}
CONDITION HAVE_FORTRAN CONDITION HAVE_FORTRAN
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh
RESOURCES include.sh
TEST_DEPENDS get_gribs get_bufrs TEST_DEPENDS get_gribs get_bufrs
) )
endforeach() endforeach()
@ -104,6 +86,4 @@ ecbuild_add_executable( TARGET f_set_gvc
# TYPE SCRIPT # TYPE SCRIPT
# DEPENDS set_gvc set # DEPENDS set_gvc set
# COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/set.sh # COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/set.sh
# RESOURCES include.sh
# ) # )
#

View File

@ -10,7 +10,8 @@ fi
proj_dir=@PROJECT_SOURCE_DIR@ proj_dir=@PROJECT_SOURCE_DIR@
data_dir=@PROJECT_BINARY_DIR@/data data_dir=@PROJECT_BINARY_DIR@/data
def_dir="@PROJECT_SOURCE_DIR@/definitions" # use definitions from binary dir to test if installation will be correct
def_dir="@CMAKE_BINARY_DIR@/share/@PROJECT_NAME@/definitions"
ECCODES_DEFINITION_PATH="${def_dir}" ECCODES_DEFINITION_PATH="${def_dir}"
export ECCODES_DEFINITION_PATH export ECCODES_DEFINITION_PATH

View File

@ -3,6 +3,7 @@
# Configure the file which all CMake tests will include # Configure the file which all CMake tests will include
configure_file( include.ctest.sh.in include.ctest.sh @ONLY ) 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 # Build the executables used by test scripts
################################################ ################################################
@ -12,6 +13,7 @@ list( APPEND test_bins
grib_iterator grib_iterator
count_messages count_messages
) )
foreach( tool ${test_bins} ) foreach( tool ${test_bins} )
ecbuild_add_executable( TARGET p_${tool} ecbuild_add_executable( TARGET p_${tool}
NOINSTALL NOINSTALL
@ -22,6 +24,7 @@ foreach( tool ${test_bins} )
list( APPEND ptools p_${tool} ) list( APPEND ptools p_${tool} )
endforeach() endforeach()
# Now add each test # Now add each test
################################################# #################################################
list( APPEND tests list( APPEND tests
@ -60,7 +63,7 @@ foreach( test ${tests} )
DEPENDS ${ptools} DEPENDS ${ptools}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
CONDITION HAVE_PYTHON CONDITION HAVE_PYTHON
RESOURCES include.sh ${test}.py RESOURCES ${test}.py
ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE}
TEST_DEPENDS get_gribs get_tigge_gribs get_bufrs TEST_DEPENDS get_gribs get_tigge_gribs get_bufrs
) )

View File

@ -10,7 +10,8 @@ fi
proj_dir=@PROJECT_SOURCE_DIR@ proj_dir=@PROJECT_SOURCE_DIR@
data_dir=@PROJECT_BINARY_DIR@/data data_dir=@PROJECT_BINARY_DIR@/data
def_dir="@PROJECT_SOURCE_DIR@/definitions" # use definitions from binary dir to test if installation will be correct
def_dir="@CMAKE_BINARY_DIR@/share/@PROJECT_NAME@/definitions"
ECCODES_DEFINITION_PATH="${def_dir}" ECCODES_DEFINITION_PATH="${def_dir}"
export ECCODES_DEFINITION_PATH export ECCODES_DEFINITION_PATH

View File

@ -11,7 +11,9 @@ endforeach()
set( ECCODES_SAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE ) set( ECCODES_SAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE )
set( ECCODES_SAMPLES_FILES ${ECCODES_SAMPLES_FILES} PARENT_SCOPE ) set( ECCODES_SAMPLES_FILES ${ECCODES_SAMPLES_FILES} PARENT_SCOPE )
# copy the samples to the build directory # link to the samples in the build directory. See GRIB-786
file( MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME} )
execute_process( COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/samples" )
file( COPY ${samples_files}
DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/samples )

View File

@ -3,6 +3,10 @@
# Configure the file which all CMake tests will include # Configure the file which all CMake tests will include
configure_file( include.ctest.sh.in include.ctest.sh @ONLY ) 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} )
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/utils.sh ${CMAKE_CURRENT_BINARY_DIR} )
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/number_compare.pl ${CMAKE_CURRENT_BINARY_DIR} )
# Build the executables used by test scripts # Build the executables used by test scripts
################################################ ################################################
list( APPEND test_bins list( APPEND test_bins
@ -87,7 +91,6 @@ foreach( test ${tests1} )
ecbuild_add_test( TARGET t_${test} ecbuild_add_test( TARGET t_${test}
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
RESOURCES include.sh utils.sh number_compare.pl
) )
endforeach() endforeach()
@ -98,7 +101,6 @@ foreach( test ${tests2} )
ecbuild_add_test( TARGET t_${test} ecbuild_add_test( TARGET t_${test}
TYPE SCRIPT TYPE SCRIPT
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh
RESOURCES include.sh utils.sh number_compare.pl
TEST_DEPENDS get_gribs get_tigge_gribs get_bufrs get_metars get_gts TEST_DEPENDS get_gribs get_tigge_gribs get_bufrs get_metars get_gts
) )
endforeach() endforeach()
@ -108,7 +110,7 @@ endforeach()
ecbuild_add_test( TARGET t_lamb_az_eq_area 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 lamb_az_eq_area.ref
TEST_DEPENDS get_gribs TEST_DEPENDS get_gribs
) )
@ -117,7 +119,6 @@ ecbuild_add_test( TARGET t_grib_to_netcdf
TYPE SCRIPT TYPE SCRIPT
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
TEST_DEPENDS get_gribs TEST_DEPENDS get_gribs
) )
@ -125,7 +126,6 @@ ecbuild_add_test( TARGET t_jpeg
TYPE SCRIPT TYPE SCRIPT
CONDITION HAVE_JPEG CONDITION HAVE_JPEG
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/jpeg.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/jpeg.sh
RESOURCES include.sh
TEST_DEPENDS get_gribs TEST_DEPENDS get_gribs
) )
@ -133,7 +133,5 @@ ecbuild_add_test( TARGET t_ccsds
TYPE SCRIPT TYPE SCRIPT
CONDITION HAVE_AEC CONDITION HAVE_AEC
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ccsds.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ccsds.sh
RESOURCES include.sh
TEST_DEPENDS get_gribs TEST_DEPENDS get_gribs
) )

View File

@ -10,7 +10,8 @@ fi
proj_dir=@PROJECT_SOURCE_DIR@ proj_dir=@PROJECT_SOURCE_DIR@
data_dir=@PROJECT_BINARY_DIR@/data data_dir=@PROJECT_BINARY_DIR@/data
def_dir="@PROJECT_SOURCE_DIR@/definitions" # use definitions from binary dir to test if installation will be correct
def_dir="@CMAKE_BINARY_DIR@/share/@PROJECT_NAME@/definitions"
ECCODES_DEFINITION_PATH="${def_dir}" ECCODES_DEFINITION_PATH="${def_dir}"
export ECCODES_DEFINITION_PATH export ECCODES_DEFINITION_PATH