-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
139 lines (110 loc) · 5.24 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
# ######################################################################################################################
# CMake Build File for ADCIRC(+SWAN)
#
# Written By: Zach Cobell
#
# ######################################################################################################################
#
# The CMake build system enable ADCIRC (and SWAN) to be deployed and built in a cross platform environment.
#
# ######################################################################################################################
# ...Set the default build type
if(DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE
${CMAKE_BUILD_TYPE}
CACHE STRING "Choose the type of
build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug
Release RelWithDebInfo MinSizeRel.")
else()
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Choose the type of build,
options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release
RelWithDebInfo MinSizeRel.")
endif()
# ######################################################################################################################
# GENERAL OPTIONS
# ######################################################################################################################
cmake_minimum_required(VERSION 2.8.12)
project(adcirc)
# ######################################################################################################################
# ######################################################################################################################
# COMPILERS/LANGUAGE
# ######################################################################################################################
# ######################################################################################################################
# ...Perl Perl is required to use SWAN since it generates the source files. All SWAN options will be disabled if perl
# cannot be found. The user is given a chance to specify its location
find_program(PERL perl)
if(${PERL} STREQUAL "PERL-NOTFOUND")
set(PERL_FOUND FALSE)
else()
set(PERL_FOUND TRUE)
endif()
# ######################################################################################################################
# ######################################################################################################################
# ...Language Specifications
enable_language(Fortran)
enable_language(C)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
# ######################################################################################################################
# ######################################################################################################################
# ...Put the static libraries in the CMakeFiles folder so they don't contaminate the build directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles)
# ######################################################################################################################
# ...Set the version string (used for libraries)
set(ADCIRC_VERSION_MAJOR 56)
set(ADCIRC_VERSION_MINOR 0)
set(ADCIRC_VERSION_PATCH 0)
set(ADCIRC_VERSION_STRING ${ADCIRC_VERSION_MAJOR}.${ADCIRC_VERSION_MINOR}.${ADCIRC_VERSION_PATCH})
# ...Include Macros to build components
include(${CMAKE_SOURCE_DIR}/cmake/macros.cmake)
# ...Determine architecture specific parameters
include(${CMAKE_SOURCE_DIR}/cmake/architecture.cmake)
# ...Generate the selection list of options
include(${CMAKE_SOURCE_DIR}/cmake/options_select.cmake)
# ...Translate the selected options list into compiler flags
include(${CMAKE_SOURCE_DIR}/cmake/options_flags.cmake)
# ...Ensure that the netCDF libraries are working
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(${CMAKE_SOURCE_DIR}/cmake/netcdf_check.cmake)
if(ENABLE_GRIB2)
set(JAS_ENABLE_SHARED
FALSE
CACHE BOOL "Enable shared JAS")
set(ENABLE_DATETIME
TRUE
CACHE BOOL "Enable datetime library")
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/wgrib2 EXCLUDE_FROM_ALL)
endif()
if(ENABLE_DATETIME)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/datetime_fortran EXCLUDE_FROM_ALL)
endif()
# ...Ensure that the XDMF libraries are working
include(${CMAKE_SOURCE_DIR}/cmake/xdmf_check.cmake)
# ...Build the version module
include(${CMAKE_SOURCE_DIR}/cmake/version.cmake)
# ...Build the mkdir library
include(${CMAKE_SOURCE_DIR}/cmake/mkdir.cmake)
# ...Build ADCIRC
include(${CMAKE_SOURCE_DIR}/cmake/adcirc.cmake)
# ...Build METIS
include(${CMAKE_SOURCE_DIR}/cmake/metis.cmake)
# ...Build ADCPREP
include(${CMAKE_SOURCE_DIR}/cmake/adcprep.cmake)
# ...Build ADCSWAN (Serial ADCIRC+SWAN)
include(${CMAKE_SOURCE_DIR}/cmake/adcswan.cmake)
# ...Build SWAN (Serial structured SWAN)
include(${CMAKE_SOURCE_DIR}/cmake/swan.cmake)
# ...Build PADCIRC (Parallel ADCIRC)
include(${CMAKE_SOURCE_DIR}/cmake/padcirc.cmake)
# ...Build PADCSWAN (Parallel ADCIRC+SWAN)
include(${CMAKE_SOURCE_DIR}/cmake/padcswan.cmake)
# ...Build PUNSWAN (Parallel Unstructured SWAN)
include(${CMAKE_SOURCE_DIR}/cmake/punswan.cmake)
# ...Build ASWIP
include(${CMAKE_SOURCE_DIR}/cmake/aswip.cmake)
# ...Build ADCIRC Utility Codes
include(${CMAKE_SOURCE_DIR}/cmake/utilities.cmake)
# ...Build LIBADC
include(${CMAKE_SOURCE_DIR}/cmake/libadcirc.cmake)