-
Notifications
You must be signed in to change notification settings - Fork 8
/
proj-7.1.1.cmake
174 lines (159 loc) · 5.96 KB
/
proj-7.1.1.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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# This file is part of OpenOrienteering.
# Copyright 2016-2024 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.
set(version 7.1.1)
set(download_hash SHA256=324e7abb5569fb5f787dadf1d4474766915c485a188cf48cf07153b99156b5f9)
set(patch_version ${version}-1)
set(patch_hash SHA256=2e37382de22a36fcb9e859aaa0d9eb5979fcd45eb55773c6602793144be9578a)
set(base_url https://snapshot.debian.org/archive/debian/20200901T150453Z/pool/main/p/proj/)
option(USE_SYSTEM_PROJ "Use the system PROJ4 if possible" ON)
set(test_system_proj [[
if(${USE_SYSTEM_PROJ})
enable_language(C)
find_library(PROJ4_LIBRARY NAMES proj QUIET)
find_path(PROJ4_INCLUDE_DIR NAMES proj_api.h QUIET)
string(FIND "${PROJ4_LIBRARY}" "${CMAKE_STAGING_PREFIX}/" staging_prefix_start)
if(PROJ4_LIBRARY AND PROJ4_INCLUDE_DIR AND NOT staging_prefix_start EQUAL 0)
message(STATUS "Found ${SYSTEM_NAME} PROJ4: ${PROJ4_LIBRARY}")
set(BUILD_CONDITION 0)
endif()
endif()
]])
string(CONCAT portability_sed [[
# Generated by ]] "${CMAKE_CURRENT_LIST_FILE}\n" [[
# On macOS, the temporary files are not put into the subdir.
s/^\(begin [^ ]*\) [^ ]*xzi/\1 tmp.xzi/
s/^\(xz -dc\) [^ ]*xzi/\1 tmp.xzi/
$ i \
rm -f tmp.xzi
]])
set(gcc-13_patch [[
diff --git a/src/proj_json_streaming_writer.hpp b/src/proj_json_streaming_writer.hpp
index 6267684..cf19b83 100644
--- a/src/proj_json_streaming_writer.hpp
+++ b/src/proj_json_streaming_writer.hpp
@@ -31,6 +31,7 @@
/*! @cond Doxygen_Suppress */
+#include <cstdint>
#include <vector>
#include <string>
]])
superbuild_package(
NAME proj-patches
VERSION ${patch_version}
DEPENDS
host:xz-utils
SOURCE_WRITE
portability.sed portability_sed
SOURCE
URL ${base_url}proj_${patch_version}.debian.tar.xz
URL_HASH ${patch_hash}
PATCH_COMMAND
sed -f "<SOURCE_DIR>/portability.sed" -i -- "<SOURCE_DIR>/datumgrids.shar"
COMMAND
sed -f "<SOURCE_DIR>/portability.sed" -i -- "<SOURCE_DIR>/datumgrids-ch.shar"
# Only in the build phase, we can rely on our `xz` from package xz-utils.
BUILD [[
CONFIGURE_COMMAND ""
BUILD_COMMAND
"${CMAKE_COMMAND}" -E make_directory "<SOURCE_DIR>/data"
COMMAND
"${CMAKE_COMMAND}" -E chdir "<SOURCE_DIR>/data"
sh "<SOURCE_DIR>/datumgrids.shar" -c
COMMAND
# Verify existence of a file from datumgrids.shar
"${CMAKE_COMMAND}" -E md5sum "<SOURCE_DIR>/data/BETA2007.gsb"
#COMMAND
# "${CMAKE_COMMAND}" -E chdir "<SOURCE_DIR>/data"
# sh "<SOURCE_DIR>/datumgrids-ch.shar" -c
INSTALL_COMMAND ""
]]
)
superbuild_package(
NAME proj
VERSION ${patch_version}+openorienteering1
DEPENDS
source:proj-patches-${patch_version} # source-time: patches
host:proj-patches-${patch_version} # install-time: data
host:sqlite3
curl
googletest
pkg-config
sqlite3
tiff
SOURCE_WRITE
gcc-13.patch gcc-13_patch
SOURCE
URL ${base_url}proj_${version}.orig.tar.gz
URL_HASH ${download_hash}
PATCH_COMMAND
"${CMAKE_COMMAND}"
-Dpackage=proj-patches-${patch_version}
-P "${APPLY_PATCHES_SERIES}"
COMMAND
patch -p1 < gcc-13.patch
USING USE_SYSTEM_PROJ patch_version
BUILD_CONDITION ${test_system_proj}
BUILD [[
CMAKE_ARGS
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
"-DCMAKE_BUILD_TYPE:STRING=$<CONFIG>"
-DBUILD_SHARED_LIBS=ON
-DUSE_THREAD=ON
-DPROJ_BIN_SUBDIR=bin
-DPROJ_LIB_SUBDIR=lib
-DPROJ_DATA_SUBDIR=share/proj
-DPROJ_DOC_SUBDIR=share/doc/proj
-DPROJ_INCLUDE_SUBDIR=include
-DPROJ_CMAKE_SUBDIR=lib/cmake
$<$<NOT:$<BOOL:@CMAKE_CROSSCOMPILING@>>:
-DBUILD_TESTING=ON
-DUSE_EXTERNAL_GTEST=ON
>
$<$<BOOL:@CMAKE_CROSSCOMPILING@>:
-DCMAKE_PROGRAM_PATH=${HOST_DIR}/bin # for sqlite3
-DBUILD_TESTING=OFF
>
$<$<NOT:$<OR:$<BOOL:@CMAKE_CROSSCOMPILING@>,$<BOOL:@MSYS@>,$<BOOL:@APPLE@>>>:
TEST_COMMAND
"${CMAKE_COMMAND}" -E env
"PROJ_LIB=${DESTDIR}${CMAKE_STAGING_PREFIX}/share/proj"
"${CMAKE_COMMAND}" --build . --target test
TEST_AFTER_INSTALL
>
INSTALL_COMMAND
"${CMAKE_COMMAND}" --build . --target install/strip/fast
COMMAND
"${CMAKE_COMMAND}" -E copy_directory
"<SOURCE_DIR>/../proj-patches-${patch_version}/data"
"${DESTDIR}${CMAKE_STAGING_PREFIX}/share/proj"
COMMAND
"${CMAKE_COMMAND}" -E copy
"<SOURCE_DIR>/../proj-patches-${patch_version}/copyright"
"${DESTDIR}${CMAKE_STAGING_PREFIX}/share/doc/copyright/proj-${patch_version}.txt"
]]
)