-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
78 lines (57 loc) · 2.82 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# (C) Copyright 2022 .
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
cmake_minimum_required( VERSION 3.12)
project( imsproc VERSION 2022.10 LANGUAGES Fortran )
# ecbuild integration
find_package(ecbuild 3.3.2 REQUIRED)
include( ecbuild_system NO_POLICY_SCOPE )
ecbuild_declare_project()
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include( imsproc_compiler_flags )
################################################################################
# Dependencies
################################################################################
find_package(OpenMP COMPONENTS C Fortran)
find_package(MPI REQUIRED COMPONENTS C Fortran)
find_package(NetCDF REQUIRED COMPONENTS Fortran )
################################################################################
# Sources
################################################################################
#add_definitions ( -DCPP=0 )
set( IMSPROC_LINKER_LANGUAGE Fortran )
list ( APPEND sorc_files
./sorc/IMSaggregate_mod.f90
)
ecbuild_add_library( TARGET imsproc
SOURCES ${sorc_files}
INSTALL_HEADERS LISTED
LINKER_LANGUAGE ${IMSPROC_LINKER_LANGUAGE}
)
target_link_libraries(imsproc PUBLIC NetCDF::NetCDF_Fortran)
target_link_libraries(imsproc PUBLIC MPI::MPI_Fortran)
target_link_libraries(imsproc PUBLIC OpenMP::OpenMP_C OpenMP::OpenMP_Fortran)
#target_compile_options(imsproc PRIVATE -r8 -init=huge -cpp, -DCCPP=.false. )
# Fortran module output directory for build and install interfaces
set(MODULE_DIR module/${PROJECT_NAME}/${CMAKE_Fortran_COMPILER_ID}/${CMAKE_Fortran_COMPILER_VERSION})
set_target_properties(${PROJECT_NAME} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/${MODULE_DIR})
install(DIRECTORY ${CMAKE_BINARY_DIR}/${MODULE_DIR}/ DESTINATION ${MODULE_DIR})
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/${MODULE_DIR}>
$<INSTALL_INTERFACE:${MODULE_DIR}>)
set( IMSPROC_INCLUDE_DIRS ${CMAKE_Fortran_MODULE_DIRECTORY} )
set( IMSPROC_LIBRARIES imsproc )
# calcfIMS.exe executable
#-------------------------------------------------------------------------------
set ( exe_files ./sorc/driver_fIMS.f90 )
ecbuild_add_executable( TARGET calcfIMS.exe
SOURCES ${exe_files}
LIBS imsproc
LINKER_LANGUAGE ${IMSPROC_LINKER_LANGUAGE}
)
################################################################################
# Finalise configuration
################################################################################
ecbuild_install_project( NAME imsproc )
ecbuild_print_summary()