-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathopenorienteering-mapper-git.cmake
122 lines (113 loc) · 4.96 KB
/
openorienteering-mapper-git.cmake
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
# This file is part of OpenOrienteering.
# Copyright 2016-2020 Kai Pastor
#
# Redistribution and use is allowed according to the terms of the BSD license:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
find_package(Git QUIET)
if(NOT GIT_EXECUTABLE)
message(STATUS "Disabling openorienteering-mapper-git due to missing git")
return()
endif()
set(Mapper_GIT_TAGS "master;dev" CACHE STRING "Mapper (git): The git branch names, commit IDs and tags")
set(Mapper_GIT_LICENSING_PROVIDER "superbuild" CACHE STRING "Mapper (git): Provider for 3rd-party licensing information")
set(Mapper_GIT_QT_VERSION 5.12 CACHE STRING "Mapper (git): Qt version")
option(Mapper_GIT_ENABLE_POSITIONING "Mapper: Enable positioning" ON)
option(Mapper_GIT_MANUAL_PDF "Mapper (git): Provide the manual as PDF file (needs pdflatex)" OFF)
set(Mapper_GIT_GDAL_DATA_DIR "NOTFOUND" CACHE STRING "Mapper (git): GDAL data directory")
option(Mapper_GIT_ENABLE_INSTALL "Mapper (git): Enable installation step" ON)
foreach(git_tag ${Mapper_GIT_TAGS})
string(MAKE_C_IDENTIFIER "git-${git_tag}" version)
string(REGEX REPLACE "^git_" "git-" version "${version}")
superbuild_package(
NAME openorienteering-mapper
VERSION ${version}
DEPENDS
gdal
libpolyclipping
proj
qtandroidextras-${Mapper_GIT_QT_VERSION}
qtbase-${Mapper_GIT_QT_VERSION}
qtimageformats-${Mapper_GIT_QT_VERSION}
qtlocation-${Mapper_GIT_QT_VERSION}
qtsensors-${Mapper_GIT_QT_VERSION}
qttools-${Mapper_GIT_QT_VERSION}
qttranslations-${Mapper_GIT_QT_VERSION}
zlib
host:doxygen
host:qttools-${Mapper_GIT_QT_VERSION}
SOURCE
GIT_REPOSITORY https://github.com/OpenOrienteering/mapper.git
GIT_TAG ${git_tag}
USING version
Mapper_GIT_LICENSING_PROVIDER
Mapper_GIT_ENABLE_POSITIONING
Mapper_GIT_MANUAL_PDF
Mapper_GIT_GDAL_DATA_DIR
Mapper_GIT_ENABLE_INSTALL
BUILD [[
CMAKE_ARGS
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
"-UCMAKE_STAGING_PREFIX"
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-DBUILD_SHARED_LIBS=0"
"-DMapper_AUTORUN_SYSTEM_TESTS=0"
"-DLICENSING_PROVIDER=${Mapper_GIT_LICENSING_PROVIDER}"
"-DMapper_BUILD_PACKAGE=1"
"-DMapper_VERSION_DISPLAY=${version}"
"-DMapper_MANUAL_PDF=$<BOOL:@Mapper_GIT_MANUAL_PDF@>"
"-DGDAL_DATA_DIR=${Mapper_GIT_GDAL_DATA_DIR}"
$<$<BOOL:@ANDROID@>:
"-DCMAKE_DISABLE_FIND_PACKAGE_Qt5PrintSupport=TRUE"
"-DKEYSTORE_URL=${ANDROID_KEYSTORE_URL}"
"-DKEYSTORE_ALIAS=${ANDROID_KEYSTORE_ALIAS}"
>
$<$<NOT:$<OR:$<BOOL:@ANDROID@>,$<BOOL:@Mapper_GIT_ENABLE_POSITIONING@>>>:
"-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Positioning:BOOL=TRUE"
"-UQt5Positioning_DIR"
"-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Sensors:BOOL=TRUE"
"-UQt5Sensors_DIR"
>
$<$<BOOL:@CMAKE_CROSSCOMPILING@>:
"-DCMAKE_PROGRAM_PATH=@HOST_DIR@/bin"
>
INSTALL_COMMAND
$<$<NOT:$<BOOL:@Mapper_GIT_ENABLE_INSTALL@>>:"">$<$<BOOL:@Mapper_GIT_ENABLE_INSTALL@>:
"${CMAKE_COMMAND}" --build . --target install/fast -- VERBOSE=1
# Mapper Windows installation layout is weird
"DESTDIR=${DESTDIR}${INSTALL_DIR}$<$<BOOL:@WIN32@>:/OpenOrienteering>"
>
$<$<NOT:$<BOOL:@CMAKE_CROSSCOMPILING@>>:
TEST_COMMAND
"${CMAKE_COMMAND}" -E env "LD_LIBRARY_PATH=${CMAKE_STAGING_PREFIX}/lib"
"${CMAKE_CTEST_COMMAND}" -T Test --no-compress-output
TEST_BEFORE_INSTALL 1
>
]]
EXECUTABLES src/Mapper MACOSX_BUNDLE
PACKAGE [[
COMMAND "${CMAKE_COMMAND}" --build . --target package/fast
]]
)
endforeach()