-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
103 lines (82 loc) · 3.52 KB
/
CMakeLists.txt
File metadata and controls
103 lines (82 loc) · 3.52 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# (C) Copyright 2023- ECMWF.
#
# 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.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
cmake_minimum_required( VERSION 3.16 FATAL_ERROR )
find_package( ecbuild 3.5 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild)
project( plume LANGUAGES CXX )
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
############################################################################################
### dependencies and options
ecbuild_find_package( NAME eckit VERSION 1.28.5 REQUIRED )
ecbuild_find_package( NAME atlas )
ecbuild_add_option( FEATURE BUILD_TOOLS
DEFAULT ON
DESCRIPTION "Build the command line tools" )
ecbuild_add_option( FEATURE FORTRAN
DESCRIPTION "Provide Fortran bindings" )
if(HAVE_FORTRAN)
ecbuild_enable_fortran( REQUIRED MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/module )
endif()
############## FCKIT
ecbuild_add_option( FEATURE FCKIT
DEFAULT ON
DESCRIPTION "Support for fckit"
REQUIRED_PACKAGES fckit)
############## MPI
ecbuild_add_option(DEFAULT OFF
FEATURE MPI
DESCRIPTION "Use system MPI libraries"
REQUIRED_PACKAGES "MPI COMPONENTS CXX C" )
ecbuild_info("FCKIT_FOUND ${fckit_FOUND}")
ecbuild_info("FCKIT_LIBRARIES ${FCKIT_LIBRARIES}")
ecbuild_info("FCKIT_INCLUDE_DIRS ${FCKIT_INCLUDE_DIRS}")
############## NWP EMULATOR PRECISION & ENABLING
ecbuild_add_option( FEATURE NWP_EMULATOR
DEFAULT ON
DESCRIPTION "Compile the NWP emulator"
REQUIRED_PACKAGES eccodes )
if (HAVE_NWP_EMULATOR)
ecbuild_add_option( FEATURE NWP_EMULATOR_SINGLE_PRECISION
DESCRIPTION
"Compile nwp emulator for single precision fields"
DEFAULT OFF)
ecbuild_add_option( FEATURE NWP_EMULATOR_DOUBLE_PRECISION
DESCRIPTION
"Compile nwp emulator for double precision fields"
DEFAULT ON)
set( HAVE_NWP_EMULATOR_sp 0)
set( HAVE_NWP_EMULATOR_dp 0)
if (HAVE_SINGLE_PRECISION OR HAVE_NWP_EMULATOR_SINGLE_PRECISION)
set( NWP_EMULATOR_DEFINITIONS_sp WITH_NWP_EMULATOR_SINGLE_PRECISION )
set( HAVE_NWP_EMULATOR_sp 1)
endif()
if (HAVE_NWP_EMULATOR_DOUBLE_PRECISION)
set( NWP_EMULATOR_DEFINITIONS_dp WITH_NWP_EMULATOR_DOUBLE_PRECISION )
set( HAVE_NWP_EMULATOR_dp 1)
endif()
endif()
############################################################################################
add_subdirectory( src )
add_subdirectory( tests )
add_subdirectory( examples )
# copy cmake plugin interface macro into binary directory
file(
COPY
${CMAKE_CURRENT_SOURCE_DIR}/cmake/plume-plugin-interface.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/fortran_plugin.h.in
${CMAKE_CURRENT_SOURCE_DIR}/cmake/fortran_plugin.cc.in
${CMAKE_CURRENT_SOURCE_DIR}/cmake/fortran_plugin.F90.in
DESTINATION
${PROJECT_BINARY_DIR}/cmake
)
# cmake macro for fortran interface plugins
set(plume_INTERFACE_PLUGIN_CMAKE_FILE ${PROJECT_BINARY_DIR}/cmake/plume-plugin-interface.cmake)
# finalize
ecbuild_install_project( NAME ${PROJECT_NAME} )
ecbuild_print_summary()