-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
95 lines (81 loc) · 3.45 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
cmake_minimum_required(VERSION 3.20)
project(asar_focus CUDA CXX)
message(STATUS "CMake version: ${CMAKE_VERSION}")
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(SAR_SOURCES
sar/az_multilook.cuh
sar/az_multilook.cu
sar/fractional_doppler_centroid.cu
sar/fractional_doppler_centroid.cuh
sar/iq_correction.cu
sar/iq_correction.cuh
sar/orbit_state_vector.cc
sar/orbit_state_vector.h
sar/processing_velocity_estimation.cc
sar/processing_velocity_estimation.h
sar/range_compression.cu
sar/range_compression.cuh
sar/range_doppler_algorithm.cu
sar/range_doppler_algorithm.cuh
sar/range_spreading_loss.cuh
sar/range_spreading_loss.cu
sar/sar_chirp.h
sar/sar_chirp.cc
sar/sar_metadata.h
sar/srgr.cuh
sar/srgr.cu
)
set(SOURCES
main.cc main_flow.cc ${SAR_SOURCES}
)
add_executable(asar_focus ${SOURCES})
set_target_properties(asar_focus PROPERTIES
CUDA_SEPARABLE_COMPILATION ON)
find_package(CUDAToolkit 11.2 REQUIRED)
find_package(Boost 1.71.0 REQUIRED COMPONENTS date_time program_options log log_setup)
find_package(GDAL 3.0.4 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")
if (NOT CMAKE_CUDA_ARCHITECTURES)
if (NOT DEFINED ENV{CUDAARCHS})
message(STATUS "CUDAARCHS not set, defaulting")
# https://cmake.org/cmake/help/latest/prop_tgt/CUDA_ARCHITECTURES.html
if (CMAKE_VERSION VERSION_LESS "3.24")
set(CMAKE_CUDA_ARCHITECTURES 60 CACHE STRING "CUDA architectures" FORCE)
else()
set(CMAKE_CUDA_ARCHITECTURES native CACHE STRING "CUDA architectures" FORCE)
endif()
endif()
endif()
message(STATUS "CUDA binary code will be generated for the following architecture(s) - ${CMAKE_CUDA_ARCHITECTURES}")
set_property(TARGET asar_focus PROPERTY CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -pedantic ")
INCLUDE_DIRECTORIES(${CUDAToolkit_INCLUDE_DIRS})
if (DEFINED ENV{ALUS_ENABLE_TESTS})
set(ALUS_ENABLE_TESTS $ENV{ALUS_ENABLE_TESTS})
endif ()
if (ALUS_ENABLE_TESTS)
message(STATUS "Enabling tests")
set(ALUS_UNIT_TEST_BINARY_OUTPUT_DIR ${PROJECT_BINARY_DIR}/unit-test)
endif ()
include(FetchContent)
include(dependencies/FetchContents.cmake)
add_subdirectory(app)
add_subdirectory(cuda_util)
add_subdirectory(envisat_format)
add_subdirectory(util)
target_include_directories(asar_focus PRIVATE ${CMAKE_CURRENT_LIST_DIR})
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
message("Also adding 'stdc++fs' for linking since the g++ version ${CMAKE_CXX_COMPILER_VERSION} requires it.")
target_link_libraries(asar_focus PRIVATE gdal cufft Eigen3::Eigen stdc++fs app-static util-static envisat-format-static cuda-util-static)
else ()
target_link_libraries(asar_focus PRIVATE gdal cufft Eigen3::Eigen app-static util-static envisat-format-static cuda-util-static)
endif()