CMake: add mechanism to install ecmwf-specific tools

This commit is contained in:
Shahram Najm 2015-01-25 15:31:33 +00:00
parent 6214122c2d
commit 79d12206c5
2 changed files with 35 additions and 16 deletions

View File

@ -266,6 +266,7 @@ if( NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME} )
set( GRIB_API_SAMPLES_PATH ${GRIB_API_SAMPLES_PATH} PARENT_SCOPE )
set( GRIB_API_IFS_SAMPLES_PATH ${GRIB_API_IFS_SAMPLES_PATH} PARENT_SCOPE )
set( ECCODES_DEFINITION_PATH ${ECCODES_DEFINITION_PATH} PARENT_SCOPE )
set( ECCODES_INSTALL_ECMWF_TOOLS ${ECCODES_INSTALL_ECMWF_TOOLS} PARENT_SCOPE )
endif()
############################################################################################

View File

@ -1,5 +1,4 @@
# tools library
ecbuild_add_library( TARGET grib_tools
TYPE STATIC
NOINSTALL
@ -7,43 +6,62 @@ ecbuild_add_library( TARGET grib_tools
LIBS grib_api )
# tools binaries
list( APPEND grib_tools_bins
grib_histogram big2gribex
codes_info grib_filter grib_ls grib_dump grib_merge
grib2ppm grib_set grib_get grib_get_data grib_copy grib_repair
grib_compare parser grib_count grib_index_build
gg_sub_area_check grib_to_netcdf grib_to_json
codes_info
grib_histogram grib_filter grib_ls grib_dump grib_merge
grib2ppm grib_set grib_get grib_get_data grib_copy
grib_compare parser grib_count grib_index_build grib_to_netcdf
bufr_filter bufr_ls bufr_dump bufr_set bufr_get
bufr_copy bufr_compare bufr_index_build
taf_dump taf_ls taf_get taf_filter
metar_dump metar_ls metar_get metar_filter
)
list( APPEND grib_tools_bins_ECMWF_ONLY
big2gribex
gg_sub_area_check
grib_repair
grib_to_json
)
# Install generic tools
foreach( tool ${grib_tools_bins} )
# here we use the fact that each tool has only one C file that matches its name
ecbuild_add_executable( TARGET ${tool}
SOURCES ${tool}.c
LIBS grib_tools )
endforeach()
# Install tools specific to ECMWF
# User must run cmake with -DECCODES_INSTALL_ECMWF_TOOLS
########################################
foreach( tool ${grib_tools_bins_ECMWF_ONLY} )
ecbuild_add_executable( TARGET ${tool}
SOURCES ${tool}.c
CONDITION ECCODES_INSTALL_ECMWF_TOOLS
LIBS grib_tools )
endforeach()
ecbuild_add_executable( TARGET grib_list_keys
SOURCES list_keys.c
CONDITION ECCODES_INSTALL_ECMWF_TOOLS
LIBS grib_tools )
# script
# grib1to2 script needs to be generated before installation
if (ECCODES_INSTALL_ECMWF_TOOLS)
configure_file( grib1to2.in grib1to2 )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/grib1to2
DESTINATION ${INSTALL_BIN_DIR}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ )
endif()
########################################
# BUFR compare script
install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/bufr_compare_dir
DESTINATION ${INSTALL_BIN_DIR}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ )
# grib1to2 script needs to be generated before installation
configure_file( grib1to2.in grib1to2 )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/grib1to2
DESTINATION ${INSTALL_BIN_DIR}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ )