2016-04-13 15:12:21 +00:00
|
|
|
#
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2016-04-13 15:12:21 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
|
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
#
|
|
|
|
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
|
|
# granted to it by virtue of its status as an intergovernmental organisation
|
|
|
|
# nor does it submit to any jurisdiction.
|
|
|
|
#
|
|
|
|
|
2022-04-19 10:31:16 +00:00
|
|
|
list( APPEND ecc_tools_sources
|
2019-01-07 16:13:48 +00:00
|
|
|
grib_tools.c
|
|
|
|
grib_options.c
|
2020-03-25 18:13:32 +00:00
|
|
|
grib_tools.h )
|
2019-01-07 16:13:48 +00:00
|
|
|
|
|
|
|
if( EC_OS_NAME MATCHES "windows" )
|
2022-04-19 10:31:16 +00:00
|
|
|
list( APPEND ecc_tools_sources wingetopt.c )
|
2019-01-07 16:13:48 +00:00
|
|
|
endif()
|
|
|
|
|
2022-05-21 13:37:23 +00:00
|
|
|
if( HAVE_EXPERIMENTAL_BUILD_WITH_CXX )
|
2022-05-21 18:39:33 +00:00
|
|
|
foreach( _src ${ecc_tools_sources} )
|
|
|
|
get_filename_component( _ext ${_src} EXT )
|
|
|
|
if( _ext STREQUAL ".c" )
|
|
|
|
set_source_files_properties(${_src} PROPERTIES LANGUAGE CXX)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2022-05-21 13:37:23 +00:00
|
|
|
endif()
|
|
|
|
|
2013-03-25 12:04:10 +00:00
|
|
|
# tools library
|
2022-04-19 10:31:16 +00:00
|
|
|
ecbuild_add_library( TARGET ecc_tools
|
2014-06-18 16:14:01 +00:00
|
|
|
TYPE STATIC
|
2013-04-10 15:46:41 +00:00
|
|
|
NOINSTALL
|
2022-04-19 10:31:16 +00:00
|
|
|
SOURCES ${ecc_tools_sources}
|
2020-08-18 10:14:29 +00:00
|
|
|
PRIVATE_LIBS eccodes )
|
2013-03-25 12:04:10 +00:00
|
|
|
|
|
|
|
# tools binaries
|
2020-03-25 16:26:49 +00:00
|
|
|
list( APPEND ecc_tools_binaries
|
2017-10-27 09:57:49 +00:00
|
|
|
codes_info codes_count codes_split_file
|
2015-01-25 15:31:33 +00:00
|
|
|
grib_histogram grib_filter grib_ls grib_dump grib_merge
|
|
|
|
grib2ppm grib_set grib_get grib_get_data grib_copy
|
2020-08-19 15:20:27 +00:00
|
|
|
grib_compare codes_parser grib_index_build bufr_index_build
|
2016-02-11 17:47:08 +00:00
|
|
|
bufr_ls bufr_dump bufr_set bufr_get
|
2019-05-14 16:53:39 +00:00
|
|
|
bufr_copy bufr_compare
|
2016-04-04 13:27:04 +00:00
|
|
|
gts_get gts_compare gts_copy gts_dump gts_filter gts_ls
|
2020-03-25 18:13:32 +00:00
|
|
|
metar_dump metar_ls metar_compare metar_get metar_filter metar_copy )
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2020-03-25 16:26:49 +00:00
|
|
|
list( APPEND ecc_tools_binaries_extra
|
2015-01-25 15:31:33 +00:00
|
|
|
big2gribex
|
|
|
|
gg_sub_area_check
|
|
|
|
grib_repair
|
|
|
|
grib_to_json
|
2022-03-12 12:52:00 +00:00
|
|
|
codes_export_resource
|
2015-09-25 17:11:52 +00:00
|
|
|
grib_check_gaussian_grid
|
2020-03-25 18:13:32 +00:00
|
|
|
bufr_split_by_rdbSubtype )
|
2015-01-25 15:31:33 +00:00
|
|
|
|
|
|
|
# Install generic tools
|
2020-03-25 16:26:49 +00:00
|
|
|
foreach( tool ${ecc_tools_binaries} )
|
2013-03-25 12:04:10 +00:00
|
|
|
# here we use the fact that each tool has only one C file that matches its name
|
2022-05-21 13:37:23 +00:00
|
|
|
if( HAVE_EXPERIMENTAL_BUILD_WITH_CXX )
|
|
|
|
set_source_files_properties(${tool}.c PROPERTIES LANGUAGE CXX)
|
|
|
|
endif()
|
2013-03-25 12:04:10 +00:00
|
|
|
ecbuild_add_executable( TARGET ${tool}
|
2014-06-18 16:14:01 +00:00
|
|
|
SOURCES ${tool}.c
|
2022-04-19 10:31:16 +00:00
|
|
|
LIBS ecc_tools )
|
2015-01-25 15:31:33 +00:00
|
|
|
endforeach()
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2016-01-11 11:22:10 +00:00
|
|
|
# Install extra tools
|
|
|
|
# User must run cmake with -DECCODES_INSTALL_EXTRA_TOOLS=ON
|
2020-03-25 16:26:49 +00:00
|
|
|
foreach( tool ${ecc_tools_binaries_extra} )
|
2015-01-25 15:31:33 +00:00
|
|
|
ecbuild_add_executable( TARGET ${tool}
|
|
|
|
SOURCES ${tool}.c
|
2015-10-21 16:31:19 +00:00
|
|
|
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
|
2022-04-19 10:31:16 +00:00
|
|
|
LIBS ecc_tools )
|
2013-03-25 12:04:10 +00:00
|
|
|
endforeach()
|
|
|
|
|
2019-03-19 15:36:25 +00:00
|
|
|
# grib_count/bufr_count etc. Same source code, different executable names
|
2015-02-01 20:53:53 +00:00
|
|
|
ecbuild_add_executable( TARGET grib_count
|
|
|
|
SOURCES codes_count.c
|
2022-04-19 10:31:16 +00:00
|
|
|
LIBS ecc_tools )
|
2015-02-01 20:53:53 +00:00
|
|
|
ecbuild_add_executable( TARGET bufr_count
|
|
|
|
SOURCES codes_count.c
|
2022-04-19 10:31:16 +00:00
|
|
|
LIBS ecc_tools )
|
2019-03-19 15:36:25 +00:00
|
|
|
ecbuild_add_executable( TARGET gts_count
|
|
|
|
SOURCES codes_count.c
|
2022-04-19 10:31:16 +00:00
|
|
|
LIBS ecc_tools )
|
2015-02-01 20:53:53 +00:00
|
|
|
|
2015-02-05 16:57:47 +00:00
|
|
|
# grib to netcdf is optional
|
|
|
|
ecbuild_add_executable( TARGET grib_to_netcdf
|
|
|
|
SOURCES grib_to_netcdf.c
|
|
|
|
CONDITION HAVE_NETCDF
|
2022-04-19 10:31:16 +00:00
|
|
|
LIBS ecc_tools NetCDF::NetCDF_C )
|
2016-01-11 11:25:08 +00:00
|
|
|
|
|
|
|
|
2014-12-18 11:33:47 +00:00
|
|
|
ecbuild_add_executable( TARGET grib_list_keys
|
|
|
|
SOURCES list_keys.c
|
2015-10-21 16:31:19 +00:00
|
|
|
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
|
2022-04-19 10:31:16 +00:00
|
|
|
LIBS ecc_tools )
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2016-02-11 17:47:08 +00:00
|
|
|
ecbuild_add_executable( TARGET codes_bufr_filter
|
|
|
|
SOURCES bufr_filter.c
|
2022-04-19 10:31:16 +00:00
|
|
|
LIBS ecc_tools )
|
2016-02-11 17:47:08 +00:00
|
|
|
|
|
|
|
|
2015-01-25 15:31:33 +00:00
|
|
|
# grib1to2 script needs to be generated before installation
|
2020-03-25 18:13:32 +00:00
|
|
|
if( ECCODES_INSTALL_EXTRA_TOOLS )
|
2020-02-23 17:58:39 +00:00
|
|
|
ecbuild_info("ECCODES_INSTALL_EXTRA_TOOLS enabled")
|
2015-01-25 15:31:33 +00:00
|
|
|
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
|
2014-12-18 11:33:47 +00:00
|
|
|
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 )
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2016-02-11 17:47:08 +00:00
|
|
|
|
|
|
|
# bufr_filter script (See ECC-205)
|
2016-02-19 14:00:53 +00:00
|
|
|
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
${PROJECT_SOURCE_DIR}/tools/bufr_filter
|
|
|
|
${CMAKE_BINARY_DIR}/bin/ )
|
|
|
|
|
2016-02-11 17:47:08 +00:00
|
|
|
install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/bufr_filter
|
|
|
|
DESTINATION ${INSTALL_BIN_DIR}
|
|
|
|
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
|
|
|
GROUP_EXECUTE GROUP_READ
|
|
|
|
WORLD_EXECUTE WORLD_READ )
|
|
|
|
|