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.
Files changed (161) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +23 -0
  3. data/Gemfile.lock +6 -6
  4. data/README.md +1 -1
  5. data/ext/h3/src/.github/workflows/test-linux.yml +118 -0
  6. data/ext/h3/src/.github/workflows/test-macos.yml +42 -0
  7. data/ext/h3/src/.github/workflows/test-website.yml +32 -0
  8. data/ext/h3/src/.github/workflows/test-windows.yml +44 -0
  9. data/ext/h3/src/.gitignore +5 -0
  10. data/ext/h3/src/.travis.yml +16 -46
  11. data/ext/h3/src/CHANGELOG.md +43 -0
  12. data/ext/h3/src/CMakeLists.txt +133 -33
  13. data/ext/h3/src/CONTRIBUTING.md +1 -1
  14. data/ext/h3/src/README.md +60 -10
  15. data/ext/h3/src/RELEASE.md +3 -1
  16. data/ext/h3/src/VERSION +1 -1
  17. data/ext/h3/src/dev-docs/RFCs/rfc-template.md +21 -0
  18. data/ext/h3/src/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +21 -0
  19. data/ext/h3/src/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md +276 -0
  20. data/ext/h3/src/dev-docs/RFCs/v4.0.0/overrideable-allocators-rfc.md +141 -0
  21. data/ext/h3/src/dev-docs/RFCs/v4.0.0/polyfill-modes-rfc.md +21 -0
  22. data/ext/h3/src/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md +50 -0
  23. data/ext/h3/src/dev-docs/build_windows.md +6 -1
  24. data/ext/h3/src/dev-docs/creating_bindings.md +3 -3
  25. data/ext/h3/src/dev-docs/custom_alloc.md +27 -0
  26. data/ext/h3/src/docs/{overview/mainpage.md → README.md} +2 -3
  27. data/ext/h3/src/docs/api/misc.md +76 -0
  28. data/ext/h3/src/docs/community/applications.md +1 -0
  29. data/ext/h3/src/docs/community/bindings.md +7 -1
  30. data/ext/h3/src/docs/community/tutorials.md +8 -3
  31. data/ext/h3/src/docs/core-library/coordsystems.md +5 -4
  32. data/ext/h3/src/docs/core-library/filters.md +8 -9
  33. data/ext/h3/src/docs/core-library/geoToH3desc.md +2 -3
  34. data/ext/h3/src/docs/core-library/h3ToGeoBoundaryDesc.md +4 -5
  35. data/ext/h3/src/docs/core-library/h3ToGeoDesc.md +3 -4
  36. data/ext/h3/src/docs/core-library/h3indexing.md +26 -17
  37. data/ext/h3/src/docs/core-library/overview.md +2 -3
  38. data/ext/h3/src/docs/core-library/restable.md +1 -2
  39. data/ext/h3/src/docs/core-library/usage.md +1 -2
  40. data/ext/h3/src/docs/table-of-contents.json +47 -0
  41. data/ext/h3/src/docs/{overview/usecases.md → usecases.md} +6 -11
  42. data/ext/h3/src/scripts/binding_functions.sh +1 -1
  43. data/ext/h3/src/scripts/coverage.sh.in +1 -1
  44. data/ext/h3/src/scripts/update_version.sh +2 -2
  45. data/ext/h3/src/src/apps/applib/include/args.h +1 -0
  46. data/ext/h3/src/src/apps/applib/include/test.h +1 -0
  47. data/ext/h3/src/src/apps/applib/include/utility.h +7 -1
  48. data/ext/h3/src/src/apps/applib/lib/args.c +2 -0
  49. data/ext/h3/src/src/apps/applib/lib/kml.c +2 -0
  50. data/ext/h3/src/src/apps/applib/lib/test.c +1 -0
  51. data/ext/h3/src/src/apps/applib/lib/utility.c +133 -2
  52. data/ext/h3/src/src/apps/benchmarks/benchmarkH3Api.c +1 -1
  53. data/ext/h3/src/{website/html.config.js → src/apps/benchmarks/benchmarkH3UniEdge.c} +15 -12
  54. data/ext/h3/src/src/apps/filters/h3ToComponents.c +1 -0
  55. data/ext/h3/src/src/apps/filters/h3ToGeo.c +1 -0
  56. data/ext/h3/src/src/apps/filters/h3ToGeoBoundary.c +1 -0
  57. data/ext/h3/src/src/apps/filters/h3ToLocalIj.c +1 -0
  58. data/ext/h3/src/src/apps/filters/hexRange.c +1 -0
  59. data/ext/h3/src/src/apps/filters/kRing.c +1 -0
  60. data/ext/h3/src/src/apps/filters/localIjToH3.c +1 -0
  61. data/ext/h3/src/src/apps/miscapps/generateFaceCenterPoint.c +1 -0
  62. data/ext/h3/src/src/apps/miscapps/generateNumHexagons.c +1 -0
  63. data/ext/h3/src/src/apps/miscapps/generatePentagonDirectionFaces.c +67 -0
  64. data/ext/h3/src/src/apps/miscapps/h3ToGeoBoundaryHier.c +1 -0
  65. data/ext/h3/src/src/apps/miscapps/h3ToGeoHier.c +1 -0
  66. data/ext/h3/src/src/apps/miscapps/h3ToHier.c +1 -0
  67. data/ext/h3/src/src/apps/testapps/mkRandGeo.c +1 -0
  68. data/ext/h3/src/src/apps/testapps/mkRandGeoBoundary.c +1 -0
  69. data/ext/h3/src/src/apps/testapps/testBBox.c +1 -0
  70. data/ext/h3/src/src/apps/testapps/testBaseCells.c +15 -1
  71. data/ext/h3/src/src/apps/testapps/testCompact.c +75 -0
  72. data/ext/h3/src/src/apps/testapps/testCoordIj.c +1 -0
  73. data/ext/h3/src/src/apps/testapps/testGeoCoord.c +40 -13
  74. data/ext/h3/src/src/apps/testapps/testGeoToH3.c +1 -0
  75. data/ext/h3/src/src/apps/testapps/testH3Api.c +1 -0
  76. data/ext/h3/src/src/apps/testapps/testH3CellArea.c +47 -0
  77. data/ext/h3/src/src/apps/testapps/testH3CellAreaExhaustive.c +180 -0
  78. data/ext/h3/src/src/apps/testapps/testH3Distance.c +1 -0
  79. data/ext/h3/src/src/apps/testapps/testH3DistanceExhaustive.c +1 -0
  80. data/ext/h3/src/src/apps/testapps/testH3GetFaces.c +1 -0
  81. data/ext/h3/src/src/apps/testapps/testH3Index.c +33 -3
  82. data/ext/h3/src/src/apps/testapps/testH3Line.c +1 -0
  83. data/ext/h3/src/src/apps/testapps/testH3LineExhaustive.c +1 -0
  84. data/ext/h3/src/src/apps/testapps/testH3Memory.c +175 -0
  85. data/ext/h3/src/src/apps/testapps/testH3NeighborRotations.c +1 -0
  86. data/ext/h3/src/src/apps/testapps/testH3SetToLinkedGeo.c +1 -0
  87. data/ext/h3/src/src/apps/testapps/testH3SetToVertexGraph.c +1 -0
  88. data/ext/h3/src/src/apps/testapps/testH3ToCenterChild.c +1 -0
  89. data/ext/h3/src/src/apps/testapps/testH3ToChildren.c +1 -0
  90. data/ext/h3/src/src/apps/testapps/testH3ToGeo.c +1 -0
  91. data/ext/h3/src/src/apps/testapps/testH3ToGeoBoundary.c +1 -0
  92. data/ext/h3/src/src/apps/testapps/testH3ToLocalIj.c +9 -5
  93. data/ext/h3/src/src/apps/testapps/testH3ToLocalIjExhaustive.c +1 -0
  94. data/ext/h3/src/src/apps/testapps/testH3ToParent.c +1 -0
  95. data/ext/h3/src/src/apps/testapps/testH3UniEdge.c +45 -16
  96. data/ext/h3/src/src/apps/testapps/testH3UniEdgeExhaustive.c +111 -0
  97. data/ext/h3/src/src/apps/testapps/testHexRanges.c +1 -0
  98. data/ext/h3/src/src/apps/testapps/testHexRing.c +1 -0
  99. data/ext/h3/src/src/apps/testapps/testKRing.c +1 -0
  100. data/ext/h3/src/src/apps/testapps/testLinkedGeo.c +1 -0
  101. data/ext/h3/src/src/apps/testapps/testMaxH3ToChildrenSize.c +1 -0
  102. data/ext/h3/src/src/apps/testapps/testPentagonIndexes.c +1 -0
  103. data/ext/h3/src/src/apps/testapps/testPolyfill.c +72 -9
  104. data/ext/h3/src/src/apps/testapps/testPolyfillReported.c +157 -0
  105. data/ext/h3/src/src/apps/testapps/testPolygon.c +1 -0
  106. data/ext/h3/src/src/apps/testapps/testVec2d.c +1 -0
  107. data/ext/h3/src/src/apps/testapps/testVec3d.c +1 -0
  108. data/ext/h3/src/src/apps/testapps/testVertex.c +66 -0
  109. data/ext/h3/src/src/apps/testapps/testVertexGraph.c +1 -0
  110. data/ext/h3/src/src/h3lib/include/algos.h +8 -0
  111. data/ext/h3/src/src/h3lib/include/alloc.h +40 -0
  112. data/ext/h3/src/src/h3lib/include/baseCells.h +4 -0
  113. data/ext/h3/src/src/h3lib/include/bbox.h +4 -1
  114. data/ext/h3/src/src/h3lib/include/faceijk.h +3 -2
  115. data/ext/h3/src/src/h3lib/include/geoCoord.h +2 -3
  116. data/ext/h3/src/src/h3lib/include/h3Index.h +37 -4
  117. data/ext/h3/src/src/h3lib/include/h3api.h.in +65 -17
  118. data/ext/h3/src/src/h3lib/include/linkedGeo.h +1 -0
  119. data/ext/h3/src/src/h3lib/include/polygon.h +1 -0
  120. data/ext/h3/src/src/h3lib/include/polygonAlgos.h +1 -0
  121. data/ext/h3/src/src/h3lib/include/vertex.h +44 -0
  122. data/ext/h3/src/src/h3lib/include/vertexGraph.h +1 -0
  123. data/ext/h3/src/src/h3lib/lib/algos.c +300 -75
  124. data/ext/h3/src/src/h3lib/lib/baseCells.c +26 -4
  125. data/ext/h3/src/src/h3lib/lib/bbox.c +56 -31
  126. data/ext/h3/src/src/h3lib/lib/coordijk.c +2 -0
  127. data/ext/h3/src/src/h3lib/lib/faceijk.c +32 -21
  128. data/ext/h3/src/src/h3lib/lib/geoCoord.c +162 -44
  129. data/ext/h3/src/src/h3lib/lib/h3Index.c +81 -43
  130. data/ext/h3/src/src/h3lib/lib/h3UniEdge.c +42 -57
  131. data/ext/h3/src/src/h3lib/lib/linkedGeo.c +20 -15
  132. data/ext/h3/src/src/h3lib/lib/localij.c +1 -1
  133. data/ext/h3/src/src/h3lib/lib/polygon.c +2 -0
  134. data/ext/h3/src/src/h3lib/lib/vec2d.c +1 -0
  135. data/ext/h3/src/src/h3lib/lib/vec3d.c +1 -0
  136. data/ext/h3/src/src/h3lib/lib/vertex.c +134 -0
  137. data/ext/h3/src/src/h3lib/lib/vertexGraph.c +8 -5
  138. data/ext/h3/src/website/.eslintignore +2 -0
  139. data/ext/h3/src/website/.gitignore +57 -0
  140. data/ext/h3/src/website/.nvmrc +1 -0
  141. data/ext/h3/src/website/README.md +8 -6
  142. data/ext/h3/src/website/gatsby-config.js +83 -0
  143. data/ext/h3/src/website/package.json +20 -12
  144. data/ext/h3/src/website/scripts/build-to-gh-pages.sh +7 -5
  145. data/ext/h3/src/website/src/.gitkeep +0 -0
  146. data/ext/h3/src/website/templates/documentation.jsx +129 -0
  147. data/ext/h3/src/website/yarn.lock +13723 -0
  148. data/lib/h3/bindings/private.rb +3 -0
  149. data/lib/h3/miscellaneous.rb +123 -0
  150. data/lib/h3/version.rb +1 -1
  151. data/spec/miscellaneous_spec.rb +117 -0
  152. data/spec/regions_spec.rb +1 -1
  153. metadata +35 -14
  154. data/ext/h3/src/.ycm_extra_conf.py +0 -92
  155. data/ext/h3/src/appveyor.yml +0 -50
  156. data/ext/h3/src/src/apps/testapps/testPolyfill_GH136.c +0 -58
  157. data/ext/h3/src/website/src/config.js +0 -46
  158. data/ext/h3/src/website/src/mdRoutes.js +0 -151
  159. data/ext/h3/src/website/src/styles/_variables.scss +0 -16
  160. data/ext/h3/src/website/src/styles/index.scss +0 -3
  161. data/ext/h3/src/website/static/index.html +0 -15
