mirror of https://github.com/ecmwf/eccodes.git
CMake: fortran and examples features
This commit is contained in:
parent
4a53d7cfa2
commit
76bd03e33a
|
@ -12,7 +12,6 @@ project( eccodes C )
|
|||
|
||||
set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild/cmake")
|
||||
|
||||
#set( ECCODES_INSTALL_INCLUDE_DIR include CACHE PATH "ecCodes override installation directory for header files")
|
||||
|
||||
include( ecbuild_system )
|
||||
|
||||
|
@ -26,6 +25,11 @@ ecbuild_declare_project()
|
|||
###############################################################################
|
||||
# some variables/options of this project
|
||||
|
||||
ecbuild_add_option( FEATURE EXAMPLES
|
||||
DESCRIPTION "Build the examples"
|
||||
DEFAULT ON
|
||||
)
|
||||
|
||||
ecbuild_add_option( FEATURE JPG
|
||||
DESCRIPTION "support for JPG decoding/encoding"
|
||||
DEFAULT ON
|
||||
|
@ -59,17 +63,22 @@ ecbuild_add_option( FEATURE AEC
|
|||
ecbuild_add_option( FEATURE PYTHON
|
||||
DESCRIPTION "build the ecCodes Python interface"
|
||||
DEFAULT ON
|
||||
# REQUIRED_LANGUAGES Python # TODO
|
||||
)
|
||||
|
||||
ecbuild_add_option( FEATURE FORTRAN
|
||||
DESCRIPTION "build the ecCodes Fortran interface"
|
||||
DEFAULT ON
|
||||
# REQUIRED_LANGUAGES Fortran # TODO
|
||||
)
|
||||
|
||||
# TODO Remove this after REQUIRED_LANGUAGES
|
||||
if( ENABLE_FORTRAN )
|
||||
# will set EC_HAVE_FORTRAN with the result
|
||||
ecbuild_enable_fortran( MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/fortran/modules )
|
||||
set( HAVE_FORTRAN ${EC_HAVE_FORTRAN} )
|
||||
else()
|
||||
set( HAVE_FORTRAN 0 )
|
||||
endif()
|
||||
|
||||
# advanced options (not visible in cmake-gui )
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
add_subdirectory(C)
|
||||
add_subdirectory(F90)
|
||||
add_subdirectory(python)
|
||||
if( HAVE_EXAMPLES )
|
||||
add_subdirectory(C)
|
||||
add_subdirectory(F90)
|
||||
add_subdirectory(python)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ list( APPEND tests
|
|||
# SOURCES samples.f90
|
||||
# LIBS eccodes_f90 eccodes
|
||||
# COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/samples.sh
|
||||
# CONDITION EC_HAVE_FORTRAN
|
||||
# CONDITION HAVE_FORTRAN
|
||||
# )
|
||||
|
||||
foreach( tool ${tests} )
|
||||
|
@ -59,7 +59,7 @@ foreach( tool ${tests} )
|
|||
ecbuild_add_executable( TARGET f_${tool}
|
||||
NOINSTALL
|
||||
SOURCES ${tool}.f90
|
||||
CONDITION EC_HAVE_FORTRAN
|
||||
CONDITION HAVE_FORTRAN
|
||||
LINKER_LANGUAGE Fortran
|
||||
LIBS eccodes_f90 eccodes
|
||||
)
|
||||
|
@ -67,7 +67,7 @@ foreach( tool ${tests} )
|
|||
ecbuild_add_test( TARGET f_${tool}_test
|
||||
TYPE SCRIPT
|
||||
DEPENDS f_${tool}
|
||||
CONDITION EC_HAVE_FORTRAN
|
||||
CONDITION HAVE_FORTRAN
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${tool}.sh
|
||||
RESOURCES include.sh
|
||||
TEST_DEPENDS get_gribs get_bufrs
|
||||
|
@ -79,21 +79,21 @@ endforeach()
|
|||
ecbuild_add_executable( TARGET f_new_from_file
|
||||
NOINSTALL
|
||||
SOURCES new_from_file.f90
|
||||
CONDITION EC_HAVE_FORTRAN
|
||||
CONDITION HAVE_FORTRAN
|
||||
LINKER_LANGUAGE Fortran
|
||||
LIBS eccodes_f90 eccodes
|
||||
)
|
||||
ecbuild_add_executable( TARGET f_copy_namespace
|
||||
NOINSTALL
|
||||
SOURCES copy_namespace.f90
|
||||
CONDITION EC_HAVE_FORTRAN
|
||||
CONDITION HAVE_FORTRAN
|
||||
LINKER_LANGUAGE Fortran
|
||||
LIBS eccodes_f90 eccodes
|
||||
)
|
||||
ecbuild_add_executable( TARGET f_set_gvc
|
||||
NOINSTALL
|
||||
SOURCES set_gvc.f90
|
||||
CONDITION EC_HAVE_FORTRAN
|
||||
CONDITION HAVE_FORTRAN
|
||||
LINKER_LANGUAGE Fortran
|
||||
LIBS eccodes_f90 eccodes
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if( EC_HAVE_FORTRAN )
|
||||
if( HAVE_FORTRAN )
|
||||
|
||||
set( srcdir ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
set( bindir ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
|
|
|
@ -18,9 +18,9 @@ if( HAVE_PYTHON )
|
|||
|
||||
set(PYTHON_DEST "${INSTALL_LIB_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/eccodes" )
|
||||
|
||||
file( RELATIVE_PATH relative_rpath "${CMAKE_INSTALL_PREFIX}/${PYTHON_DEST}" "${${PNAME}_FULL_INSTALL_LIB_DIR}" )
|
||||
file( RELATIVE_PATH relative_rpath "${CMAKE_INSTALL_PREFIX}/${PYTHON_DEST}" "${${PNAME}_FULL_INSTALL_LIB_DIR}" )
|
||||
|
||||
# debug_var( relative_rpath )
|
||||
# debug_var( relative_rpath )
|
||||
|
||||
ecbuild_append_to_rpath( ${relative_rpath} )
|
||||
ecbuild_append_to_rpath( "../../lib" ) # for ctest to find the libs
|
||||
|
|
|
@ -13,5 +13,5 @@ set( ECCODES_SAMPLES_FILES ${ECCODES_SAMPLES_FILES} PARENT_SCOPE )
|
|||
|
||||
# copy the samples to the build directory
|
||||
|
||||
file( COPY ${samples_files}
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/samples )
|
||||
file( COPY ${samples_files}
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/samples )
|
||||
|
|
Loading…
Reference in New Issue