mirror of https://github.com/ecmwf/eccodes.git
41 lines
1.3 KiB
CMake
41 lines
1.3 KiB
CMake
set( exclude "" )
|
|
if( NOT HAVE_PRODUCT_BUFR )
|
|
set( exclude -exclude bufr )
|
|
elseif( NOT HAVE_PRODUCT_GRIB )
|
|
set( exclude -exclude grib )
|
|
endif()
|
|
|
|
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)
|
|
|
|
add_custom_command(
|
|
OUTPUT ${generated_c_files}
|
|
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/memfs.py
|
|
${exclude}
|
|
${PROJECT_SOURCE_DIR}/definitions
|
|
${PROJECT_SOURCE_DIR}/samples
|
|
${PROJECT_SOURCE_DIR}/ifs_samples
|
|
${CMAKE_CURRENT_BINARY_DIR}/memfs_gen
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/memfs.py)
|
|
|
|
set_source_files_properties(
|
|
${generated_c_files} PROPERTIES OBJECT_DEPENDS
|
|
"${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()
|
|
|
|
if( HAVE_MEMFS )
|
|
ecbuild_add_library(TARGET eccodes_memfs
|
|
SOURCES ${generated_c_files}
|
|
GENERATED ${generated_c_files})
|
|
endif()
|