forked from ecmwf/metkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
147 lines (105 loc) · 4.69 KB
/
Copy pathCMakeLists.txt
File metadata and controls
147 lines (105 loc) · 4.69 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# (C) Copyright 2011- 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.18 FATAL_ERROR )
find_package( ecbuild 3.12 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild)
project( metkit LANGUAGES CXX C )
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
########################################################################################################################
### dependencies and options
if(NOT METKIT_CONFIGS_BRANCH)
set(METKIT_CONFIGS_BRANCH chk)
endif()
# eckit
set( PERSISTENT_NAMESPACE "eckit" CACHE INTERNAL "" ) # needed for generating .b files for persistent support
ecbuild_find_package( NAME eckit VERSION 1.32 REQUIRED )
ecbuild_add_option( FEATURE BUILD_TOOLS
DEFAULT ON
DESCRIPTION "Build the command line tools" )
ecbuild_add_option( FEATURE BUILD_GRIB2_TOOLS
DEFAULT OFF
DESCRIPTION "Build the command line tools to support the migration to Grib2" )
ecbuild_add_option( FEATURE EXPERIMENTAL
DEFAULT OFF
DESCRIPTION "Experimental features" )
# GRIB support
ecbuild_add_option( FEATURE GRIB
DEFAULT ON
DESCRIPTION "Add support for GRIB format"
REQUIRED_PACKAGES "NAME eccodes VERSION 2.46" )
# BUFR support
ecbuild_add_option( FEATURE BUFR
DEFAULT ON
DESCRIPTION "Add support for BUFR format"
REQUIRED_PACKAGES "NAME eccodes VERSION 2.46" )
# netcdf support
ecbuild_add_option( FEATURE NETCDF
DEFAULT ON
DESCRIPTION "Support for NetCDF data"
REQUIRED_PACKAGES NetCDF
)
# ODB support
ecbuild_add_option( FEATURE ODB
DEFAULT ON
DESCRIPTION "Add support for ODB data"
REQUIRED_PACKAGES "NAME odc VERSION 1.0" )
# MARS2GRIB encoder
ecbuild_add_option( FEATURE GRIB2MARS
DEFAULT ON
DESCRIPTION "Build the GRIB2MARS converter" )
ecbuild_add_option( FEATURE MARS2MARS
DEFAULT ON
DESCRIPTION "Build the convert-to-grib2 MarsRequest converter" )
ecbuild_add_option( FEATURE MARS2GRIB
DEFAULT ON
CONDITION HAVE_GRIB AND eckit_HAVE_ECKIT_GEO
DESCRIPTION "Build the MARS2GRIB encoder" )
# Python bindings for mars2grib encoder
ecbuild_add_option( FEATURE MARS2GRIB_PYTHON
DEFAULT OFF
CONDITION HAVE_MARS2GRIB
DESCRIPTION "Build mars2grib python library"
REQUIRED_PACKAGES
"NAME Python VERSION 3.11 COMPONENTS Interpreter Development"
"NAME pybind11 VERSION 3.0.1" )
# Pythonic pybind11 interface (pymetkit)
ecbuild_add_option( FEATURE PYTHON_METKIT_INTERFACE
DEFAULT OFF
DESCRIPTION "Build the pybind11 pymetkit interface"
REQUIRED_PACKAGES
"NAME Python VERSION 3.11 COMPONENTS Interpreter Development"
"NAME pybind11 VERSION 3.0.1" )
# METKIT config files support
ecbuild_add_option( FEATURE METKIT_CONFIG
DEFAULT ON
DESCRIPTION "Install metkit configuration files" )
# Temporary
ecbuild_add_option( FEATURE FAIL_ON_CCSDS
DESCRIPTION "Fail on CCSDS"
DEFAULT OFF )
### Documentation
ecbuild_add_option( FEATURE METKIT_DOCUMENTATION
DEFAULT OFF
DESCRIPTION "Enable documentation generation" )
############################################################################################
# sources
include(cmake/compiler_warnings.cmake) # optionally handle compiler specific warnings
add_subdirectory( src )
add_subdirectory( share )
add_subdirectory( tests )
if(ENABLE_METKIT_DOCUMENTATION)
add_subdirectory(docs)
endif()
############################################################################################
# finalize
ecbuild_pkgconfig( NAME metkit
DESCRIPTION "ECMWF Meteorological toolkit"
LIBRARIES metkit )
ecbuild_install_project( NAME ${PROJECT_NAME} )
ecbuild_print_summary()