-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathCMakeLists.txt
222 lines (202 loc) · 7.92 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#------------------------------------------------------------------------------
# The MB-system: CMakeLists.txt 27 June 2023
#
# Copyright (c) 2023-2024 by
# David W. Caress ([email protected])
# Monterey Bay Aquarium Research Institute
# Moss Landing, California, USA
# Dale N. Chayes
# Center for Coastal and Ocean Mapping
# University of New Hampshire
# Durham, New Hampshire, USA
# Christian dos Santos Ferreira
# MARUM
# University of Bremen
# Bremen Germany
#
# MB-System was created by Caress and Chayes in 1992 at the
# Lamont-Doherty Earth Observatory
# Columbia University
# Palisades, NY 10964
#
# See README.md file for copying and redistribution conditions.
#------------------------------------------------------------------------------
#
# To build MB-System from source using CMake do (example):
#
# mkdir build
# cd build
# cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
#
# CMAKE_BUILD_TYPE can be: empty, Debug, Release, RelWithDebInfo or MinSizeRel
#
#------------------------------------------------------------------------------
message("----------------------------------------------------------")
message("MB-System")
message("CMake Build System")
message("David Caress (Monterey Bay Aquarium Research Institute)")
message("Johannes Schauer (University of Weurzburg)")
message("Tom O'Reilly (Monterey Bay Aquarium Research Institute)")
message("----------------------------------------------------------")
message("CMake version: ${CMAKE_VERSION}")
message("Set install directory using -DCMAKE_INSTALL_PREFIX=directory (default is /usr/local)")
message("The default build mode is release (optimized for performance, not debuggable).")
message("Enable debugging with -DCMAKE_BUILD_TYPE=Debug")
message("Build shared/static libraries with -DBUILD_SHARED_LIBS=ON/OFF")
message("Disable building TRN software with -DbuildTRN=OFF")
message("Disable building photomosaicing software with -DbuildOpenCV=OFF")
message("Disable supporting GSF format data with -DbuildGSF=OFF")
message("Build Qt-based GUIs with -DbuildQt=ON")
message("Build deprecated programs with -DbuildDeprecated=ON")
message("Disable unit tests with -DbuildTests=OFF (run unit tests with make test)")
message("Specify OTPS install location with -DotpsDir=directory")
message("Print out all CMake variables with -Dverbose=1")
message("----------------------------------------------------------")
# Define minimum CMake version required
cmake_minimum_required(VERSION 3.16)
# Define project
project(MB-System
DESCRIPTION "Open Source software for the processing and display of seafloor mapping data"
HOMEPAGE_URL https://www.mbari.org/technology/mb-system/
LANGUAGES C CXX )
# Disallow in-source builds
get_filename_component (srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component (bindir "${CMAKE_BINARY_DIR}" REALPATH)
if (${srcdir} STREQUAL ${bindir})
message(FATAL_ERROR "In-source builds are not allowed. "
"Please create a directory and run cmake from there, passing the path "
"to this source directory as the last argument. This process created "
"the file `CMakeCache.txt' and the directory `CMakeFiles' in ${srcdir}. "
"Please remove them.")
endif (${srcdir} STREQUAL ${bindir})
add_compile_definitions(CMAKE_BUILD_SYSTEM=1)
if (CMAKE_C_BYTE_ORDER STREQUAL "LITTLE_ENDIAN")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBYTESWAPPED")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBYTESWAPPED")
endif()
option(buildGSF "build GSF library" ON)
option(buildGUIs "build graphical tools" ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build-utils")
option(BUILD_SHARED_LIBS "Build and link with shared libraries" ON)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_MACOSX_RPATH ON)
option(buildGSF "build GSF library" ON)
option(buildGUIs "build graphical tools" ON)
option(buildOpenCV "build OpenCV tools" ON)
option(buildTRN "build MBTRN tools" ON)
option(buildTRNLCM "build MBTRN LCM tools" OFF)
option(buildTrnNoRand "build with TRN_NORAND (random seed disabled)" OFF)
option(buildPCL "build point-cloud-library" OFF)
option(buildQt "build Qt tools" OFF)
option(buildTests "build unit tests exercised by make test" ON)
if (DEFINED CACHE{otpsDir})
set(otpsDir $CACHE{otpsDir})
else()
set(otpsDir "/usr/local/src/otps")
endif()
set(CMAKE_INSTALL_SHARE share)
set(CMAKE_INSTALL_MANPAGES share/man)
set(CMAKE_INSTALL_DOC share/doc)
set(levitusDir "share/mbsystem")
include(GNUInstallDirs)
include(CTest)
# uninstall target
if(NOT TARGET uninstall)
add_custom_target(uninstall COMMAND xargs rm -vf < install_manifest.txt)
endif()
# Libraries
if(buildGSF)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_GSF")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_GSF")
add_subdirectory(src/gsf)
endif()
add_subdirectory(src/mbaux)
add_subdirectory(src/mbio)
add_subdirectory(src/bsio)
add_subdirectory(src/surf)
# GMT modules
add_subdirectory(src/gmt)
# Executables
add_subdirectory(src/utilities)
add_subdirectory(src/macros)
add_subdirectory(src/mbgrd2gltf)
add_subdirectory(src/otps)
if(buildGUIs)
add_subdirectory(src/mbview)
add_subdirectory(src/mbedit)
add_subdirectory(src/mbgrdviz)
add_subdirectory(src/mbeditviz)
add_subdirectory(src/mbnavadjust)
add_subdirectory(src/mbnavedit)
add_subdirectory(src/mbvelocitytool)
endif()
if(buildOpenCV)
add_subdirectory(src/photo)
endif()
if(buildTRN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTRN_USE_PROJ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTRN_USE_PROJ")
add_subdirectory(src/mbtrnframe)
add_subdirectory(src/mbtrn)
add_subdirectory(src/mbtrnav)
add_subdirectory(src/mbtrnutils)
if(buildTRNLCM)
add_subdirectory(src/mbtrnav/opt/rov)
endif()
endif()
if(buildQt)
add_subdirectory(src/qt-guilib)
add_subdirectory(src/qt-mbgrdviz)
add_subdirectory(src/qt-mbgrdviz-3)
endif()
if(buildDeprecated)
add_subdirectory(src/deprecated)
endif()
if(buildTests)
add_subdirectory(third_party)
add_subdirectory(test/mbio)
add_subdirectory(test/utilities)
if(buildDeprecated)
add_subdirectory(test/deprecated)
endif()
endif()
add_subdirectory(src/man)
add_subdirectory(src/html)
add_subdirectory(src/share)
message("----------------------------------------------------------")
message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
message("CMAKE_C_COMPILER_ID: ${CMAKE_C_COMPILER_ID}")
message("CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
message("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
message("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message("CMAKE_INSTALL_FULL_LIBDIR: ${CMAKE_INSTALL_FULL_LIBDIR}")
message("CMAKE_INSTALL_FULL_INCLUDEDIR: ${CMAKE_INSTALL_FULL_INCLUDEDIR}")
message("CMAKE_INSTALL_FULL_BINDIR: ${CMAKE_INSTALL_FULL_BINDIR}")
message("CMAKE_INSTALL_FULL_DOCDIR: ${CMAKE_INSTALL_FULL_DOCDIR}")
message("CMAKE_INSTALL_FULL_DATADIR: ${CMAKE_INSTALL_FULL_DATADIR}")
message("CMAKE_INSTALL_FULL_DATAROOTDIR: ${CMAKE_INSTALL_FULL_DATAROOTDIR}")
message("CMAKE_SYSTEM_PREFIX_PATH: ${CMAKE_SYSTEM_PREFIX_PATH}")
message("CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES: ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
message("CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
message("BYTESWAPPED: ${BYTESWAPPED}")
message("CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message("CMAKE_INSTALL_RPATH: ${CMAKE_INSTALL_RPATH}")
message("CMAKE_MACOSX_RPATH: ${CMAKE_MACOSX_RPATH}")
message(OTPS directory: ${otpsDir})
# For debugging: print all set variables
message("----------------------------------------------------------")
if (verbose)
message("All CMake variables:")
message(" ")
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
message("----------------------------------------------------------")
endif()