h3 3.6.2 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +23 -0
- data/Gemfile.lock +6 -6
- data/README.md +1 -1
- data/ext/h3/src/.github/workflows/test-linux.yml +118 -0
- data/ext/h3/src/.github/workflows/test-macos.yml +42 -0
- data/ext/h3/src/.github/workflows/test-website.yml +32 -0
- data/ext/h3/src/.github/workflows/test-windows.yml +44 -0
- data/ext/h3/src/.gitignore +5 -0
- data/ext/h3/src/.travis.yml +16 -46
- data/ext/h3/src/CHANGELOG.md +43 -0
- data/ext/h3/src/CMakeLists.txt +133 -33
- data/ext/h3/src/CONTRIBUTING.md +1 -1
- data/ext/h3/src/README.md +60 -10
- data/ext/h3/src/RELEASE.md +3 -1
- data/ext/h3/src/VERSION +1 -1
- data/ext/h3/src/dev-docs/RFCs/rfc-template.md +21 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +21 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md +276 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/overrideable-allocators-rfc.md +141 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/polyfill-modes-rfc.md +21 -0
- data/ext/h3/src/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md +50 -0
- data/ext/h3/src/dev-docs/build_windows.md +6 -1
- data/ext/h3/src/dev-docs/creating_bindings.md +3 -3
- data/ext/h3/src/dev-docs/custom_alloc.md +27 -0
- data/ext/h3/src/docs/{overview/mainpage.md → README.md} +2 -3
- data/ext/h3/src/docs/api/misc.md +76 -0
- data/ext/h3/src/docs/community/applications.md +1 -0
- data/ext/h3/src/docs/community/bindings.md +7 -1
- data/ext/h3/src/docs/community/tutorials.md +8 -3
- data/ext/h3/src/docs/core-library/coordsystems.md +5 -4
- data/ext/h3/src/docs/core-library/filters.md +8 -9
- data/ext/h3/src/docs/core-library/geoToH3desc.md +2 -3
- data/ext/h3/src/docs/core-library/h3ToGeoBoundaryDesc.md +4 -5
- data/ext/h3/src/docs/core-library/h3ToGeoDesc.md +3 -4
- data/ext/h3/src/docs/core-library/h3indexing.md +26 -17
- data/ext/h3/src/docs/core-library/overview.md +2 -3
- data/ext/h3/src/docs/core-library/restable.md +1 -2
- data/ext/h3/src/docs/core-library/usage.md +1 -2
- data/ext/h3/src/docs/table-of-contents.json +47 -0
- data/ext/h3/src/docs/{overview/usecases.md → usecases.md} +6 -11
- data/ext/h3/src/scripts/binding_functions.sh +1 -1
- data/ext/h3/src/scripts/coverage.sh.in +1 -1
- data/ext/h3/src/scripts/update_version.sh +2 -2
- data/ext/h3/src/src/apps/applib/include/args.h +1 -0
- data/ext/h3/src/src/apps/applib/include/test.h +1 -0
- data/ext/h3/src/src/apps/applib/include/utility.h +7 -1
- data/ext/h3/src/src/apps/applib/lib/args.c +2 -0
- data/ext/h3/src/src/apps/applib/lib/kml.c +2 -0
- data/ext/h3/src/src/apps/applib/lib/test.c +1 -0
- data/ext/h3/src/src/apps/applib/lib/utility.c +133 -2
- data/ext/h3/src/src/apps/benchmarks/benchmarkH3Api.c +1 -1
- data/ext/h3/src/{website/html.config.js → src/apps/benchmarks/benchmarkH3UniEdge.c} +15 -12
- data/ext/h3/src/src/apps/filters/h3ToComponents.c +1 -0
- data/ext/h3/src/src/apps/filters/h3ToGeo.c +1 -0
- data/ext/h3/src/src/apps/filters/h3ToGeoBoundary.c +1 -0
- data/ext/h3/src/src/apps/filters/h3ToLocalIj.c +1 -0
- data/ext/h3/src/src/apps/filters/hexRange.c +1 -0
- data/ext/h3/src/src/apps/filters/kRing.c +1 -0
- data/ext/h3/src/src/apps/filters/localIjToH3.c +1 -0
- data/ext/h3/src/src/apps/miscapps/generateFaceCenterPoint.c +1 -0
- data/ext/h3/src/src/apps/miscapps/generateNumHexagons.c +1 -0
- data/ext/h3/src/src/apps/miscapps/generatePentagonDirectionFaces.c +67 -0
- data/ext/h3/src/src/apps/miscapps/h3ToGeoBoundaryHier.c +1 -0
- data/ext/h3/src/src/apps/miscapps/h3ToGeoHier.c +1 -0
- data/ext/h3/src/src/apps/miscapps/h3ToHier.c +1 -0
- data/ext/h3/src/src/apps/testapps/mkRandGeo.c +1 -0
- data/ext/h3/src/src/apps/testapps/mkRandGeoBoundary.c +1 -0
- data/ext/h3/src/src/apps/testapps/testBBox.c +1 -0
- data/ext/h3/src/src/apps/testapps/testBaseCells.c +15 -1
- data/ext/h3/src/src/apps/testapps/testCompact.c +75 -0
- data/ext/h3/src/src/apps/testapps/testCoordIj.c +1 -0
- data/ext/h3/src/src/apps/testapps/testGeoCoord.c +40 -13
- data/ext/h3/src/src/apps/testapps/testGeoToH3.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3Api.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3CellArea.c +47 -0
- data/ext/h3/src/src/apps/testapps/testH3CellAreaExhaustive.c +180 -0
- data/ext/h3/src/src/apps/testapps/testH3Distance.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3DistanceExhaustive.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3GetFaces.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3Index.c +33 -3
- data/ext/h3/src/src/apps/testapps/testH3Line.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3LineExhaustive.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3Memory.c +175 -0
- data/ext/h3/src/src/apps/testapps/testH3NeighborRotations.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3SetToLinkedGeo.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3SetToVertexGraph.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToCenterChild.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToChildren.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToGeo.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToGeoBoundary.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToLocalIj.c +9 -5
- data/ext/h3/src/src/apps/testapps/testH3ToLocalIjExhaustive.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3ToParent.c +1 -0
- data/ext/h3/src/src/apps/testapps/testH3UniEdge.c +45 -16
- data/ext/h3/src/src/apps/testapps/testH3UniEdgeExhaustive.c +111 -0
- data/ext/h3/src/src/apps/testapps/testHexRanges.c +1 -0
- data/ext/h3/src/src/apps/testapps/testHexRing.c +1 -0
- data/ext/h3/src/src/apps/testapps/testKRing.c +1 -0
- data/ext/h3/src/src/apps/testapps/testLinkedGeo.c +1 -0
- data/ext/h3/src/src/apps/testapps/testMaxH3ToChildrenSize.c +1 -0
- data/ext/h3/src/src/apps/testapps/testPentagonIndexes.c +1 -0
- data/ext/h3/src/src/apps/testapps/testPolyfill.c +72 -9
- data/ext/h3/src/src/apps/testapps/testPolyfillReported.c +157 -0
- data/ext/h3/src/src/apps/testapps/testPolygon.c +1 -0
- data/ext/h3/src/src/apps/testapps/testVec2d.c +1 -0
- data/ext/h3/src/src/apps/testapps/testVec3d.c +1 -0
- data/ext/h3/src/src/apps/testapps/testVertex.c +66 -0
- data/ext/h3/src/src/apps/testapps/testVertexGraph.c +1 -0
- data/ext/h3/src/src/h3lib/include/algos.h +8 -0
- data/ext/h3/src/src/h3lib/include/alloc.h +40 -0
- data/ext/h3/src/src/h3lib/include/baseCells.h +4 -0
- data/ext/h3/src/src/h3lib/include/bbox.h +4 -1
- data/ext/h3/src/src/h3lib/include/faceijk.h +3 -2
- data/ext/h3/src/src/h3lib/include/geoCoord.h +2 -3
- data/ext/h3/src/src/h3lib/include/h3Index.h +37 -4
- data/ext/h3/src/src/h3lib/include/h3api.h.in +65 -17
- data/ext/h3/src/src/h3lib/include/linkedGeo.h +1 -0
- data/ext/h3/src/src/h3lib/include/polygon.h +1 -0
- data/ext/h3/src/src/h3lib/include/polygonAlgos.h +1 -0
- data/ext/h3/src/src/h3lib/include/vertex.h +44 -0
- data/ext/h3/src/src/h3lib/include/vertexGraph.h +1 -0
- data/ext/h3/src/src/h3lib/lib/algos.c +300 -75
- data/ext/h3/src/src/h3lib/lib/baseCells.c +26 -4
- data/ext/h3/src/src/h3lib/lib/bbox.c +56 -31
- data/ext/h3/src/src/h3lib/lib/coordijk.c +2 -0
- data/ext/h3/src/src/h3lib/lib/faceijk.c +32 -21
- data/ext/h3/src/src/h3lib/lib/geoCoord.c +162 -44
- data/ext/h3/src/src/h3lib/lib/h3Index.c +81 -43
- data/ext/h3/src/src/h3lib/lib/h3UniEdge.c +42 -57
- data/ext/h3/src/src/h3lib/lib/linkedGeo.c +20 -15
- data/ext/h3/src/src/h3lib/lib/localij.c +1 -1
- data/ext/h3/src/src/h3lib/lib/polygon.c +2 -0
- data/ext/h3/src/src/h3lib/lib/vec2d.c +1 -0
- data/ext/h3/src/src/h3lib/lib/vec3d.c +1 -0
- data/ext/h3/src/src/h3lib/lib/vertex.c +134 -0
- data/ext/h3/src/src/h3lib/lib/vertexGraph.c +8 -5
- data/ext/h3/src/website/.eslintignore +2 -0
- data/ext/h3/src/website/.gitignore +57 -0
- data/ext/h3/src/website/.nvmrc +1 -0
- data/ext/h3/src/website/README.md +8 -6
- data/ext/h3/src/website/gatsby-config.js +83 -0
- data/ext/h3/src/website/package.json +20 -12
- data/ext/h3/src/website/scripts/build-to-gh-pages.sh +7 -5
- data/ext/h3/src/website/src/.gitkeep +0 -0
- data/ext/h3/src/website/templates/documentation.jsx +129 -0
- data/ext/h3/src/website/yarn.lock +13723 -0
- data/lib/h3/bindings/private.rb +3 -0
- data/lib/h3/miscellaneous.rb +123 -0
- data/lib/h3/version.rb +1 -1
- data/spec/miscellaneous_spec.rb +117 -0
- data/spec/regions_spec.rb +1 -1
- metadata +35 -14
- data/ext/h3/src/.ycm_extra_conf.py +0 -92
- data/ext/h3/src/appveyor.yml +0 -50
- data/ext/h3/src/src/apps/testapps/testPolyfill_GH136.c +0 -58
- data/ext/h3/src/website/src/config.js +0 -46
- data/ext/h3/src/website/src/mdRoutes.js +0 -151
- data/ext/h3/src/website/src/styles/_variables.scss +0 -16
- data/ext/h3/src/website/src/styles/index.scss +0 -3
- data/ext/h3/src/website/static/index.html +0 -15
data/ext/h3/src/CMakeLists.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2017-
|
|
1
|
+
# Copyright 2017-2020 Uber Technologies, Inc.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
cmake_minimum_required(VERSION 3.1)
|
|
16
16
|
|
|
17
17
|
set(H3_PREFIX "" CACHE STRING "Prefix for exported symbols")
|
|
18
|
+
set(H3_ALLOC_PREFIX "" CACHE STRING "Prefix for allocation functions")
|
|
18
19
|
|
|
19
20
|
# Needed due to CMP0042
|
|
20
21
|
set(CMAKE_MACOSX_RPATH 1)
|
|
@@ -34,7 +35,8 @@ option(BUILD_FILTERS "Build filter applications." ON)
|
|
|
34
35
|
option(BUILD_GENERATORS "Build code generation applications." ON)
|
|
35
36
|
|
|
36
37
|
if(WIN32)
|
|
37
|
-
|
|
38
|
+
# Use bash (usually from Git for Windows) for piping results
|
|
39
|
+
set(SHELL bash -c)
|
|
38
40
|
|
|
39
41
|
set(EXECUTABLE_OUTPUT_PATH bin)
|
|
40
42
|
set(LIBRARY_OUTPUT_PATH bin)
|
|
@@ -107,6 +109,7 @@ set(LIB_SOURCE_FILES
|
|
|
107
109
|
src/h3lib/lib/h3Index.c
|
|
108
110
|
src/h3lib/lib/vec2d.c
|
|
109
111
|
src/h3lib/lib/vec3d.c
|
|
112
|
+
src/h3lib/lib/vertex.c
|
|
110
113
|
src/h3lib/lib/linkedGeo.c
|
|
111
114
|
src/h3lib/lib/localij.c
|
|
112
115
|
src/h3lib/lib/geoCoord.c
|
|
@@ -143,7 +146,7 @@ set(OTHER_SOURCE_FILES
|
|
|
143
146
|
src/apps/testapps/testVertexGraph.c
|
|
144
147
|
src/apps/testapps/testCompact.c
|
|
145
148
|
src/apps/testapps/testPolyfill.c
|
|
146
|
-
src/apps/testapps/
|
|
149
|
+
src/apps/testapps/testPolyfillReported.c
|
|
147
150
|
src/apps/testapps/testPentagonIndexes.c
|
|
148
151
|
src/apps/testapps/testKRing.c
|
|
149
152
|
src/apps/testapps/testH3ToGeoBoundary.c
|
|
@@ -162,10 +165,12 @@ set(OTHER_SOURCE_FILES
|
|
|
162
165
|
src/apps/testapps/testHexRing.c
|
|
163
166
|
src/apps/testapps/testH3SetToVertexGraph.c
|
|
164
167
|
src/apps/testapps/testBBox.c
|
|
168
|
+
src/apps/testapps/testVertex.c
|
|
165
169
|
src/apps/testapps/testPolygon.c
|
|
166
170
|
src/apps/testapps/testVec2d.c
|
|
167
171
|
src/apps/testapps/testVec3d.c
|
|
168
172
|
src/apps/testapps/testH3UniEdge.c
|
|
173
|
+
src/apps/testapps/testH3UniEdgeExhaustive.c
|
|
169
174
|
src/apps/testapps/testLinkedGeo.c
|
|
170
175
|
src/apps/testapps/mkRandGeo.c
|
|
171
176
|
src/apps/testapps/testH3Api.c
|
|
@@ -176,11 +181,15 @@ set(OTHER_SOURCE_FILES
|
|
|
176
181
|
src/apps/testapps/testH3DistanceExhaustive.c
|
|
177
182
|
src/apps/testapps/testH3Line.c
|
|
178
183
|
src/apps/testapps/testH3LineExhaustive.c
|
|
184
|
+
src/apps/testapps/testH3CellArea.c
|
|
185
|
+
src/apps/testapps/testH3CellAreaExhaustive.c
|
|
179
186
|
src/apps/testapps/testCoordIj.c
|
|
180
187
|
src/apps/testapps/testCoordIjk.c
|
|
188
|
+
src/apps/testapps/testH3Memory.c
|
|
181
189
|
src/apps/miscapps/h3ToGeoBoundaryHier.c
|
|
182
190
|
src/apps/miscapps/h3ToGeoHier.c
|
|
183
191
|
src/apps/miscapps/generateBaseCellNeighbors.c
|
|
192
|
+
src/apps/miscapps/generatePentagonDirectionFaces.c
|
|
184
193
|
src/apps/miscapps/generateNumHexagons.c
|
|
185
194
|
src/apps/miscapps/generateFaceCenterPoint.c
|
|
186
195
|
src/apps/miscapps/h3ToHier.c
|
|
@@ -189,6 +198,7 @@ set(OTHER_SOURCE_FILES
|
|
|
189
198
|
src/apps/benchmarks/benchmarkH3SetToLinkedGeo.c
|
|
190
199
|
src/apps/benchmarks/benchmarkKRing.c
|
|
191
200
|
src/apps/benchmarks/benchmarkH3Line.c
|
|
201
|
+
src/apps/benchmarks/benchmarkH3UniEdge.c
|
|
192
202
|
src/apps/benchmarks/benchmarkH3Api.c)
|
|
193
203
|
|
|
194
204
|
set(ALL_SOURCE_FILES
|
|
@@ -198,36 +208,55 @@ set(UNCONFIGURED_API_HEADER src/h3lib/include/h3api.h.in)
|
|
|
198
208
|
set(CONFIGURED_API_HEADER src/h3lib/include/h3api.h)
|
|
199
209
|
configure_file(${UNCONFIGURED_API_HEADER} ${CONFIGURED_API_HEADER})
|
|
200
210
|
|
|
201
|
-
set(INSTALL_TARGETS
|
|
211
|
+
set(INSTALL_TARGETS)
|
|
202
212
|
|
|
203
|
-
|
|
204
|
-
add_library(
|
|
213
|
+
function(add_h3_library name h3_alloc_prefix_override)
|
|
214
|
+
add_library(${name} ${LIB_SOURCE_FILES} ${CONFIGURED_API_HEADER})
|
|
205
215
|
|
|
206
|
-
target_compile_options(
|
|
207
|
-
target_link_libraries(
|
|
216
|
+
target_compile_options(${name} PRIVATE ${H3_COMPILE_FLAGS})
|
|
217
|
+
target_link_libraries(${name} PRIVATE ${H3_LINK_FLAGS})
|
|
208
218
|
|
|
209
|
-
find_library(M_LIB m)
|
|
210
|
-
if(M_LIB)
|
|
211
|
-
|
|
212
|
-
endif()
|
|
219
|
+
find_library(M_LIB m)
|
|
220
|
+
if(M_LIB)
|
|
221
|
+
target_link_libraries(${name} PUBLIC ${M_LIB})
|
|
222
|
+
endif()
|
|
213
223
|
|
|
214
|
-
if(BUILD_SHARED_LIBS)
|
|
215
|
-
|
|
216
|
-
endif()
|
|
224
|
+
if(BUILD_SHARED_LIBS)
|
|
225
|
+
set_target_properties(${name} PROPERTIES SOVERSION ${H3_SOVERSION})
|
|
226
|
+
endif()
|
|
217
227
|
|
|
218
|
-
target_compile_definitions(
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
target_compile_definitions(${name} PUBLIC H3_PREFIX=${H3_PREFIX})
|
|
229
|
+
set(has_alloc_prefix NO)
|
|
230
|
+
if(h3_alloc_prefix_override)
|
|
231
|
+
set(has_alloc_prefix YES)
|
|
232
|
+
target_compile_definitions(${name} PUBLIC H3_ALLOC_PREFIX=${h3_alloc_prefix_override})
|
|
233
|
+
elseif(H3_ALLOC_PREFIX)
|
|
234
|
+
set(has_alloc_prefix YES)
|
|
235
|
+
target_compile_definitions(${name} PUBLIC H3_ALLOC_PREFIX=${H3_ALLOC_PREFIX})
|
|
236
|
+
endif()
|
|
237
|
+
# Mac OSX defaults to not looking up undefined symbols dynamically,
|
|
238
|
+
# so enable that explicitly.
|
|
239
|
+
if(has_alloc_prefix AND APPLE)
|
|
240
|
+
target_link_libraries(${name} PRIVATE "-undefined dynamic_lookup")
|
|
241
|
+
endif()
|
|
242
|
+
|
|
243
|
+
if(have_alloca)
|
|
244
|
+
target_compile_definitions(${name} PUBLIC H3_HAVE_ALLOCA)
|
|
245
|
+
endif()
|
|
246
|
+
if(have_vla)
|
|
247
|
+
target_compile_definitions(${name} PUBLIC H3_HAVE_VLA)
|
|
248
|
+
endif()
|
|
249
|
+
target_include_directories(${name} PUBLIC
|
|
250
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/h3lib/include>
|
|
251
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src/h3lib/include>)
|
|
252
|
+
endfunction()
|
|
253
|
+
|
|
254
|
+
# Build the H3 library
|
|
255
|
+
add_h3_library(h3 "")
|
|
228
256
|
|
|
229
257
|
# Automatic code formatting
|
|
230
|
-
|
|
258
|
+
# Give preference to clang-format-9
|
|
259
|
+
find_program(CLANG_FORMAT_PATH NAMES clang-format-9 clang-format)
|
|
231
260
|
cmake_dependent_option(
|
|
232
261
|
ENABLE_FORMAT "Enable running clang-format before compiling" ON
|
|
233
262
|
"CLANG_FORMAT_PATH" OFF)
|
|
@@ -366,6 +395,7 @@ endif()
|
|
|
366
395
|
if(BUILD_GENERATORS)
|
|
367
396
|
# Code generation
|
|
368
397
|
add_h3_executable(generateBaseCellNeighbors src/apps/miscapps/generateBaseCellNeighbors.c ${APP_SOURCE_FILES})
|
|
398
|
+
add_h3_executable(generatePentagonDirectionFaces src/apps/miscapps/generatePentagonDirectionFaces.c ${APP_SOURCE_FILES})
|
|
369
399
|
add_h3_executable(generateNumHexagons src/apps/miscapps/generateNumHexagons.c ${APP_SOURCE_FILES})
|
|
370
400
|
add_h3_executable(generateFaceCenterPoint src/apps/miscapps/generateFaceCenterPoint.c ${APP_SOURCE_FILES})
|
|
371
401
|
|
|
@@ -399,6 +429,37 @@ if(BUILD_TESTING)
|
|
|
399
429
|
)
|
|
400
430
|
endif()
|
|
401
431
|
|
|
432
|
+
add_h3_library(h3WithTestAllocators test_prefix_)
|
|
433
|
+
|
|
434
|
+
macro(add_h3_memory_test name srcfile)
|
|
435
|
+
# Like other test code, but these need to be linked against
|
|
436
|
+
# a different copy of the H3 library which has known intercepted
|
|
437
|
+
# allocator functions.
|
|
438
|
+
add_executable(${ARGV} ${APP_SOURCE_FILES})
|
|
439
|
+
|
|
440
|
+
if(TARGET ${name})
|
|
441
|
+
target_link_libraries(${name} PUBLIC h3WithTestAllocators)
|
|
442
|
+
target_include_directories(${name} PUBLIC
|
|
443
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/apps/applib/include>)
|
|
444
|
+
target_compile_options(${name} PRIVATE ${H3_COMPILE_FLAGS})
|
|
445
|
+
target_link_libraries(${name} PRIVATE ${H3_LINK_FLAGS})
|
|
446
|
+
endif()
|
|
447
|
+
|
|
448
|
+
math(EXPR test_number "${test_number}+1")
|
|
449
|
+
|
|
450
|
+
add_test(NAME ${name}_test${test_number} COMMAND ${TEST_WRAPPER} "$<TARGET_FILE:${name}>")
|
|
451
|
+
|
|
452
|
+
if(ENABLE_COVERAGE)
|
|
453
|
+
add_custom_target(${name}_coverage${test_number}
|
|
454
|
+
COMMAND ${name} > /dev/null
|
|
455
|
+
COMMENT "Running ${name}_coverage${test_number}"
|
|
456
|
+
)
|
|
457
|
+
|
|
458
|
+
add_dependencies(coverage ${name}_coverage${test_number})
|
|
459
|
+
add_dependencies(${name}_coverage${test_number} clean-coverage)
|
|
460
|
+
endif()
|
|
461
|
+
endmacro()
|
|
462
|
+
|
|
402
463
|
macro(add_h3_test_common name srcfile)
|
|
403
464
|
# need to actually make the test target
|
|
404
465
|
if(NOT TARGET ${name})
|
|
@@ -426,11 +487,7 @@ if(BUILD_TESTING)
|
|
|
426
487
|
macro(add_h3_test_with_file name srcfile argfile)
|
|
427
488
|
add_h3_test_common(${name} ${srcfile})
|
|
428
489
|
# add a special command (so we don't need to read the test file from the test program)
|
|
429
|
-
|
|
430
|
-
set(dump_command "Get-Content")
|
|
431
|
-
else()
|
|
432
|
-
set(dump_command "cat")
|
|
433
|
-
endif()
|
|
490
|
+
set(dump_command "cat")
|
|
434
491
|
|
|
435
492
|
add_test(NAME ${name}_test${test_number}
|
|
436
493
|
COMMAND ${SHELL} "${dump_command} ${argfile} | ${TEST_WRAPPER_STR} $<TARGET_FILE:${name}>")
|
|
@@ -471,7 +528,6 @@ if(BUILD_TESTING)
|
|
|
471
528
|
endmacro()
|
|
472
529
|
|
|
473
530
|
# Add each individual test
|
|
474
|
-
|
|
475
531
|
file(GLOB all_centers tests/inputfiles/bc*centers.txt)
|
|
476
532
|
foreach(file ${all_centers})
|
|
477
533
|
add_h3_test_with_file(testH3ToGeo src/apps/testapps/testH3ToGeo.c ${file})
|
|
@@ -507,17 +563,19 @@ if(BUILD_TESTING)
|
|
|
507
563
|
add_h3_test(testH3SetToVertexGraph src/apps/testapps/testH3SetToVertexGraph.c)
|
|
508
564
|
add_h3_test(testLinkedGeo src/apps/testapps/testLinkedGeo.c)
|
|
509
565
|
add_h3_test(testPolyfill src/apps/testapps/testPolyfill.c)
|
|
510
|
-
add_h3_test(
|
|
566
|
+
add_h3_test(testPolyfillReported src/apps/testapps/testPolyfillReported.c)
|
|
511
567
|
add_h3_test(testVertexGraph src/apps/testapps/testVertexGraph.c)
|
|
512
568
|
add_h3_test(testH3UniEdge src/apps/testapps/testH3UniEdge.c)
|
|
513
569
|
add_h3_test(testGeoCoord src/apps/testapps/testGeoCoord.c)
|
|
514
570
|
add_h3_test(testBBox src/apps/testapps/testBBox.c)
|
|
571
|
+
add_h3_test(testVertex src/apps/testapps/testVertex.c)
|
|
515
572
|
add_h3_test(testPolygon src/apps/testapps/testPolygon.c)
|
|
516
573
|
add_h3_test(testVec2d src/apps/testapps/testVec2d.c)
|
|
517
574
|
add_h3_test(testVec3d src/apps/testapps/testVec3d.c)
|
|
518
575
|
add_h3_test(testH3ToLocalIj src/apps/testapps/testH3ToLocalIj.c)
|
|
519
576
|
add_h3_test(testH3Distance src/apps/testapps/testH3Distance.c)
|
|
520
577
|
add_h3_test(testH3Line src/apps/testapps/testH3Line.c)
|
|
578
|
+
add_h3_test(testH3CellArea src/apps/testapps/testH3CellArea.c)
|
|
521
579
|
add_h3_test(testCoordIj src/apps/testapps/testCoordIj.c)
|
|
522
580
|
add_h3_test(testCoordIjk src/apps/testapps/testCoordIjk.c)
|
|
523
581
|
add_h3_test(testBaseCells src/apps/testapps/testBaseCells.c)
|
|
@@ -529,9 +587,13 @@ if(BUILD_TESTING)
|
|
|
529
587
|
|
|
530
588
|
# The "Exhaustive" part of the test name is used by the test-fast to exclude these files.
|
|
531
589
|
# test-fast exists so that Travis CI can run Valgrind on tests without taking a very long time.
|
|
590
|
+
add_h3_test(testH3UniEdgeExhaustive src/apps/testapps/testH3UniEdgeExhaustive.c)
|
|
532
591
|
add_h3_test(testH3ToLocalIjExhaustive src/apps/testapps/testH3ToLocalIjExhaustive.c)
|
|
533
592
|
add_h3_test(testH3LineExhaustive src/apps/testapps/testH3LineExhaustive.c)
|
|
534
593
|
add_h3_test(testH3DistanceExhaustive src/apps/testapps/testH3DistanceExhaustive.c)
|
|
594
|
+
add_h3_test(testH3CellAreaExhaustive src/apps/testapps/testH3CellAreaExhaustive.c)
|
|
595
|
+
|
|
596
|
+
add_h3_memory_test(testH3Memory src/apps/testapps/testH3Memory.c)
|
|
535
597
|
|
|
536
598
|
add_custom_target(test-fast COMMAND ctest -E Exhaustive)
|
|
537
599
|
endif()
|
|
@@ -549,6 +611,7 @@ if(BUILD_BENCHMARKS)
|
|
|
549
611
|
add_h3_benchmark(benchmarkH3Api src/apps/benchmarks/benchmarkH3Api.c)
|
|
550
612
|
add_h3_benchmark(benchmarkKRing src/apps/benchmarks/benchmarkKRing.c)
|
|
551
613
|
add_h3_benchmark(benchmarkH3Line src/apps/benchmarks/benchmarkH3Line.c)
|
|
614
|
+
add_h3_benchmark(benchmarkH3UniEdge src/apps/benchmarks/benchmarkH3UniEdge.c)
|
|
552
615
|
add_h3_benchmark(benchmarkH3SetToLinkedGeo src/apps/benchmarks/benchmarkH3SetToLinkedGeo.c)
|
|
553
616
|
add_h3_benchmark(benchmarkPolyfill src/apps/benchmarks/benchmarkPolyfill.c)
|
|
554
617
|
add_h3_benchmark(benchmarkPolygon src/apps/benchmarks/benchmarkPolygon.c)
|
|
@@ -571,6 +634,10 @@ set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
|
|
|
571
634
|
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
|
572
635
|
set(namespace "${PROJECT_NAME}::")
|
|
573
636
|
|
|
637
|
+
# TODO: Unclear why this is needed to get the libh3 Debian package to build correctly
|
|
638
|
+
# with shared libraries.
|
|
639
|
+
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "libh3")
|
|
640
|
+
|
|
574
641
|
# Include module with fuction 'write_basic_package_version_file'
|
|
575
642
|
include(CMakePackageConfigHelpers)
|
|
576
643
|
|
|
@@ -599,6 +666,14 @@ configure_package_config_file(
|
|
|
599
666
|
install(
|
|
600
667
|
TARGETS ${INSTALL_TARGETS}
|
|
601
668
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
|
669
|
+
RUNTIME DESTINATION "bin"
|
|
670
|
+
COMPONENT h3
|
|
671
|
+
)
|
|
672
|
+
|
|
673
|
+
install(
|
|
674
|
+
TARGETS h3
|
|
675
|
+
EXPORT "${TARGETS_EXPORT_NAME}"
|
|
676
|
+
COMPONENT libh3
|
|
602
677
|
LIBRARY DESTINATION "lib"
|
|
603
678
|
ARCHIVE DESTINATION "lib"
|
|
604
679
|
RUNTIME DESTINATION "bin"
|
|
@@ -611,6 +686,7 @@ install(
|
|
|
611
686
|
install(
|
|
612
687
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/src/h3lib/include/h3api.h"
|
|
613
688
|
DESTINATION "${include_install_dir}/h3"
|
|
689
|
+
COMPONENT libh3-dev
|
|
614
690
|
)
|
|
615
691
|
|
|
616
692
|
# Config
|
|
@@ -619,6 +695,7 @@ install(
|
|
|
619
695
|
install(
|
|
620
696
|
FILES "${project_config}" "${version_config}"
|
|
621
697
|
DESTINATION "${config_install_dir}"
|
|
698
|
+
COMPONENT libh3-dev
|
|
622
699
|
)
|
|
623
700
|
|
|
624
701
|
# Config
|
|
@@ -627,4 +704,27 @@ install(
|
|
|
627
704
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
|
628
705
|
NAMESPACE "${namespace}"
|
|
629
706
|
DESTINATION "${config_install_dir}"
|
|
707
|
+
COMPONENT libh3-dev
|
|
630
708
|
)
|
|
709
|
+
|
|
710
|
+
# Debian package build
|
|
711
|
+
set(CPACK_DEB_COMPONENT_INSTALL 1)
|
|
712
|
+
set(CPACK_GENERATOR "DEB")
|
|
713
|
+
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
|
714
|
+
# set(CPACK_DEBIAN_PACKAGE_MAINTAINER "TEST PACKAGE") # Required
|
|
715
|
+
set(CPACK_PACKAGE_HOMEPAGE_URL "https://www.h3geo.org")
|
|
716
|
+
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
|
717
|
+
set(CPACK_DEBIAN_LIBH3_PACKAGE_DEPENDS "libc6 (>= 2.27)")
|
|
718
|
+
set(CPACK_DEBIAN_LIBH3-DEV_PACKAGE_DEPENDS "libh3 (= ${H3_VERSION})")
|
|
719
|
+
set(CPACK_DEBIAN_H3_PACKAGE_DEPENDS "libc6 (>= 2.27), libh3 (= ${H3_VERSION})")
|
|
720
|
+
set(CPACK_DEBIAN_LIBH3_DESCRIPTION "Library files for the H3 hexagonal discrete global grid system.")
|
|
721
|
+
set(CPACK_DEBIAN_LIBH3-DEV_DESCRIPTION "Development files and headers for the H3 hexagonal discrete global grid system.")
|
|
722
|
+
set(CPACK_DEBIAN_H3_DESCRIPTION "UNIX style filter (command line) tools for the H3 hexagonal discrete global grid system.")
|
|
723
|
+
set(CPACK_DEBIAN_LIBH3_PACKAGE_NAME "libh3")
|
|
724
|
+
set(CPACK_DEBIAN_LIBH3-DEV_PACKAGE_NAME "libh3-dev")
|
|
725
|
+
set(CPACK_DEBIAN_H3_PACKAGE_NAME "h3")
|
|
726
|
+
set(CPACK_DEBIAN_LIBH3_PACKAGE_SECTION "libs")
|
|
727
|
+
set(CPACK_DEBIAN_LIBH3-DEV_PACKAGE_SECTION "libdevel")
|
|
728
|
+
set(CPACK_DEBIAN_H3_PACKAGE_SECTION "science")
|
|
729
|
+
|
|
730
|
+
include(CPack)
|
data/ext/h3/src/CONTRIBUTING.md
CHANGED
|
@@ -9,7 +9,7 @@ Planned improvements and changes are listed on the [H3 Roadmap](https://github.c
|
|
|
9
9
|
* Please include tests that show the bug is fixed or feature works as intended.
|
|
10
10
|
* Please add a description of your change to the Unreleased section of the [changelog](./CHANGELOG.md).
|
|
11
11
|
* Please open issues to discuss large features or changes which would break compatibility, before submitting pull requests.
|
|
12
|
-
* Please keep H3 compatible with major C compilers, such as GCC, Clang, and MSVC.
|
|
12
|
+
* Please keep H3 compatible with major C compilers, such as GCC, Clang, and MSVC. We use clang-format-9 for source code formatting, if you have another version the CI job may error on formatting differences.
|
|
13
13
|
* Please keep code coverage of the core H3 library at 100%.
|
|
14
14
|
|
|
15
15
|
Before we can merge your changes, you must agree to the [Uber Contributor License Agreement](https://cla-assistant.io/uber/h3).
|
data/ext/h3/src/README.md
CHANGED
|
@@ -2,23 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
# H3: A Hexagonal Hierarchical Geospatial Indexing System
|
|
4
4
|
|
|
5
|
-
[](https://github.com/uber/h3/actions)
|
|
6
|
+
[](https://github.com/uber/h3/actions)
|
|
7
|
+
[](https://github.com/uber/h3/actions)
|
|
8
|
+
[](https://github.com/uber/h3/actions)
|
|
7
9
|
[](https://coveralls.io/github/uber/h3?branch=master)
|
|
8
10
|
[](LICENSE)
|
|
9
11
|
|
|
10
12
|
H3 is a geospatial indexing system using a hexagonal grid that can be (approximately) subdivided into finer and finer hexagonal grids, combining the benefits of a hexagonal grid with [S2](https://code.google.com/archive/p/s2-geometry-library/)'s hierarchical subdivisions.
|
|
11
13
|
|
|
12
|
-
Documentation is available at [https://
|
|
14
|
+
Documentation is available at [https://h3geo.org/](https://h3geo.org/). Developer documentation in Markdown format is available under the [dev-docs](./dev-docs/) directory.
|
|
13
15
|
|
|
14
16
|
* Post **bug reports or feature requests** to the [GitHub Issues page](https://github.com/uber/h3/issues)
|
|
15
17
|
* Ask **questions** by posting to the [H3 tag on StackOverflow](https://stackoverflow.com/questions/tagged/h3)
|
|
18
|
+
* There is also an [H3 Slack workspace](https://join.slack.com/t/h3-core/shared_invite/zt-g6u5r1hf-W_~uVJmfeiWtMQuBGc1NNg)
|
|
16
19
|
|
|
17
20
|
## Installing
|
|
18
21
|
|
|
19
|
-
We recommend using prebuilt bindings if they are available for your programming language. Bindings for [Go](https://github.com/uber/h3-go), [Java](https://github.com/uber/h3-java), [JavaScript](https://github.com/uber/h3-js), [Python](https://github.com/uber/h3-py), and [others](https://
|
|
22
|
+
We recommend using prebuilt bindings if they are available for your programming language. Bindings for [Go](https://github.com/uber/h3-go), [Java](https://github.com/uber/h3-java), [JavaScript](https://github.com/uber/h3-js), [Python](https://github.com/uber/h3-py), and [others](https://h3geo.org/docs/community/bindings) are available.
|
|
20
23
|
|
|
21
|
-
On macOS, you can install H3 using brew
|
|
24
|
+
On macOS, you can install H3 using `brew`:
|
|
22
25
|
```
|
|
23
26
|
brew install h3
|
|
24
27
|
```
|
|
@@ -30,7 +33,7 @@ Still here? To build the H3 C library, you'll need a C compiler (tested with `gc
|
|
|
30
33
|
|
|
31
34
|
#### Install build-time dependencies
|
|
32
35
|
|
|
33
|
-
* Alpine
|
|
36
|
+
* Alpine
|
|
34
37
|
```
|
|
35
38
|
# Installing the bare build requirements
|
|
36
39
|
apk add cmake make gcc libtool musl-dev
|
|
@@ -45,7 +48,7 @@ sudo apt install cmake make gcc libtool
|
|
|
45
48
|
sudo apt install clang-format cmake-curses-gui lcov doxygen
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
* macOS (using brew)
|
|
51
|
+
* macOS (using `brew`)
|
|
49
52
|
|
|
50
53
|
First make sure you [have the developer tools installed](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/) and then
|
|
51
54
|
|
|
@@ -60,24 +63,71 @@ brew install clang-format lcov doxygen
|
|
|
60
63
|
|
|
61
64
|
You will need to install CMake and Visual Studio, including the Visual C++ compiler. For building on Windows, please follow the [Windows build instructions](dev-docs/build_windows.md).
|
|
62
65
|
|
|
66
|
+
* FreeBSD
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
# Installing the build requirements
|
|
70
|
+
sudo pkg install bash cmake gmake doxygen lcov
|
|
71
|
+
```
|
|
72
|
+
|
|
63
73
|
#### Compilation
|
|
64
74
|
|
|
65
|
-
From the repository you
|
|
75
|
+
From the repository root, you can compile H3 with:
|
|
66
76
|
|
|
67
77
|
```
|
|
68
|
-
|
|
78
|
+
mkdir build
|
|
79
|
+
cd build
|
|
80
|
+
cmake ..
|
|
69
81
|
make
|
|
70
82
|
```
|
|
71
83
|
|
|
84
|
+
All subsequent `make` commands should be run from within the `build` directory.
|
|
85
|
+
|
|
86
|
+
**Note**: There are several ways to build H3 with CMake; the method above is just one example that restricts all build artifacts to the `build` directory.
|
|
87
|
+
|
|
72
88
|
You can install system-wide with:
|
|
73
89
|
|
|
74
90
|
```
|
|
75
91
|
sudo make install
|
|
76
92
|
```
|
|
77
93
|
|
|
94
|
+
If using the method above, from the repository root, you can clean all build artifacts with:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
rm -rf build
|
|
98
|
+
```
|
|
99
|
+
|
|
78
100
|
#### Testing
|
|
79
101
|
|
|
80
|
-
After making the project, you can test with `make test
|
|
102
|
+
After making the project, you can test with `make test`.
|
|
103
|
+
You can run a faster test suite that excludes the most expensive tests with `make test-fast`.
|
|
104
|
+
|
|
105
|
+
#### Coverage
|
|
106
|
+
|
|
107
|
+
You can generate a code coverage report if `lcov` is installed, and if the project was built with the `CMAKE_BUILD_TYPE=Debug` option.
|
|
108
|
+
For example, from a clean repository, you could run:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
mkdir build
|
|
112
|
+
cd build
|
|
113
|
+
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
|
114
|
+
make
|
|
115
|
+
make coverage
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
You can then view a detailed HTML coverage report by opening `coverage/index.html` in your browser.
|
|
119
|
+
|
|
120
|
+
#### Benchmarks
|
|
121
|
+
|
|
122
|
+
You can run timing benchmarks by building with the `CMAKE_BUILD_TYPE=Release`, and running `make benchmarks`:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
mkdir build
|
|
126
|
+
cd build
|
|
127
|
+
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
128
|
+
make
|
|
129
|
+
make benchmarks
|
|
130
|
+
```
|
|
81
131
|
|
|
82
132
|
#### Documentation
|
|
83
133
|
|