@@ -1,4 +1,4 @@
1
- # Copyright 2017-2019 Uber Technologies, Inc.
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
- set(SHELL PowerShell -Command)
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/testPolyfill_GH136.c
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 h3)
211
+ set(INSTALL_TARGETS)
202
212
 
203
- # Build the H3 library
204
- add_library(h3 ${LIB_SOURCE_FILES} ${CONFIGURED_API_HEADER})
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(h3 PRIVATE ${H3_COMPILE_FLAGS})
207
- target_link_libraries(h3 PRIVATE ${H3_LINK_FLAGS})
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
- target_link_libraries(h3 PUBLIC ${M_LIB})
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
- set_target_properties(h3 PROPERTIES SOVERSION ${H3_SOVERSION})
216
- endif()
224
+ if(BUILD_SHARED_LIBS)
225
+ set_target_properties(${name} PROPERTIES SOVERSION ${H3_SOVERSION})
226
+ endif()
217
227
 
218
- target_compile_definitions(h3 PUBLIC H3_PREFIX=${H3_PREFIX})
219
- if(have_alloca)
220
- target_compile_definitions(h3 PUBLIC H3_HAVE_ALLOCA)
221
- endif()
222
- if(have_vla)
223
- target_compile_definitions(h3 PUBLIC H3_HAVE_VLA)
224
- endif()
225
- target_include_directories(h3 PUBLIC
226
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/h3lib/include>
227
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src/h3lib/include>)
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
- find_program(CLANG_FORMAT_PATH clang-format)
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
- if(WIN32)
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(testPolyfill_GH136 src/apps/testapps/testPolyfill_GH136.c)
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)
@@ -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).
@@ -2,23 +2,26 @@
2
2
 
