2020-03-12 15:14:38 +00:00
|
|
|
set( exclude "" )
|
|
|
|
if( NOT HAVE_PRODUCT_BUFR )
|
|
|
|
set( exclude -exclude bufr )
|
2020-03-12 17:19:34 +00:00
|
|
|
elseif( NOT HAVE_PRODUCT_GRIB )
|
|
|
|
set( exclude -exclude grib )
|
2020-03-12 15:14:38 +00:00
|
|
|
endif()
|
2020-04-15 21:19:44 +00:00
|
|
|
|
|
|
|
set( generated_c_files
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_000.c
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_001.c
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_002.c
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_final.c)
|
|
|
|
|
2016-06-14 14:34:09 +00:00
|
|
|
add_custom_command(
|
2020-04-15 21:19:44 +00:00
|
|
|
OUTPUT ${generated_c_files}
|
2016-06-14 14:34:09 +00:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/memfs.py
|
2020-03-12 15:14:38 +00:00
|
|
|
${exclude}
|
2016-06-14 14:34:09 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/definitions
|
|
|
|
${PROJECT_SOURCE_DIR}/samples
|
|
|
|
${PROJECT_SOURCE_DIR}/ifs_samples
|
2020-04-15 21:19:44 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen
|
2020-03-26 14:21:56 +00:00
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/memfs.py)
|
2016-06-14 14:34:09 +00:00
|
|
|
|
2020-03-26 14:21:56 +00:00
|
|
|
set_source_files_properties(
|
2020-04-15 21:19:44 +00:00
|
|
|
${generated_c_files} PROPERTIES OBJECT_DEPENDS
|
2016-06-14 14:34:09 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/memfs.py"
|
|
|
|
# "${PROJECT_SOURCE_DIR}/memfs.py" ${definition_files}"
|
|
|
|
)
|
|
|
|
|
2017-09-01 15:45:20 +00:00
|
|
|
# No debug symbols on Cray (workaround for HPC-230)
|
|
|
|
if( CMAKE_C_COMPILER_ID MATCHES Cray )
|
|
|
|
string( REGEX REPLACE "-g|-G[ 0-3]" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" )
|
|
|
|
string( REGEX REPLACE "-g|-G[ 0-3]" " " CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_CAPS} "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}" )
|
|
|
|
endif()
|
|
|
|
|
2020-03-26 14:21:56 +00:00
|
|
|
if( HAVE_MEMFS )
|
2016-12-19 13:25:48 +00:00
|
|
|
ecbuild_add_library(TARGET eccodes_memfs
|
2020-04-15 21:19:44 +00:00
|
|
|
SOURCES ${generated_c_files}
|
|
|
|
GENERATED ${generated_c_files})
|
2016-12-19 13:25:48 +00:00
|
|
|
endif()
|