11#
22# Copyright 2012, 2013, 2014 Thomas Schöps
3- # Copyright 2012-2018 Kai Pastor
3+ # Copyright 2012-2019 Kai Pastor
44#
55# This file is part of OpenOrienteering.
66#
@@ -29,7 +29,9 @@ endif()
2929
3030# Project declaration
3131
32- project (Mapper VERSION 0.8.4 LANGUAGES CXX C)
32+ project (Mapper VERSION 0.9.0 LANGUAGES CXX C)
33+
34+ math (EXPR Mapper_VERSION_CODE "${Mapper_VERSION_MAJOR} * 10000 + ${Mapper_VERSION_MINOR} * 100 + ${Mapper_VERSION_PATCH} * 2 + ${CMAKE_SIZEOF_VOID_P} / 4 - 1" )
3335
3436if (Mapper_VERSION_DISPLAY)
3537 message (STATUS "Custom version display string: \" ${Mapper_VERSION_DISPLAY} \" " )
@@ -41,16 +43,6 @@ endif()
4143
4244set (Mapper_COPYRIGHT "(C) 2012-2018 The OpenOrienteering developers" )
4345
44- set (android_manifest "${PROJECT_SOURCE_DIR} /android/AndroidManifest.xml" )
45- file (READ "${android_manifest} " current)
46- if (NOT current MATCHES " android:versionName=.${Mapper_VERSION_MAJOR} \\ .${Mapper_VERSION_MINOR} \\ .${Mapper_VERSION_PATCH} . " )
47- set (android_version_name "${Mapper_VERSION_MAJOR} .${Mapper_VERSION_MINOR} .${Mapper_VERSION_PATCH} " )
48- math (EXPR android_version_int "${Mapper_VERSION_MAJOR} * 10000 + ${Mapper_VERSION_MINOR} * 100 + ${Mapper_VERSION_PATCH} " )
49- string (REGEX REPLACE "( android:versionName=.)[0-9]*\\ .[0-9]*\\ .[0-9]*(. )" "\\ 1${android_version_name} \\ 2" output "${current} " )
50- string (REGEX REPLACE "( android:versionCode=.)[0-9]*(. )" "\\ 1${android_version_int} \\ 2" output "${output} " )
51- file (WRITE "${android_manifest} " "${output} " )
52- endif ()
53-
5446if (${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR} )
5547 message (AUTHOR_WARNING "In-source builds are discouraged for development." )
5648endif ()
@@ -109,17 +101,6 @@ option(Mapper_PACKAGE_ASSISTANT "Include Qt Assistant in the packages"
109101mark_as_advanced (Mapper_PACKAGE_PROJ Mapper_PACKAGE_GDAL Mapper_PACKAGE_QT Mapper_PACKAGE_ASSISTANT)
110102
111103
112- # Migration of legacy configurations (before 0.7, affects developers)
113-
114- if (Mapper_BUILD_DOXYGEN)
115- unset (DOXYGEN_EXECUTABLE CACHE )
116- endif ()
117- unset (Mapper_BUILD_DOXYGEN CACHE )
118- unset (Mapper_BUILD_GDAL CACHE )
119- unset (Mapper_BUILD_PROJ CACHE )
120- unset (Mapper_BUILD_QT CACHE )
121-
122-
123104# Installation configuration
124105
125106set (Mapper_PACKAGE_NAME "openorienteering-mapper" CACHE STRING
@@ -162,6 +143,8 @@ endif()
162143
163144# Build definitons
164145
146+ include (CTest)
147+
165148set (CMAKE_CXX_STANDARD 14)
166149set (CMAKE_CXX_STANDARD_REQUIRED TRUE )
167150
@@ -196,11 +179,23 @@ if(NOT TARGET PROJ4::proj)
196179 set (PROJ4_FOUND false )
197180 find_package (PROJ4 MODULE REQUIRED)
198181endif ()
182+ if (NOT PROJ4_VERSION OR PROJ4_VERSION VERSION_LESS 6.1)
183+ # New PROJ API missing or incomplete.
184+ # (proj_normalize_for_visualization() came in 6.1.)
185+ add_definitions (-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H)
186+ endif ()
199187
200188if (Mapper_USE_GDAL)
201- find_package (GDAL REQUIRED)
189+ find_package (GDAL 2 REQUIRED)
202190endif ()
203191
192+ find_package (Qt5Core 5.5 REQUIRED)
193+ add_definitions (-DQT_DISABLE_DEPRECATED_BEFORE=0x050500)
194+ if (ANDROID AND "${Qt5Core_VERSION} " VERSION_LESS 5.12.1)
195+ message (FATAL_ERROR "At least Qt 5.12.1 is required to build for Android" )
196+ elseif ("${Qt5Core_VERSION} " VERSION_LESS 5.8.0)
197+ add_definitions ("-D'Q_FALLTHROUGH()=(void)0'" )
198+ endif ()
204199
205200include ("TestBigEndian" )
206201test_big_endian(big_endian)
@@ -209,10 +204,6 @@ if(big_endian)
209204endif ()
210205
211206
212- if (ANDROID OR big_endian)
213- add_definitions (-DNO_NATIVE_FILE_FORMAT)
214- endif ()
215-
216207if (UNIX AND NOT APPLE )
217208# set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib/${Mapper_PACKAGE_NAME}/lib")
218209 set (CMAKE_INSTALL_RPATH "${MAPPER_LIBRARY_DESTINATION} /lib" )
@@ -229,6 +220,30 @@ else()
229220 add_definitions (-DQT_NO_DEBUG -DQT_NO_DEBUG_OUTPUT -DQT_NO_WARNING_OUTPUT -DNDEBUG)
230221endif ()
231222
223+
224+ # Build-time code checks
225+
226+ if (NOT CMAKE_CXX_CLANG_TIDY)
227+ set (min_version 8)
228+ find_package (ClangTidy ${min_version} )
229+ if (ClangTidy_FOUND)
230+ set (CMAKE_CXX_CLANG_TIDY "${PROJECT_SOURCE_DIR} /code-check-wrapper.sh;${ClangTidy_EXECUTABLE} " )
231+ else ()
232+ message (AUTHOR_WARNING "Install clang-tidy >= ${min_version} for code checks during build" )
233+ endif ()
234+ endif ()
235+
236+ if (NOT CMAKE_CXX_INCLUDE_WHAT_YOU_USE)
237+ set (min_version 0.12)
238+ find_package (IWYU ${min_version} )
239+ if (IWYU_FOUND)
240+ set (CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${PROJECT_SOURCE_DIR} /code-check-wrapper.sh;${IWYU_EXECUTABLE} " )
241+ else ()
242+ message (AUTHOR_WARNING "Install include-what-you-use >= ${min_version} for code checks during build" )
243+ endif ()
244+ endif ()
245+
246+
232247# Subdirectories
233248
234249add_subdirectory ("doc/manual" )
@@ -246,6 +261,7 @@ add_subdirectory("src/libocad")
246261if (NOT ANDROID)
247262 add_subdirectory ("src/printsupport" )
248263endif ()
264+ add_subdirectory ("src/sensors" )
249265add_subdirectory ("src" )
250266add_subdirectory ("packaging" )
251267add_subdirectory ("doc/licensing" )
@@ -262,7 +278,28 @@ endif()
262278add_subdirectory ("doc/api" )
263279add_subdirectory ("packaging/src" )
264280
265- feature_summary(WHAT ALL )
281+ # Auxiliary targets
282+
283+ set (ci
284+ ci/azure-pipelines.yml
285+ ci/build .yml
286+ ci/codespell.yml
287+ ci/filter -stderr.sed
288+ ci/publish.yml
289+ ci/publish-coverage.yml
290+ ci/setup-common.yml
291+ ci/setup-macos.yml
292+ ci/setup-msys2.yml
293+ ci/setup-ubuntu.yml
294+ ci/shell.sh
295+ ci/openorienteering-mapper-ci.cmake
296+ )
297+
298+ add_custom_target (CI SOURCES ${ci} )
299+
300+ # Configuration report
301+
302+ feature_summary(INCLUDE_QUIET_PACKAGES WHAT ALL )
266303
267304string (TOUPPER "${CMAKE_BUILD_TYPE} " type )
268305foreach (lang CXX C)
0 commit comments