2013-04-03 10:45:13 +00:00
|
|
|
file( GLOB samples_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.tmpl" )
|
|
|
|
|
2017-07-19 16:14:07 +00:00
|
|
|
if(HAVE_INSTALL_ECCODES_SAMPLES)
|
|
|
|
install( FILES ${samples_files}
|
|
|
|
DESTINATION ${ECCODES_SAMPLES_SUFF}
|
|
|
|
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ )
|
2023-03-09 08:33:32 +00:00
|
|
|
# set to the newest GRIB2 tablesVersion
|
2023-03-08 16:07:05 +00:00
|
|
|
if(NOT HAVE_MEMFS)
|
2023-03-09 08:33:32 +00:00
|
|
|
add_custom_target(set_grib2_latest_tables_version)
|
|
|
|
add_custom_command(TARGET set_grib2_latest_tables_version
|
2023-03-08 16:07:05 +00:00
|
|
|
POST_BUILD
|
|
|
|
COMMAND bash -c "cd ${CMAKE_INSTALL_PREFIX}/${ECCODES_SAMPLES_SUFF}; for F in GRIB2.tmpl *_grib2.tmpl ; do grib_set -s tablesVersion=30 $F tmp; mv tmp $F; done"
|
|
|
|
VERBATIM
|
|
|
|
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${ECCODES_SAMPLES_SUFF}
|
|
|
|
)
|
2023-03-09 08:33:32 +00:00
|
|
|
add_custom_command(TARGET set_grib2_latest_tables_version
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND bash -c "cd ${CMAKE_INSTALL_PREFIX}/share/eccodes/ifs_samples/grib1_mlgrib2; for F in *_ml.tmpl ; do grib_set -s tablesVersion=30 $F tmp; mv tmp $F; done"
|
|
|
|
VERBATIM
|
|
|
|
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${ECCODES_SAMPLES_SUFF}
|
|
|
|
)
|
|
|
|
add_custom_command(TARGET set_grib2_latest_tables_version
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND bash -c "cd ${CMAKE_INSTALL_PREFIX}/share/eccodes/ifs_samples/grib1_mlgrib2_ieee64; for F in *_ml.tmpl ; do grib_set -s tablesVersion=30 $F tmp; mv tmp $F; done"
|
|
|
|
VERBATIM
|
|
|
|
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${ECCODES_SAMPLES_SUFF}
|
|
|
|
)
|
|
|
|
if(HAVE_AEC)
|
|
|
|
add_custom_command(TARGET set_grib2_latest_tables_version
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND bash -c "cd ${CMAKE_INSTALL_PREFIX}/share/eccodes/ifs_samples/grib1_mlgrib2_ccsds; for F in *_ml.tmpl gg_sfc_grib2.tmpl ; do grib_set -s tablesVersion=30 $F tmp; mv tmp $F; done"
|
|
|
|
VERBATIM
|
|
|
|
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${ECCODES_SAMPLES_SUFF}
|
|
|
|
)
|
|
|
|
endif()
|
2023-03-08 16:07:05 +00:00
|
|
|
endif()
|
|
|
|
|
2017-07-19 16:14:07 +00:00
|
|
|
endif()
|
2013-04-03 10:45:13 +00:00
|
|
|
|
|
|
|
foreach( tmpl ${samples_files} )
|
2015-02-18 18:11:38 +00:00
|
|
|
list( APPEND ECCODES_SAMPLES_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tmpl} )
|
2017-07-19 16:14:07 +00:00
|
|
|
endforeach()
|
2013-04-03 10:45:13 +00:00
|
|
|
|
2015-02-18 18:11:38 +00:00
|
|
|
set( ECCODES_SAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE )
|
|
|
|
set( ECCODES_SAMPLES_FILES ${ECCODES_SAMPLES_FILES} PARENT_SCOPE )
|
2014-12-01 09:54:46 +00:00
|
|
|
|
2015-07-02 12:02:54 +00:00
|
|
|
# link to the samples in the build directory. See GRIB-786
|
2017-02-03 13:51:39 +00:00
|
|
|
file( MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${INSTALL_DATA_DIR} )
|
|
|
|
if( NOT EXISTS "${CMAKE_BINARY_DIR}/${ECCODES_SAMPLES_SUFF}" )
|
2015-07-23 15:17:50 +00:00
|
|
|
execute_process( COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
2017-02-03 13:51:39 +00:00
|
|
|
"${CMAKE_BINARY_DIR}/${ECCODES_SAMPLES_SUFF}" )
|
|
|
|
endif()
|