eccodes/memfs/CMakeLists.txt

55 lines
1.8 KiB
CMake
Raw Permalink Normal View History

# Note: the count 10 of generated C files must match
# the 'generated_c_files' list
2021-08-30 07:34:39 +00:00
list( APPEND memfs_args
--count 10
--output ${CMAKE_CURRENT_BINARY_DIR}/memfs_gen
)
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
2020-04-16 11:26:32 +00:00
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_003.c
2020-10-19 08:16:24 +00:00
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_004.c
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_005.c
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_006.c
2021-08-29 15:25:42 +00:00
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_007.c
2021-08-29 21:58:18 +00:00
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_008.c
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_009.c
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen_final.c)
if( NOT HAVE_PRODUCT_BUFR )
2021-08-30 07:34:39 +00:00
list( APPEND memfs_args --exclude bufr)
endif()
if( NOT HAVE_PRODUCT_GRIB )
list( APPEND memfs_args --exclude grib)
endif()
2016-06-14 14:34:09 +00:00
add_custom_command(
OUTPUT ${generated_c_files}
2016-06-14 14:34:09 +00:00
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/memfs.py
2021-08-30 07:34:39 +00:00
${memfs_args}
2016-06-14 14:34:09 +00:00
${PROJECT_SOURCE_DIR}/definitions
${PROJECT_SOURCE_DIR}/samples
${PROJECT_SOURCE_DIR}/ifs_samples
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(
${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}"
)
# 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
SOURCES ${generated_c_files}
GENERATED ${generated_c_files})
2016-12-19 13:25:48 +00:00
endif()