-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
154 lines (131 loc) · 4.71 KB
/
CMakeLists.txt
File metadata and controls
154 lines (131 loc) · 4.71 KB
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
cmake_minimum_required(VERSION 3.24.0)
# Project Information
project(viewshed VERSION 5.0.0 DESCRIPTION "C++ Viewshed library based on GDAL and Qt" LANGUAGES CXX)
# Library Name
SET(LIBRARY_NAME "Viewshed")
# Options
option(BUILD_TESTS "Build tests." ON)
option(BUILD_DOCUMENTATION "Build documentation." OFF)
option(PACK_DEB "Pack DEB file for installation in Debian/Ubuntu/Mint and derivatives." ON)
option(NEEDS_QT "Allows optionally building library without searching for Qt. Cannot build binaries with this set to OFF. For running test mainly." ON)
option(BUILD_GUI_APP "Allows building of executable program with GUI" ON)
option(CELL_EVENT_DATA_FLOAT "Create CellEvents with data stored `float` instead of `double`. Lowers significantly RAM memory usage." ON)
option(OUTPUT_RASTER_DATA_FLOAT "Create output rasters with data stored `Float32` instead of `Float64`. Lowers RAM memory usage." ON)
if(BUILD_GUI_APP)
set(NEEDS_QT ON)
endif()
# C++ Standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Module Path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# Dependencies
find_package(GDAL REQUIRED)
find_package(Threads REQUIRED)
find_package(SimpleRasters REQUIRED)
if(NEEDS_QT)
set(CMAKE_AUTOMOC TRUE)
find_package(Qt5 COMPONENTS Core Xml Test REQUIRED)
# find_package(Qt6 COMPONENTS Core Xml Test REQUIRED)
set(QT_LIBS
Qt5::Core
# Qt6::Core
)
if(BUILD_GUI_APP)
find_package(Qt5 COMPONENTS Core Widgets Xml Gui Test REQUIRED)
# find_package(Qt6 COMPONENTS Core Widgets Xml Gui Test REQUIRED)
set(QT_LIBS
${QT_LIBS}
Qt5::Gui
Qt5::Widgets
# Qt6::Gui
# Qt6::Widgets
)
endif()
set(HAS_QT TRUE)
else()
message(STATUS "Not using Qt")
endif()
# Public Headers
set(LIBRARY_VIEWSHED_PUBLIC_HEADERS
include/viewshed/abstractlos.h
include/viewshed/abstractviewshed.h
include/viewshed/abstractviewshedalgorithm.h
include/viewshed/cellevent.h
include/viewshed/celleventposition.h
include/viewshed/constants.h
include/viewshed/defaultdatatypes.h
include/viewshed/enums.h
include/viewshed/inverselos.h
include/viewshed/inverseviewshed.h
include/viewshed/los.h
include/viewshed/losevaluator.h
include/viewshed/losimportantvalues.h
include/viewshed/losnode.h
include/viewshed/point.h
include/viewshed/rasterposition.h
include/viewshed/threadtasks.h
include/viewshed/viewshed.h
include/viewshed/viewshedvalues.h
include/viewshed/visibility.h
include/viewshed/visibilityangledifferencetoglobalhorizon.h
include/viewshed/visibilityangledifferencetolocalhorizon.h
include/viewshed/visibilitydistanceglobalhorizon.h
include/viewshed/visibilitydistancelocalhorizon.h
include/viewshed/visibilityelevationdifference.h
include/viewshed/visibilityelevationdifferencetolocalhorizon.h
include/viewshed/visibilityelevationdifferencetoglobalhorizon.h
include/viewshed/visibilityfuzzy.h
include/viewshed/visibilityhorizons.h
include/viewshed/visibilityhorizonscount.h
include/viewshed/visibilityviewangle.h
include/viewshed/visibilityboolean.h
include/viewshed/visibilityalgorithms.h
include/viewshed/visibilityslopetoviewangle.h
include/viewshed/viewshedlibrary.h
include/viewshed/viewshedutils.h
include/viewshed/viewshedtypes.h
include/viewshed/viewshed_export.h
)
# Subdirectories
add_subdirectory(src)
# Create and install package configuration files
include(CMakePackageConfigHelpers)
# Configure version file
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
# Configure config file template
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LIBRARY_NAME}
)
# Install configuration files
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LIBRARY_NAME}
)
# Documentation
if(BUILD_DOCUMENTATION)
add_subdirectory(docs)
endif()
# Tests
if(BUILD_TESTS)
include(CTest)
enable_testing()
add_subdirectory(tests)
endif()
# Packaging (DEB)
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND PACK_DEB)
include(Packing)
add_custom_target(pack_viewshed_library_deb
COMMAND ${CMAKE_CPACK_COMMAND} -G DEB -C Release
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_dependencies(pack_viewshed_library_deb viewshed_shared)
endif()