-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
162 lines (133 loc) · 5.62 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
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(ALUs
LANGUAGES CXX CUDA
DESCRIPTION "Parallel ALUs for geospatial data processing"
VERSION 1.6.0
)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# Exports compile commands used by clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Dependencies which should be installed on a host system and not included separately by this project.
find_package(CUDAToolkit 11.2 REQUIRED)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=-Wall")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=-Werror")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=-Wextra")
# To suppress using of cmath std::min and std::max.
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --Werror all-warnings")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")
# mapping executable GPU code to source code, only enable for testing/profiling
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -g -G")
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo")
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --resource-usage")
INCLUDE_DIRECTORIES(${CUDAToolkit_INCLUDE_DIRS})
if (NOT DEFINED ENV{CUDAARCHS})
message(STATUS "CUDAARCHS not set, defaulting")
set(CMAKE_CUDA_ARCHITECTURES 60 CACHE STRING "CUDA architectures" FORCE)
endif()
message(STATUS "CUDA binary code will be generated for the following architecture(s) - ${CMAKE_CUDA_ARCHITECTURES}")
find_package(Boost 1.71.0 REQUIRED COMPONENTS program_options date_time filesystem iostreams log log_setup)
find_package(GDAL REQUIRED)
include_directories(${GDAL_INCLUDE_DIRS})
find_package(Eigen3 REQUIRED)
set(ALUS_BINARY_OUTPUT_DIR ${PROJECT_BINARY_DIR}/alus_package)
set(ALUS_UNIT_TEST_BINARY_OUTPUT_DIR ${PROJECT_BINARY_DIR}/unit-test)
set(ALUS_LFS_INVOKE ${CMAKE_CURRENT_LIST_DIR}/.alus-lfs)
set(ALUS_LFS_GOODS ${CMAKE_CURRENT_LIST_DIR}/resources)
option(ENABLE_TESTS "Enable tests" OFF)
#external library as git submodule with separate CMakeLists.txt project
set(BUILD_TEST OFF CACHE BOOL "Build tests")
set(BUILD_STATIC_VERSION ON CACHE BOOL "Build static library")
set(BUILD_SHARED_VERSION OFF CACHE BOOL "Build shared library")
add_subdirectory(external/zipper)
# Project wide compilation directives.
# For specific ones make yourself acquainted with different CMake files of each algorithm/entity.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -pedantic -DBOOST_LOG_DYN_LINK")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "Setting GNU compiler specific flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=attributes")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
else ()
message(WARNING "Building the project may fail with not supported compiler - " ${CMAKE_CXX_COMPILER_ID})
endif ()
if (SONARCLOUD_BUILD)
# fix build errors with SonarCloud code scanner
# workaround for parser crash with boost::asio - SonarCFamily CPP-2696
message(STATUS "SonarCloud configuration")
add_compile_definitions(BOOST_ASIO_DISABLE_NOEXCEPT)
endif ()
# External libraries
add_subdirectory(external/pugixml)
# Utilities
add_subdirectory(util/gdal)
add_subdirectory(sentinel1)
add_subdirectory(util/exotic-operations)
add_subdirectory(util/common)
add_subdirectory(util/cuda)
add_subdirectory(util/dem)
add_subdirectory(util/math)
add_subdirectory(snap-engine)
# Algorithms
add_subdirectory(algs/coherence-cuda)
add_subdirectory(algs/range-doppler-terrain-correction)
add_subdirectory(algs/backgeocoding)
add_subdirectory(algs/apply-orbit-file-op)
add_subdirectory(algs/feature-extraction-gabor)
add_subdirectory(algs/sentinel1-calibrate)
add_subdirectory(algs/topsar-deburst-op)
add_subdirectory(algs/coherence-estimation-routine)
add_subdirectory(algs/coregistration)
add_subdirectory(algs/topsar-split)
add_subdirectory(algs/calibration-routine)
add_subdirectory(algs/resample)
add_subdirectory(algs/topsar-merge)
add_subdirectory(algs/thermal-noise-removal)
add_subdirectory(algs/palsar-focus)
# Test helpers
add_subdirectory(test/range-doppler-geocoding)
add_subdirectory(test/tie-point-grid)
add_subdirectory(test/sar-geocoding)
# Main terminal application
add_subdirectory(app)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
)
FetchContent_GetProperties(googletest)
if (ENABLE_TESTS)
if (NOT googletest_POPULATED)
FetchContent_Populate(googletest)
# Prevent GoogleTest from overriding our compiler/linker options
# when building with Visual Studio
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Prevent GoogleTest from using PThreads
set(gtest_disable_pthreads ON CACHE BOOL "" FORCE)
set(BUILD_SHARED_VERSION OFF CACHE BOOL "" FORCE)
set(BUILD_TEST OFF CACHE BOOL "" FORCE)
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
# adds the targers: gtest, gtest_main, gmock, gmock_main
add_subdirectory(
${googletest_SOURCE_DIR}
${googletest_BINARY_DIR}
)
# Silence std::tr1 warning on MSVC
if (MSVC)
foreach (_tgt gmock)
target_compile_definitions(${_tgt}
PRIVATE
"_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
)
endforeach ()
endif ()
endif ()
add_subdirectory(test)
add_subdirectory(test-integration)
endif ()