Newer
Older
cmake_minimum_required(VERSION 3.19)
option(USE_CONFIG_PARSER "Build config parser" OFF)
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYGEN_IN ../doxygen/config) # doxygen config file
# option ALL allows to build the docs together with the code
add_custom_target( doc_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_IN}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) # WORKING_DIRECTORY: Execute the command with the given current working directory. If it is a relative path it will be interpreted relative to the build tree directory corresponding to the current source directory.
else()
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
endif(BUILD_DOC)
if (SFX_CHECK_NAN)
add_definitions(-DSFX_CHECK_NAN)
endif ()
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/modules)
if(USE_CONFIG_PARSER)
add_subdirectory(parser/)
add_definitions(-DUSE_CONFIG_PARSER)
# list(APPEND RUN_MACRO -DUSE_CONFIG_PARSER)
set(USE_CXX ON)
endif(USE_CONFIG_PARSER)
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
message(FATAL_ERROR "
CMake will not pass any architecture flags to the compiler
because the CUDA architecture is not set. You should specify
an architecture: set -DCMAKE_CUDA_ARCHITECTURES=<N>.")
endif(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
add_definitions(-DINCLUDE_CUDA)
set(USE_CXX ON)
enable_language(C)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
add_definitions(-DINCLUDE_CXX)
# list(APPEND RUN_MACRO -DINCLUDE_CXX)
endif(USE_CXX)
srcF/sfx_config.f90
srcF/sfx_esm.f90
srcF/sfx_esm_param.f90
srcF/sfx_log.f90
srcF/sfx_log_param.f90
srcF/sfx_main.f90
srcF/sfx_phys_const.f90
srcF/sfx_surface.f90
srcF/sfx_most.f90
srcF/sfx_most_param.f90
srcF/sfx_sheba.f90
srcF/sfx_sheba_param.f90
srcF/parser_subfunctions.f90
includeCU/sfx_surface.cuh
includeCU/sfx_math.cuh
includeCU/sfx_esm_compute_subfunc.cuh
includeCXX/sfx_esm.h
includeCXX/sfx_sheba.h
includeCXX/sfx_compute_sheba.h
includeCXX/sfx_memory_processing.h
includeCXX/sfx_template_parameters.h
set(SOURCES ${MEMPROC_HEADERS_CU} ${MEMPROC_SOURCES_CU} ${MEMPROC_HEADERS_CXX} ${MEMPROC_SOURCES_CXX} ${HEADERS_CU} ${SOURCES_CU} ${HEADERS_C} ${HEADERS_CXX} ${SOURCES_CXX} ${SOURCES_C} ${HEADERS_F} ${SOURCES_F})
set(CMAKE_Fortran_FLAGS " -g -fbacktrace -ffpe-trap=zero,overflow,underflow -cpp ")
set(CMAKE_CXX_FLAGS " -g -Wunused-variable ")
set(CMAKE_C_FLAGS " -g ")
add_executable(sfx ${SOURCES})
set_property(TARGET sfx PROPERTY LINKER_LANGUAGE Fortran)
target_include_directories(sfx PUBLIC ${CMAKE_BINARY_DIR}/modules/)
if(USE_CONFIG_PARSER)
endif(USE_CONFIG_PARSER)