3
3
  # H3: A Hexagonal Hierarchical Geospatial Indexing System
4
4
 
5
- [![Build Status](https://travis-ci.com/uber/h3.svg?branch=master)](https://travis-ci.com/uber/h3)
6
- [![Build status](https://ci.appveyor.com/api/projects/status/61431y4sc5w0tsuk/branch/master?svg=true)](https://ci.appveyor.com/project/Uber/h3/branch/master)
5
+ [![test-linux](https://github.com/uber/h3/workflows/test-linux/badge.svg)](https://github.com/uber/h3/actions)
6
+ [![test-macos](https://github.com/uber/h3/workflows/test-macos/badge.svg)](https://github.com/uber/h3/actions)
7
+ [![test-windows](https://github.com/uber/h3/workflows/test-windows/badge.svg)](https://github.com/uber/h3/actions)
8
+ [![test-website](https://github.com/uber/h3/workflows/test-website/badge.svg)](https://github.com/uber/h3/actions)
7
9
  [![Coverage Status](https://coveralls.io/repos/github/uber/h3/badge.svg?branch=master)](https://coveralls.io/github/uber/h3?branch=master)
8
10
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](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://uber.github.io/h3/](https://uber.github.io/h3/). Developer documentation in Markdown format is available under the [dev-docs](./dev-docs/) directory.
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://uber.github.io/h3/#/documentation/community/bindings) are available.
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 would then compile like so:
75
+ From the repository root, you can compile H3 with:
66
76
 
67
77
  ```
68
- cmake .
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`, and if `lcov` is installed you can `make coverage` to generate a code coverage report.
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