set(library_name flow2d3d_data) # Define include directories get_module_include_path(${checkout_src_root}/${deltares_common_module} ${library_name} deltares_common_include_path) get_module_include_path(${checkout_src_root}/${delftio_module} ${library_name} delftio_include_path) get_module_include_path(${checkout_src_root}/${esmfsm_module} ${library_name} esmfsm_module_include_path) message(STATUS "Configuring '${library_name}' with the following deltares_common include path: '${deltares_common_include_path}'") message(STATUS "Configuring '${library_name}' with the following delftio include path: '${delftio_include_path}'") message(STATUS "Configuring '${library_name}' with the following esmfsm include path: '${esmfsm_module_include_path}'") # Note that the CMAKE_CURRENT_SOURCE_DIR has a path to THIS CMakeLists location set(include_path ${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories(${include_path} ${mpi_include_path} ${deltares_common_include_path} ${delftio_include_path} ${esmfsm_module_include_path} ${morphology_kernel_module_include_path}) # Set public include path to make it accessible for other components set(public_include_path ${include_path}) # Set directory which contains all source files set(src_path src) # Gather include files file(GLOB include_files ${include_path}/*.igs ${include_path}/*.igd) if (UNIX) #name mangling, these functions are generated by the FortranCInterface cmake package and might be system dependent include(FortranCInterface) FortranCInterface_HEADER("${CMAKE_CURRENT_SOURCE_DIR}/include/FortranCInterface.h" MACRO_NAMESPACE "FC_") #produce a config.h to be included configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h) set(configFile "${CMAKE_CURRENT_SOURCE_DIR}/include/config.h") include_directories(${NETCDF_INCLUDEDIR}) add_definitions(-DHAVE_CONFIG_H) endif(UNIX) # Gather source files get_fortran_source_files(${src_path}/allocation allocation_files) get_fortran_source_files(${src_path}/basics basics_files) get_fortran_source_files(${src_path}/gdp gdp_files) get_fortran_source_files(${src_path}/general general_files) get_fortran_source_files(${src_path}/parallel_mpi parallel_mpi_files) # Define library add_library(${library_name} ${include_files} ${allocation_files} ${basics_files} ${gdp_files} ${general_files} ${parallel_mpi_files}) # Set additional compilation properties set_source_files_properties( ${parallel_mpi_files} PROPERTIES COMPILE_OPTIONS "${file_preprocessor_flag}") # Set dependencies set(oss_dependencies_general delftio delftio_shm deltares_common deltares_common_c deltares_common_mpi ec_module gridgeom io_netcdf kdtree2 kdtree_wrapper morphology_data morphology_kernel morphology_plugins_c) # Add dependencies if (UNIX) # the `pkg_check_modules` function is created with this call find_package(PkgConfig REQUIRED) # these calls create special `PkgConfig::` variables pkg_check_modules(NETCDF REQUIRED IMPORTED_TARGET netcdf) pkg_check_modules(NETCDF_FTN REQUIRED IMPORTED_TARGET netcdf-fortran) set(oss_dependencies ${oss_dependencies_general}) target_link_libraries(${library_name} ${oss_dependencies} PkgConfig::NETCDF PkgConfig::NETCDF_FTN) add_definitions(-DHAVE_CONFIG_H) endif(UNIX) if (WIN32) set(oss_dependencies ${oss_dependencies_general} netcdf4 netcdff) target_link_libraries(${library_name} ${oss_dependencies}) endif(WIN32) oss_include_libraries(${library_name} oss_dependencies) if(UNIX) target_link_libraries(${library_name} ${oss_dependencies}) endif() # Define how the files should be structured within Visual Studio source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${include_files} ${allocation_files} ${basics_files} ${gdp_files} ${general_files} ${parallel_mpi_files}) set_target_properties (${library_name} PROPERTIES FOLDER engines_gpl/flow2d3d) # Change project flags at the end of this file target_compile_options(${library_name} PRIVATE "${qauto_threaded_flags}") target_compile_options(${library_name} PRIVATE "$<$:${check_nobounds_flag}>")