forked from mankoff/icebin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
195 lines (158 loc) · 4.9 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
cmake_minimum_required(VERSION 3.1)
project (GLINT2)
enable_language(Fortran)
set(CMAKE_CXX_STANDARD 11)
list (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (setup_rpath)
message("TRANSITIVE $ENV{SPACK_TRANSITIVE_INCLUDE_PATH}")
include_directories($ENV{SPACK_TRANSITIVE_INCLUDE_PATH})
# ------- Process Configure Options
if (NOT DEFINED BUILD_PYTHON)
set(BUILD_PYTHON NO)
endif()
if (NOT DEFINED BUILD_DOCS)
set(BUILD_DOCS NO)
endif()
# Doesn't build docs anyway
if (NOT DEFINED BUILD_GRIDGEN)
set(BUILD_GRIDGEN YES)
endif()
if (BUILD_GRIDGEN)
find_package(CGAL REQUIRED)
find_package(GMP REQUIRED)
find_package(MPFR REQUIRED)
list(APPEND EXTERNAL_LIBS ${CGAL_LIBRARY} ${GMP_LIBRARY} ${MPFR_LIBRARIES})
list(APPEND Boost_COMPONENTS thread system program_options mpi serialization )
include_directories(${CGAL_INCLUDE_DIR} ${GMP_INCLUDE_DIR} ${MPFR_INCLUDES})
add_definitions(-DBUILD_GRIDGEN)
endif()
if (NOT DEFINED BUILD_COUPLER)
set(BUILD_COUPLER YES)
endif()
if (BUILD_COUPLER)
find_package(MPI REQUIRED)
include_directories(${MPI_CXX_INCLUDE_PATH})
list(APPEND EXTERNAL_LIBS ${MPI_CXX_LIBRARIES})
if (NOT DEFINED USE_PISM)
set(USE_PISM NO)
endif()
if(USE_PISM)
find_package(PISM)
find_package(PETSc)
include_directories(
${PISM_INCLUDE_DIRS}
${PETSC_INCLUDES}
)
list(APPEND EXTERNAL_LIBS ${PETSC_LIBRARIES} ${PISM_LIBRARIES})
add_definitions(-DUSE_PISM)
endif()
add_definitions(-DBUILD_COUPLER)
endif()
if (NOT DEFINED BUILD_MODELE)
set(BUILD_MODELE NO)
endif()
if (BUILD_MODELE)
add_definitions(-DBUILD_MODELE)
list(APPEND Boost_COMPONENTS regex program_options)
endif()
if (NOT DEFINED BUILD_DOCS)
set(BUILD_DOCS YES)
endif()
find_package(Boost REQUIRED COMPONENTS ${Boost_COMPONENTS} filesystem date_time)
#find_package(Boost REQUIRED thread system log filesystem date_time)
include_directories(${Boost_INCLUDE_DIRS})
list(APPEND EXTERNAL_LIBS ${Boost_LIBRARIES})
# -------- Find Dependencies
# --- Everytrace
find_package(Everytrace REQUIRED)
add_definitions(-DUSE_EVERYTRACE)
include_directories(${EVERYTRACE_INCLUDE_DIR})
list(APPEND EXTERNAL_LIBS ${EVERYTRACE_LIBRARY})
# --- Blitz
find_package(Blitz REQUIRED)
add_definitions(-DUSE_BLITZ)
include_directories(${BLITZ_INCLUDE_DIR})
list(APPEND EXTERNAL_LIBS ${BLITZ_LIBRARY})
# --- NetCDF-CXX4
find_package(NetCDF_CXX4 REQUIRED)
add_definitions(-DUSE_NETCDF)
include_directories(${NETCDF_CXX4_INCLUDE_DIR})
list(APPEND EXTERNAL_LIBS ${NETCDF_CXX4_LIBRARY})
# --- IBMisc
find_package(Ibmisc REQUIRED)
list(APPEND EXTERNAL_LIBS ${IBMISC_LIBRARY})
include_directories(${IBMISC_INCLUDE_DIR})
find_package(ZLIB REQUIRED)
list(APPEND EXTERNAL_LIBS ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
# --- Proj.4
find_package(PROJ4 REQUIRED)
add_definitions(-DUSE_PROJ4)
include_directories(${PROJ4_INCLUDES})
list(APPEND EXTERNAL_LIBS ${PROJ4_LIBRARIES})
# --- Eigen
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
#find_package(GALAHAD REQUIRED) # This should be optional
#find_package(CGAL REQUIRED)
#find_package(MPFR REQUIRED) # Used by CGAL
#find_package(PROJ4)
#find_package(Boost COMPONENTS filesystem system date_time thread REQUIRED)
#find_package(UDUNITS2 REQUIRED)
## Used by dependencies
#find_package(GMP REQUIRED)
#find_package(GSL REQUIRED)
#find_package(FFTW REQUIRED)
#find_package(OpenMP REQUIRED) # Used by GALAHAD, but not in code we run. We are an MPI shop.
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
## Set Pism_EXTERNAL_LIBS and include directories.
#include_directories (
# ${EVERYTRACE_INCLUDE_DIR}
# ${PROJECT_SOURCE_DIR}/slib
# ${Boost_INCLUDE_DIRS}
# ${NETCDF_INCLUDES} ${NETCDF_INCLUDES_CXX} ${NETCDF_INCLUDES_F77}
# ${BLITZ++_INCLUDE_DIR}
# ${GMP_INCLUDE_DIR}
# ${CGAL_INCLUDE_DIR}
# ${FFTW_INCLUDE_DIRS}
# ${FFTW_INCLUDES}
# ${GSL_INCLUDES}
# ${UDUNITS2_INCLUDES}
# ${MPI_C_INCLUDE_PATH}
#
# ${GALAHAD_INCLUDE_DIRS}) # This should be optional
#list(APPEND EXTERNAL_LIBS
# ${EVERYTRACE_CF_LIBRARY}
# ${Boost_LIBRARIES}
# ${UDUNITS2_LIBRARIES}
# ${FFTW_LIBRARIES}
# ${GSL_LIBRARIES}
#
# ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES_CXX} ${NETCDF_LIBRARIES_C}
# ${MPI_C_LIBRARIES}
# ${GALAHAD_LIBRARIES}
# ${PROJ4_LIBRARIES}
# ${GMP_LIBRARY}
# ${CGAL_LIBRARY}
# ${MPFR_LIBRARIES}
#)
#
#if (${USE_PISM})
# list(APPEND EXTERNAL_LIBS
# ${PETSC_LIBRARIES}
# ${PISM_LIBRARIES}
# )
#endif()
# -------- Process subdirectories of the build
add_subdirectory(slib)
if (BUILD_MODELE)
add_subdirectory(modele) # Don't need this right now, but it is current
endif()
add_subdirectory(tests)
if (BUILD_GRIDGEN)
add_subdirectory(gridgen)
endif()
if(${BUILD_PYTHON})
add_subdirectory(pylib)
endif()