1
1
#
2
2
# Copyright 2012, 2013, 2014 Thomas Schöps
3
- # Copyright 2012-2020 Kai Pastor
3
+ # Copyright 2012-2021 Kai Pastor
4
4
#
5
5
# This file is part of OpenOrienteering.
6
6
#
@@ -27,10 +27,12 @@ if(CCACHE_PROGRAM)
27
27
set_property (GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM} " )
28
28
endif ()
29
29
30
+ option (CMAKE_FIND_PACKAGE_PREFER_CONFIG "Lookup package config files before using find modules" ON )
31
+
30
32
# Project declaration
31
33
32
- project (Mapper VERSION 0.9.4 LANGUAGES CXX C)
33
- set (Mapper_COPYRIGHT "(C) 2020 The OpenOrienteering developers" )
34
+ project (Mapper VERSION 0.9.5 LANGUAGES CXX C)
35
+ set (Mapper_COPYRIGHT "(C) 2021 The OpenOrienteering developers" )
34
36
35
37
math (EXPR Mapper_VERSION_CODE "${Mapper_VERSION_MAJOR} * 10000 + ${Mapper_VERSION_MINOR} * 100 + ${Mapper_VERSION_PATCH} * 2 + ${CMAKE_SIZEOF_VOID_P} / 4 - 1" )
36
38
@@ -63,8 +65,10 @@ endif()
63
65
64
66
option (Mapper_DEBUG_TRANSLATIONS "Debug missing translations" OFF )
65
67
66
- # Used for some Linux distributions which do not provide the polyclipping lib.
67
- option (Mapper_BUILD_CLIPPER "Build the Clipper package from source" OFF )
68
+ # To improve developer experience, build clipper if it is not found
69
+ set (Mapper_BUILD_CLIPPER "auto" CACHE STRING
70
+ "Build the Clipper package from source, alternatives: ON, OFF"
71
+ )
68
72
69
73
option (Mapper_USE_GDAL "Use the GDAL library" ON )
70
74
@@ -138,10 +142,12 @@ elseif(ANDROID)
138
142
set (MAPPER_DATA_DESTINATION "assets" )
139
143
set (MAPPER_ABOUT_DESTINATION "assets/doc" )
140
144
else () # LINUX and alike
141
- set (MAPPER_RUNTIME_DESTINATION "bin" )
142
- set (MAPPER_LIBRARY_DESTINATION "lib/${Mapper_PACKAGE_NAME} " )
143
- set (MAPPER_DATA_DESTINATION "share/${Mapper_PACKAGE_NAME} " )
144
- set (MAPPER_ABOUT_DESTINATION "share/doc/${Mapper_PACKAGE_NAME} " )
145
+ include (GNUInstallDirs)
146
+ set (MAPPER_RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR} " )
147
+ set (MAPPER_LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR} /${Mapper_PACKAGE_NAME} " )
148
+ set (MAPPER_DATA_DESTINATION "${CMAKE_INSTALL_DATADIR} /${Mapper_PACKAGE_NAME} " )
149
+ string (REPLACE "/${PROJECT_NAME} " "/${Mapper_PACKAGE_NAME} "
150
+ MAPPER_ABOUT_DESTINATION "${CMAKE_INSTALL_DOCDIR} " )
145
151
endif ()
146
152
147
153
if (CMAKE_CROSSCOMPILING )
@@ -174,6 +180,19 @@ add_custom_target(Mapper_prerequisites
174
180
)
175
181
set (Mapper_prerequisites_FOUND TRUE )
176
182
183
+ if (Mapper_BUILD_CLIPPER STREQUAL "auto" )
184
+ find_package (Polyclipping 6.1.3 MODULE)
185
+ if (NOT Polyclipping_FOUND)
186
+ message (WARNING
187
+ "System polyclipping is missing. Enabling embedded build.\n "
188
+ "Set Mapper_BUILD_CLIPPER=OFF to disable embedded build."
189
+ )
190
+ set_property (CACHE Mapper_BUILD_CLIPPER PROPERTY VALUE "ON" )
191
+ else ()
192
+ set_property (CACHE Mapper_BUILD_CLIPPER PROPERTY VALUE "OFF" )
193
+ endif ()
194
+ set_property (CACHE Mapper_BUILD_CLIPPER PROPERTY TYPE "BOOL" )
195
+ endif ()
177
196
if (Mapper_BUILD_CLIPPER)
178
197
add_subdirectory (3rd-party/clipper)
179
198
add_feature_info(Mapper_BUILD_CLIPPER 1 "version: ${CLIPPER_VERSION} " )
@@ -182,18 +201,20 @@ else()
182
201
find_package (Polyclipping 6.1.3 MODULE REQUIRED)
183
202
endif ()
184
203
185
- find_package (PROJ4 CONFIG QUIET )
204
+ # We must not require a minimum version of PROJ via find_package
205
+ # because PROJ config requires the major version to match exactly.
206
+ find_package (PROJ4 REQUIRED)
186
207
if (NOT TARGET PROJ4::proj)
187
- set (PROJ4_FOUND false )
188
- find_package (PROJ4 MODULE REQUIRED)
208
+ include ("${CMAKE_CURRENT_SOURCE_DIR} /cmake/FindPROJ.cmake" )
189
209
endif ()
190
- if (NOT PROJ4_VERSION OR PROJ4_VERSION VERSION_LESS 6.1)
210
+ if (NOT PROJ4_VERSION OR PROJ4_VERSION VERSION_LESS 4.9)
211
+ message (FATAL_ERROR "At least PROJ 4.9 is required" )
212
+ elseif (PROJ4_VERSION VERSION_LESS 6.1)
191
213
# New PROJ API missing or incomplete.
192
214
# (proj_normalize_for_visualization() came in 6.1.)
193
215
set_property (TARGET PROJ4::proj APPEND PROPERTY
194
216
INTERFACE_COMPILE_DEFINITIONS ACCEPT_USE_OF_DEPRECATED_PROJ_API_H)
195
- endif ()
196
- if (NOT PROJ4_VERSION OR PROJ4_VERSION VERSION_LESS 6.2.1)
217
+ elseif (PROJ4_VERSION VERSION_LESS 6.2.1)
197
218
# Datum Potsdam issue, https://github.com/OSGeo/PROJ/pull/1573
198
219
set_property (TARGET PROJ4::proj APPEND PROPERTY
199
220
INTERFACE_COMPILE_DEFINITIONS PROJ_ISSUE_1573)
@@ -218,11 +239,6 @@ if(big_endian)
218
239
endif ()
219
240
220
241
221
- if (UNIX AND NOT APPLE )
222
- # set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib/${Mapper_PACKAGE_NAME}/lib")
223
- set (CMAKE_INSTALL_RPATH "${MAPPER_LIBRARY_DESTINATION} /lib" )
224
- endif ()
225
-
226
242
add_definitions (-D_USE_MATH_DEFINES -DUNICODE)
227
243
228
244
if (Mapper_DEVELOPMENT_BUILD)
@@ -274,7 +290,6 @@ endif()
274
290
if (Mapper_USE_GDAL)
275
291
add_subdirectory ("src/gdal" )
276
292
endif ()
277
- add_subdirectory ("src/libocad" )
278
293
if (NOT ANDROID)
279
294
add_subdirectory ("src/printsupport" )
280
295
endif ()
@@ -304,6 +319,7 @@ set(ci
304
319
ci/filter -stderr.sed
305
320
ci/publish.yml
306
321
ci/publish-coverage.yml
322
+ ci/release-notes.yml
307
323
ci/setup-common.yml
308
324
ci/setup-macos.yml
309
325
ci/setup-msys2.yml
0 commit comments