Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
114 lines (94 loc) · 4.1 KB
/
Copy pathCMakeLists.txt
File metadata and controls
114 lines (94 loc) · 4.1 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
#
# (C) Copyright 2017-2022 UCAR.
#
# 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.
################################################################################
# IODA
################################################################################
cmake_minimum_required( VERSION 3.23 )
option(IODA_BUILD_OBSSPACE_FORTRAN "Build ObsSpace Fortran bindings (src/, src/core/)." ON)
option(IODA_BUILD_ENGINES_FORTRAN "Build ioda-engines Fortran bindings (src/engines/)." OFF)
list( APPEND IODA_LANGUAGES CXX)
if (IODA_BUILD_OBSSPACE_FORTRAN OR IODA_BUILD_ENGINES_FORTRAN)
list( APPEND IODA_LANGUAGES Fortran)
endif()
project( ioda VERSION 2.12.0 LANGUAGES ${IODA_LANGUAGES} )
include( FeatureSummary )
option(OPENMP "Build ioda with OpenMP support" ON)
## Ecbuild integration
find_package( ecbuild QUIET )
include( ecbuild_system NO_POLICY_SCOPE )
ecbuild_declare_project()
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
set( CMAKE_DIRECTORY_LABELS ${PROJECT_NAME} )
## Configuration options
include( ${PROJECT_NAME}_compiler_flags )
option( ENABLE_IODA_DOC "Build IODA documentation" OFF )
## Dependencies
## Note: when updating these lists, please also update ioda-import.cmake.in.
# Required
if(OPENMP)
find_package( OpenMP COMPONENTS C CXX Fortran )
endif()
set(HDF5_PREFER_PARALLEL true) # CMake sometimes mistakenly finds a serial system-provided HDF5.
find_package( HDF5 REQUIRED COMPONENTS C HL )
find_package( MPI REQUIRED )
find_package( jedicmake REQUIRED )
find_package( NetCDF REQUIRED COMPONENTS C Fortran CXX ) # Prefer find NetCDF by jedicmake
find_package( eckit 1.23.0 REQUIRED )
find_package( fckit 0.10.1 REQUIRED )
find_package( oops REQUIRED )
find_package( Eigen3 REQUIRED NO_MODULE HINTS
$ENV{Eigen3_ROOT} $ENV{EIGEN3_ROOT} $ENV{Eigen_ROOT} $ENV{EIGEN_ROOT}
$ENV{Eigen3_PATH} $ENV{EIGEN3_PATH} $ENV{Eigen_PATH} $ENV{EIGEN_PATH} )
find_package( gsl-lite REQUIRED HINTS $ENV{gsl_lite_DIR} )
find_package( udunits 2.2.0 REQUIRED )
find_package( Boost 1.64.0 REQUIRED )
# Optional
find_package( odc 1.4.6 QUIET ) # Needed for odb backend
find_package( bufr_query 0.0.4 QUIET ) # Needed for bufr backend
find_package( bufr 12.0.1 QUIET ) # Needed for bufr backend
# Python-finding settings
set(Python3_FIND_REGISTRY "LAST")
set(Python3_FIND_FRAMEWORK "LAST")
find_package( Python3 COMPONENTS Interpreter Development)
find_package( pybind11 QUIET)
if (pybind11_FOUND)
option(BUILD_PYTHON_BINDINGS "Build Python bindings using pybind11?" ON)
else()
option(BUILD_PYTHON_BINDINGS "Build Python bindings using pybind11?" OFF)
endif()
add_feature_info(Python BUILD_PYTHON_BINDINGS "Build Python bindings using pybind11")
## Sources
add_subdirectory( share ) # no arch data
add_subdirectory( src/engines ) # `ioda_engines` target
add_subdirectory( src ) # `ioda` target
add_subdirectory( src/mains ) # ioda executable targets
if ( Python3_FOUND )
add_subdirectory( src/python ) # ioda python targets
endif()
add_subdirectory( tools ) # misc tools
if( ENABLE_IODA_DOC )
add_subdirectory( docs )
endif()
if( BUILD_TESTING )
find_package( ioda-data QUIET )
if( NOT ioda-data_FOUND )
# Set values for downloading ioda test data from tarball
set( ioda_data_download_url "https://bin.ssec.wisc.edu/pub/s4/CRTM/file" )
set( ioda_data_tag "2.9.0" )
set( ioda_data_tarball_name "ioda_testinput_tier_1_${ioda_data_tag}.tar.gz" )
set( ioda_data_tarball_hash "94fc90a04f6587b9a07607dfadb04d94" )
endif()
add_subdirectory( test ) # ioda ctests
ecbuild_add_test( TARGET ${PROJECT_NAME}_coding_norms
TYPE SCRIPT
COMMAND ${PROJECT_NAME}_cpplint.py
ARGS --quiet --recursive ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/test
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
set_tests_properties( ${PROJECT_NAME}_coding_norms PROPERTIES TIMEOUT 90 )
endif()
## Package Config
ecbuild_install_project( NAME ${PROJECT_NAME} )
ecbuild_print_summary()