-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
250 lines (211 loc) · 6.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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# Copyright (C) 2021-2022 Kyurae Kim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
cmake_minimum_required(VERSION 3.15)
# Set the project name to your project name, my project isn't very descriptive
project(us_gallery LANGUAGES CUDA CXX)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# Link this 'library' to set the c++ standard / compile-time options requested
add_library(project_options INTERFACE)
target_compile_features(project_options INTERFACE cxx_std_20)
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
if(ENABLE_BUILD_WITH_TIME_TRACE)
target_compile_options(project_options INTERFACE -ftime-trace)
endif()
endif()
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake
add_library(project_warnings INTERFACE)
# enable cache system
include(cmake/Cache.cmake)
# standard compiler warnings
include(cmake/CompilerWarnings.cmake)
set_project_warnings(project_warnings)
# sanitizer options if supported by compiler
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
include(cmake/Sanitizers.cmake)
enable_sanitizers(project_options)
endif()
# enable doxygen
include(cmake/Doxygen.cmake)
enable_doxygen()
# allow for static analysis options
include(cmake/StaticAnalyzers.cmake)
# Release mode options
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -flto ${CMAKE_CXX_FLAGS_RELEASE}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Rpass-analysis=loop-vectorize -Rpass-missed=loop-vectorize")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS_RELEASE "-fopenmp-simd ${CMAKE_CXX_FLAGS_RELEASE}")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
endif()
# Dependencies
find_package(SFML 2.5 REQUIRED COMPONENTS system window graphics network audio )
find_package(ImGui-SFML REQUIRED)
find_package(Threads REQUIRED)
find_package(OpenMP REQUIRED)
find_package(Blaze REQUIRED)
find_package(NLOPT REQUIRED)
find_package(CUDA REQUIRED)
#set(OpenCV_STATIC ON)
find_package(OpenCV REQUIRED COMPONENTS core imgproc highgui cudafilters tracking quality)
set(BLA_STATIC ON)
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
add_compile_definitions(SPDLOG_FMT_EXTERNAL)
add_library(spdlog INTERFACE)
target_include_directories(spdlog SYSTEM INTERFACE "${PROJECT_SOURCE_DIR}/third_party/spdlog/include")
add_compile_definitions(FMT_HEADER_ONLY)
add_library(FMT INTERFACE)
target_include_directories(FMT SYSTEM INTERFACE "${PROJECT_SOURCE_DIR}/third_party/fmt/include")
add_library(csvparser INTERFACE)
target_include_directories(csvparser SYSTEM INTERFACE "${PROJECT_SOURCE_DIR}/third_party/csv-parser/single_include")
add_library(progressbar INTERFACE)
target_include_directories(progressbar SYSTEM INTERFACE "${PROJECT_SOURCE_DIR}/third_party/progressbar")
add_library(Random123 INTERFACE)
target_include_directories(Random123 SYSTEM INTERFACE "${PROJECT_SOURCE_DIR}/third_party/Random123")
add_library(PortableFileDialogs INTERFACE)
target_include_directories(PortableFileDialogs SYSTEM INTERFACE "${PROJECT_SOURCE_DIR}/third_party/portable-file-dialogs")
add_library(nlohmann INTERFACE)
target_include_directories(nlohmann SYSTEM INTERFACE "${PROJECT_SOURCE_DIR}/third_party/nlohmann_json/single_include")
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
option(ENABLE_TESTING "Enable Test Builds" ON)
option(ENABLE_FUZZING "Enable Fuzzing Builds" OFF)
if(ENABLE_TESTING)
enable_testing()
message("Building Tests. Be sure to check out test/constexpr_tests for constexpr testing")
add_subdirectory(test)
endif()
# Bayesian optimization test
# add_executable(bayesopt_benchmark src/bayesopt_benchmark.cpp)
# target_link_libraries(bayesopt_benchmark
# INTERFACE
# blaze::blaze
# Threads::threads
# PUBLIC
# Python::NumPy
# Python::Python
# OpenMP::OpenMP_CXX
# csvparser
# progressbar
# project_options
# project_warnings
# BLAS::BLAS
# LAPACK::LAPACK
# spdlog
# FMT
# NLOPT::nlopt
# Random123)
# Image processing core
add_library(ipcore
SHARED
src/imaging/cascaded_pyramid.cpp
src/imaging/coherent_diffusion.cu
src/imaging/complex_diffusion.cu
src/imaging/complex_shock.cu
src/imaging/laplacian_pyramid.cpp
src/imaging/gaussian_pyramid.cpp
src/imaging/local_laplacian_pyramid.cu
src/imaging/local_laplacian_pyramid.cpp
src/imaging/laplacian_pyramid.cpp
src/image_processing_api.cpp
)
target_link_libraries(ipcore
PUBLIC
project_options
project_warnings
OpenMP::OpenMP_CXX
opencv_core
opencv_quality
opencv_cudafilters
opencv_cudawarping
)
set_target_properties(ipcore
PROPERTIES
CUDA_SEPARABLE_COMPILATION ON)
# Image processing demo
add_executable(image_processing_demo
src/image_processing_demo.cpp)
target_link_libraries(image_processing_demo
PUBLIC
project_options
project_warnings
opencv_tracking
opencv_highgui
opencv_quality
ipcore)
# select ROI
add_executable(select_roi
src/select_roi.cpp)
target_link_libraries(select_roi
PUBLIC
project_options
project_warnings
PortableFileDialogs
opencv_highgui
opencv_tracking
ipcore)
# Ultrasound Design Gallery Simulation
add_executable(usdg_simulation
src/usdg_simulation.cpp)
target_link_libraries(usdg_simulation
INTERFACE
blaze::blaze
PUBLIC
project_options
project_warnings
Threads::Threads
ipcore
opencv_highgui
csvparser
progressbar
BLAS::BLAS
LAPACK::LAPACK
spdlog
FMT
NLOPT::nlopt
opencv_core
Random123)
# Ultrasound Design Gallery
add_executable(ultrasound_design_gallery
src/ultrasound_design_gallery.cpp
src/ui/user_interface.cpp
src/ui/video_player.cpp
src/ui/line_search.cpp
src/ui/parameter_value.cpp
src/ui/optimization_manager.cpp
)
target_include_directories(ultrasound_design_gallery
PUBLIC
${SFML_INCLUDE_DIRS})
target_link_libraries(ultrasound_design_gallery
INTERFACE
blaze::blaze
nlohmann
PUBLIC
project_options
project_warnings
Threads::Threads
NLOPT::nlopt
ipcore
opencv_highgui
FMT
spdlog
opencv_core
BLAS::BLAS
LAPACK::LAPACK
Random123
PortableFileDialogs
ImGui-SFML::ImGui-SFML)
target_compile_definitions(ultrasound_design_gallery
PUBLIC
"USGALLERY_ROOT=\"${PROJECT_SOURCE_DIR}\"")