Permalink
Browse files

Import the library

  • Loading branch information...
isaacbrodsky committed Jan 8, 2018
1 parent c6afc5c commit 1dcd63bcce28c850d5e6e2f3b095cb06ee6420fc
Showing with 1,495,860 additions and 0 deletions.
  1. +10 −0 CHANGELOG
  2. +321 −0 CMakeLists.txt
  3. +278 −0 KML/icosa.kml
  4. +202 −0 LICENSE
  5. +137 −0 README.md
  6. +1 −0 VERSION
  7. +1,111 −0 docs/Doxyfile.in
  8. +32 −0 docs/doxyfiles/coordsystems.md
  9. +47 −0 docs/doxyfiles/filters.md
  10. +16 −0 docs/doxyfiles/geoToH3desc.md
  11. +14 −0 docs/doxyfiles/h3ToGeoBoundaryDesc.md
  12. +17 −0 docs/doxyfiles/h3ToGeoDesc.md
  13. +104 −0 docs/doxyfiles/h3indexing.md
  14. BIN docs/doxyfiles/images/ca_compact_6_901.png
  15. BIN docs/doxyfiles/images/ca_uncompact_6_10633.png
  16. BIN docs/doxyfiles/images/classII.III.png
  17. BIN docs/doxyfiles/images/cpidigits.png
  18. BIN docs/doxyfiles/images/ijkp.png
  19. BIN docs/doxyfiles/images/neighbors-hexagon.png
  20. BIN docs/doxyfiles/images/neighbors-square.png
  21. BIN docs/doxyfiles/images/neighbors-triangle.png
  22. BIN docs/doxyfiles/images/neighbors.png
  23. BIN docs/doxyfiles/images/parent-child.png
  24. BIN docs/doxyfiles/images/substrate3.png
  25. BIN docs/doxyfiles/images/triEdge.png
  26. +31 −0 docs/doxyfiles/mainpage.md
  27. +14 −0 docs/doxyfiles/overview.md
  28. +21 −0 docs/doxyfiles/restable.md
  29. +8 −0 docs/doxyfiles/usage.md
  30. +47 −0 docs/doxyfiles/usecases.md
  31. +48 −0 examples/index.c
  32. +21 −0 scripts/binding_functions.sh
  33. +49 −0 src/apps/applib/include/benchmark.h
  34. +41 −0 src/apps/applib/include/kml.h
  35. +40 −0 src/apps/applib/include/test.h
  36. +45 −0 src/apps/applib/include/utility.h
  37. +162 −0 src/apps/applib/lib/kml.c
  38. +36 −0 src/apps/applib/lib/test.c
  39. +165 −0 src/apps/applib/lib/utility.c
  40. +37 −0 src/apps/benchmarks/benchmarkH3Api.c
  41. +145 −0 src/apps/benchmarks/benchmarkPolyfill.c
  42. +73 −0 src/apps/filters/geoToH3.c
  43. +130 −0 src/apps/filters/h3ToComponents.c
  44. +117 −0 src/apps/filters/h3ToGeo.c
  45. +116 −0 src/apps/filters/h3ToGeoBoundary.c
  46. +78 −0 src/apps/filters/hexRange.c
  47. +72 −0 src/apps/filters/kRing.c
  48. +255 −0 src/apps/miscapps/generateBaseCellNeighbors.c
  49. +151 −0 src/apps/miscapps/h3ToGeoBoundaryHier.c
  50. +152 −0 src/apps/miscapps/h3ToGeoHier.c
  51. +122 −0 src/apps/miscapps/h3ToHier.c
  52. +1 −0 src/apps/testapps/README.txt
  53. +71 −0 src/apps/testapps/mkRandGeo.c
  54. +71 −0 src/apps/testapps/mkRandGeoBoundary.c
  55. +294 −0 src/apps/testapps/testBBox.c
  56. +234 −0 src/apps/testapps/testCompact.c
  57. +190 −0 src/apps/testapps/testGeoCoord.c
  58. +72 −0 src/apps/testapps/testGeoToH3.c
  59. +50 −0 src/apps/testapps/testH3Api.c
  60. +96 −0 src/apps/testapps/testH3Index.c
  61. +145 −0 src/apps/testapps/testH3IndexFat.c
  62. +184 −0 src/apps/testapps/testH3NeighborRotations.c
  63. +194 −0 src/apps/testapps/testH3SetToLinkedGeo.c
  64. +113 −0 src/apps/testapps/testH3SetToVertexGraph.c
  65. +121 −0 src/apps/testapps/testH3ToChildren.c
  66. +80 −0 src/apps/testapps/testH3ToGeo.c
  67. +74 −0 src/apps/testapps/testH3ToGeoBoundary.c
  68. +49 −0 src/apps/testapps/testH3ToParent.c
  69. +223 −0 src/apps/testapps/testH3UniEdge.c
  70. +78 −0 src/apps/testapps/testHexRanges.c
  71. +184 −0 src/apps/testapps/testHexRing.c
  72. +332 −0 src/apps/testapps/testKRing.c
  73. +72 −0 src/apps/testapps/testLinkedGeo.c
  74. +38 −0 src/apps/testapps/testMaxH3ToChildrenSize.c
  75. +339 −0 src/apps/testapps/testPolyfill.c
  76. +292 −0 src/apps/testapps/testVertexGraph.c
  77. +48 −0 src/h3lib/include/algos.h
  78. +49 −0 src/h3lib/include/baseCells.h
  79. +44 −0 src/h3lib/include/bbox.h
  80. +82 −0 src/h3lib/include/constants.h
  81. +79 −0 src/h3lib/include/coordijk.h
  82. +91 −0 src/h3lib/include/faceijk.h
  83. +50 −0 src/h3lib/include/geoCoord.h
  84. +149 −0 src/h3lib/include/h3Index.h
  85. +67 −0 src/h3lib/include/h3IndexFat.h
  86. +28 −0 src/h3lib/include/h3UniEdge.h
  87. +462 −0 src/h3lib/include/h3api.h
  88. +35 −0 src/h3lib/include/linkedGeo.h
  89. +26 −0 src/h3lib/include/mathExtensions.h
  90. +37 −0 src/h3lib/include/vec2d.h
  91. +69 −0 src/h3lib/include/vertexGraph.h
  92. +896 −0 src/h3lib/lib/algos.c
  93. +848 −0 src/h3lib/lib/baseCells.c
  94. +179 −0 src/h3lib/lib/bbox.c
  95. +448 −0 src/h3lib/lib/coordijk.c
  96. +841 −0 src/h3lib/lib/faceijk.c
  97. +319 −0 src/h3lib/lib/geoCoord.c
  98. +468 −0 src/h3lib/lib/h3Index.c
  99. +392 −0 src/h3lib/lib/h3IndexFat.c
  100. +236 −0 src/h3lib/lib/h3UniEdge.c
  101. +71 −0 src/h3lib/lib/h3api.c
  102. +180 −0 src/h3lib/lib/linkedGeo.c
  103. +39 −0 src/h3lib/lib/mathExtensions.c
  104. +54 −0 src/h3lib/lib/vec2d.c
  105. +211 −0 src/h3lib/lib/vertexGraph.c
  106. +63 −0 tests/inputfiles/bc05r08cells.txt
  107. +7 −0 tests/inputfiles/bc05r08centers.txt
  108. +67 −0 tests/inputfiles/bc05r09cells.txt
  109. +7 −0 tests/inputfiles/bc05r09centers.txt
  110. +441 −0 tests/inputfiles/bc05r10cells.txt
  111. +49 −0 tests/inputfiles/bc05r10centers.txt
  112. +453 −0 tests/inputfiles/bc05r11cells.txt
  113. +49 −0 tests/inputfiles/bc05r11centers.txt
  114. +3,087 −0 tests/inputfiles/bc05r12cells.txt
  115. +343 −0 tests/inputfiles/bc05r12centers.txt
  116. +3,123 −0 tests/inputfiles/bc05r13cells.txt
  117. +343 −0 tests/inputfiles/bc05r13centers.txt
  118. +21,609 −0 tests/inputfiles/bc05r14cells.txt
  119. +2,401 −0 tests/inputfiles/bc05r14centers.txt
  120. +21,685 −0 tests/inputfiles/bc05r15cells.txt
  121. +2,401 −0 tests/inputfiles/bc05r15centers.txt
  122. +53 −0 tests/inputfiles/bc14r08cells.txt
  123. +6 −0 tests/inputfiles/bc14r08centers.txt
  124. +63 −0 tests/inputfiles/bc14r09cells.txt
  125. +6 −0 tests/inputfiles/bc14r09centers.txt
  126. +368 −0 tests/inputfiles/bc14r10cells.txt
  127. +41 −0 tests/inputfiles/bc14r10centers.txt
  128. +398 −0 tests/inputfiles/bc14r11cells.txt
  129. +41 −0 tests/inputfiles/bc14r11centers.txt
  130. +2,573 −0 tests/inputfiles/bc14r12cells.txt
  131. +286 −0 tests/inputfiles/bc14r12centers.txt
  132. +2,663 −0 tests/inputfiles/bc14r13cells.txt
  133. +286 −0 tests/inputfiles/bc14r13centers.txt
  134. +18,008 −0 tests/inputfiles/bc14r14cells.txt
  135. +2,001 −0 tests/inputfiles/bc14r14centers.txt
  136. +18,198 −0 tests/inputfiles/bc14r15cells.txt
  137. +2,001 −0 tests/inputfiles/bc14r15centers.txt
  138. +63 −0 tests/inputfiles/bc19r08cells.txt
  139. +7 −0 tests/inputfiles/bc19r08centers.txt
  140. +67 −0 tests/inputfiles/bc19r09cells.txt
  141. +7 −0 tests/inputfiles/bc19r09centers.txt
  142. +441 −0 tests/inputfiles/bc19r10cells.txt
  143. +49 −0 tests/inputfiles/bc19r10centers.txt
  144. +453 −0 tests/inputfiles/bc19r11cells.txt
  145. +49 −0 tests/inputfiles/bc19r11centers.txt
  146. +3,087 −0 tests/inputfiles/bc19r12cells.txt
  147. +343 −0 tests/inputfiles/bc19r12centers.txt
  148. +3,123 −0 tests/inputfiles/bc19r13cells.txt
  149. +343 −0 tests/inputfiles/bc19r13centers.txt
  150. +21,609 −0 tests/inputfiles/bc19r14cells.txt
  151. +2,401 −0 tests/inputfiles/bc19r14centers.txt
  152. +21,685 −0 tests/inputfiles/bc19r15cells.txt
  153. +2,401 −0 tests/inputfiles/bc19r15centers.txt
  154. +45,050 −0 tests/inputfiles/rand05cells.txt
  155. +5,000 −0 tests/inputfiles/rand05centers.txt
  156. +45,000 −0 tests/inputfiles/rand06cells.txt
  157. +5,000 −0 tests/inputfiles/rand06centers.txt
  158. +45,007 −0 tests/inputfiles/rand07cells.txt
  159. +5,000 −0 tests/inputfiles/rand07centers.txt
  160. +45,000 −0 tests/inputfiles/rand08cells.txt
  161. +5,000 −0 tests/inputfiles/rand08centers.txt
  162. +45,000 −0 tests/inputfiles/rand09cells.txt
  163. +5,000 −0 tests/inputfiles/rand09centers.txt
  164. +45,000 −0 tests/inputfiles/rand10cells.txt
  165. +5,000 −0 tests/inputfiles/rand10centers.txt
  166. +45,000 −0 tests/inputfiles/rand11cells.txt
  167. +5,000 −0 tests/inputfiles/rand11centers.txt
  168. +45,000 −0 tests/inputfiles/rand12cells.txt
  169. +5,000 −0 tests/inputfiles/rand12centers.txt
  170. +45,000 −0 tests/inputfiles/rand13cells.txt
  171. +5,000 −0 tests/inputfiles/rand13centers.txt
  172. +45,000 −0 tests/inputfiles/rand14cells.txt
  173. +5,000 −0 tests/inputfiles/rand14centers.txt
  174. +45,000 −0 tests/inputfiles/rand15cells.txt
  175. +5,000 −0 tests/inputfiles/rand15centers.txt
  176. +1,086 −0 tests/inputfiles/res00cells.txt
  177. +122 −0 tests/inputfiles/res00ic.txt
  178. +8,046 −0 tests/inputfiles/res01cells.txt
  179. +842 −0 tests/inputfiles/res01ic.txt
  180. +52,926 −0 tests/inputfiles/res02cells.txt
  181. +5,882 −0 tests/inputfiles/res02ic.txt
  182. +373,806 −0 tests/inputfiles/res03cells.txt
  183. +41,162 −0 tests/inputfiles/res03ic.txt
  184. +288,122 −0 tests/inputfiles/res04ic.txt
@@ -0,0 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

The public API of this library consists of the functions declared in file
`h3api.h`.

## [3.0.0] - 2018-01-08
### Added
- First public release.
@@ -0,0 +1,321 @@
# Copyright 2017 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 2.8.7)
project(h3)

set(H3_PREFIX "" CACHE STRING "Prefix for exported symbols")
add_definitions(-DH3_PREFIX=${H3_PREFIX})

set(H3_COMPILER "Default" CACHE STRING "C Compiler to use for H3")
set_property(
CACHE H3_COMPILER
PROPERTY STRINGS
"Default" "clang" "gcc" "cc"
)

if(H3_COMPILER MATCHES clang)
set(CMAKE_C_COMPILER clang)
elseif(H3_COMPILER MATCHES gcc)
set(CMAKE_C_COMPILER gcc)
elseif(H3_COMPILER MATCHES cc)
set(CMAKE_C_COMPILER cc)
endif()

# Needed due to CMP0042
set(CMAKE_MACOSX_RPATH 1)

if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -Wall -fno-inline -fno-eliminate-unused-debug-types --coverage")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wall -fPIC -std=c1x")
endif()

file(READ VERSION H3_VERSION LIMIT_COUNT 1)
# Clean any newlines
string(REPLACE "\n" "" H3_VERSION "${H3_VERSION}")

find_library(M_LIB m)

set(EXECUTABLE_OUTPUT_PATH bin)
set(LIBRARY_OUTPUT_PATH lib)

include_directories(src/h3lib/include)

file(GLOB_RECURSE ALL_SOURCE_FILES src/*.c src/*.h)
file(GLOB_RECURSE EXAMPLE_SOURCE_FILES examples/*.c)

# Build the H3 library
file(GLOB_RECURSE SOURCE_FILES src/h3lib/*.c src/h3lib/*.h)
option(BUILD_STATIC "Build a static version of the h3 library." OFF)
if (BUILD_STATIC)
add_library(h3.1 STATIC ${SOURCE_FILES})
else()
add_library(h3.1 SHARED ${SOURCE_FILES})
endif()

option(ENABLE_FORMAT "Enable running clang-format before compiling." ON)
find_program(CLANG_FORMAT_PATH clang-format)
if (CLANG_FORMAT_PATH AND ENABLE_FORMAT)
# Format
add_custom_target(format
COMMAND ${CLANG_FORMAT_PATH}
-style='{BasedOnStyle: Google, IndentWidth: 4}'
-i
${ALL_SOURCE_FILES}
${EXAMPLE_SOURCE_FILES}
COMMENT "Formatting sources"
)
# Always do formatting
add_dependencies(h3.1 format)
elseif(ENABLE_FORMAT)
message(WARNING "clang-format was not detected, so automatic source code reformatting is disabled.")
endif()

# Docs
find_package(Doxygen)
option(ENABLE_DOCS "Enable building documentation." ON)
if(DOXYGEN_FOUND AND ENABLE_DOCS)
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_BINARY_DIR}/docs/_build")
configure_file(docs/Doxyfile.in
docs/Doxyfile
ESCAPE_QUOTES
)
add_custom_target(docs
ALL
${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/docs/Doxyfile
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
else()
add_custom_target(docs
echo "Doxygen was not installed when CMake was run or ENABLE_DOCS was OFF. Check that Doxygen is installed and rerun `cmake .`" VERBATIM
)
endif()

# Metadata for bindings
if (WIN32)
add_custom_target(binding-functions
COMMAND echo "Windows not yet supported"
)
else()
add_custom_target(binding-functions
COMMAND ${PROJECT_SOURCE_DIR}/scripts/binding_functions.sh
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
endif()

# Link all executables against H3
macro(add_h3_executable name)
# invoke built-in add_executable
add_executable(${ARGV})
if(TARGET ${name})
target_link_libraries(${name} h3.1 ${M_LIB})
target_include_directories(${name} PUBLIC src/apps/applib/include)
endif()
endmacro()

# Additional source files common to the applications
file(GLOB_RECURSE APP_SOURCE_FILES src/apps/applib/lib/*.c src/apps/applib/include/*.h)

add_h3_executable(geoToH3 src/apps/filters/geoToH3.c ${APP_SOURCE_FILES})
add_h3_executable(h3ToComponents src/apps/filters/h3ToComponents.c ${APP_SOURCE_FILES})
add_h3_executable(h3ToGeo src/apps/filters/h3ToGeo.c ${APP_SOURCE_FILES})
add_h3_executable(h3ToGeoBoundary src/apps/filters/h3ToGeoBoundary.c ${APP_SOURCE_FILES})
add_h3_executable(hexRange src/apps/filters/hexRange.c ${APP_SOURCE_FILES})
add_h3_executable(kRing src/apps/filters/kRing.c ${APP_SOURCE_FILES})
add_h3_executable(generateBaseCellNeighbors src/apps/miscapps/generateBaseCellNeighbors.c ${APP_SOURCE_FILES})
add_h3_executable(h3ToGeoBoundaryHier src/apps/miscapps/h3ToGeoBoundaryHier.c ${APP_SOURCE_FILES})
add_h3_executable(h3ToGeoHier src/apps/miscapps/h3ToGeoHier.c ${APP_SOURCE_FILES})
add_h3_executable(h3ToHier src/apps/miscapps/h3ToHier.c ${APP_SOURCE_FILES})

# Generate KML files for visualizing the H3 grid
add_custom_target(create-kml-dir
COMMAND ${CMAKE_COMMAND} -E make_directory KML)
add_custom_target(kml)

# Only the first 3 resolution grids are generated. The others can be generated,
# but the file sizes would be very, very large.
foreach(resolution RANGE 3)
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "KML/res${resolution}cells.kml")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "KML/res${resolution}centers.kml")
add_custom_target(kml_cells_${resolution}
COMMAND sh -c "$<TARGET_FILE:h3ToHier> ${resolution} | $<TARGET_FILE:h3ToGeoBoundary> 1 res${resolution}cells.kml \"Res ${resolution} Cells\" > KML/res${resolution}cells.kml"
VERBATIM
DEPENDS create-kml-dir)
add_custom_target(kml_centers_${resolution}
COMMAND sh -c "$<TARGET_FILE:h3ToHier> ${resolution} | $<TARGET_FILE:h3ToGeo> 1 res${resolution}centers.kml \"Res ${resolution} Centers\" > KML/res${resolution}centers.kml"
VERBATIM
DEPENDS create-kml-dir)
add_dependencies(kml
kml_cells_${resolution}
kml_centers_${resolution})
endforeach()

option(ENABLE_TESTS "Enable building tests." ON)
if(ENABLE_TESTS)
option(PRINT_TEST_FILES "Print which test files correspond to which tests." OFF)

enable_testing()

# Macros and support code needed to build and add the tests
set(test_number 0)

option(ENABLE_COVERAGE "Enable compiling tests with coverage." ON)
if(ENABLE_COVERAGE)
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "coverage.info")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "coverage.cleaned.info")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "coverage")
add_custom_target(coverage
# Compile generated coverage counts into a single coverage.info
COMMAND lcov --directory '${PROJECT_BINARY_DIR}' --capture --output-file coverage.info
# Take only coverage of the core library, not apps
COMMAND lcov --extract coverage.info '${PROJECT_SOURCE_DIR}/src/h3lib/*' --output-file coverage.cleaned.info
# Generate output html at coverage/
COMMAND genhtml -o coverage coverage.cleaned.info --title 'h3 coverage'
COMMENT "Coverage done"
)
add_custom_target(clean-coverage
# Before running coverage, clear all counters
COMMAND lcov --directory '${PROJECT_BINARY_DIR}' --zerocounters
COMMENT "Zeroing counters"
)
endif()

macro(add_h3_test_common name srcfile)
# need to actually make the test target
if(NOT TARGET ${name})
add_h3_executable(${name} ${srcfile} ${APP_SOURCE_FILES})
endif()

math(EXPR test_number "${test_number}+1")
endmacro()

macro(add_h3_test name srcfile)
add_h3_test_common(${name} ${srcfile})
add_test(NAME ${name}_test${test_number} COMMAND ${name})

if(ENABLE_COVERAGE)
add_custom_target(${name}_coverage${test_number}
COMMAND ${name} > /dev/null
COMMENT "Running ${name}_coverage${test_number}"
)

add_dependencies(coverage ${name}_coverage${test_number})
add_dependencies(${name}_coverage${test_number} clean-coverage)
endif()
endmacro()

macro(add_h3_test_with_file name srcfile argfile)
add_h3_test_common(${name} ${srcfile})
# add a special command (so we don't need to read the test file from the test program)
add_test(NAME ${name}_test${test_number}
COMMAND sh -c "$<TARGET_FILE:${name}> < ${argfile}"
)
if(PRINT_TEST_FILES)
message("${name}_test${test_number} - ${argfile}")
endif()

if(ENABLE_COVERAGE)
add_custom_target(${name}_coverage${test_number}
COMMAND ${name} < ${argfile} > /dev/null
COMMENT "Running ${name}_coverage${test_number}"
)

add_dependencies(coverage ${name}_coverage${test_number})
add_dependencies(${name}_coverage${test_number} clean-coverage)
endif()
endmacro()

macro(add_h3_test_with_arg name srcfile arg)
add_h3_test_common(${name} ${srcfile})
add_test(NAME ${name}_test${test_number}
COMMAND $<TARGET_FILE:${name}> ${arg}
)
if(PRINT_TEST_FILES)
message("${name}_test${test_number} - ${arg}")
endif()

if(ENABLE_COVERAGE)
add_custom_target(${name}_coverage${test_number}
COMMAND ${name} ${arg}
COMMENT "Running ${name}_coverage${test_number}"
)

add_dependencies(coverage ${name}_coverage${test_number})
add_dependencies(${name}_coverage${test_number} clean-coverage)
endif()
endmacro()

# Add each individual test

file(GLOB all_centers tests/inputfiles/bc*centers.txt)
foreach(file ${all_centers})
add_h3_test_with_file(testH3ToGeo src/apps/testapps/testH3ToGeo.c ${file})
endforeach()

file(GLOB all_ic_files tests/inputfiles/res*ic.txt)
foreach(file ${all_ic_files})
add_h3_test_with_file(testH3ToGeo src/apps/testapps/testH3ToGeo.c ${file})
endforeach()

file(GLOB all_centers tests/inputfiles/rand*centers.txt)
foreach(file ${all_centers})
add_h3_test_with_file(testGeoToH3 src/apps/testapps/testGeoToH3.c ${file})
endforeach()

file(GLOB all_cells tests/inputfiles/*cells.txt)
foreach(file ${all_cells})
add_h3_test_with_file(testH3ToGeoBoundary src/apps/testapps/testH3ToGeoBoundary.c ${file})
endforeach()

add_h3_test(testCompact src/apps/testapps/testCompact.c)
add_h3_test(testKRing src/apps/testapps/testKRing.c)
add_h3_test(testHexRing src/apps/testapps/testHexRing.c)
add_h3_test(testHexRanges src/apps/testapps/testHexRanges.c)
add_h3_test(testH3ToParent src/apps/testapps/testH3ToParent.c)
add_h3_test(testH3ToChildren src/apps/testapps/testH3ToChildren.c)
add_h3_test(testMaxH3ToChildrenSize src/apps/testapps/testMaxH3ToChildrenSize.c)
add_h3_test(testH3Index src/apps/testapps/testH3Index.c)
add_h3_test(testH3IndexFat src/apps/testapps/testH3IndexFat.c)
add_h3_test(testH3Api src/apps/testapps/testH3Api.c)
add_h3_test(testH3SetToLinkedGeo src/apps/testapps/testH3SetToLinkedGeo.c)
add_h3_test(testH3SetToVertexGraph src/apps/testapps/testH3SetToVertexGraph.c)
add_h3_test(testLinkedGeo src/apps/testapps/testLinkedGeo.c)
add_h3_test(testPolyfill src/apps/testapps/testPolyfill.c)
add_h3_test(testVertexGraph src/apps/testapps/testVertexGraph.c)
add_h3_test(testH3UniEdge src/apps/testapps/testH3UniEdge.c)
add_h3_test(testGeoCoord src/apps/testapps/testGeoCoord.c)
add_h3_test(testBBox src/apps/testapps/testBBox.c)

add_h3_test_with_arg(testH3NeighborRotations src/apps/testapps/testH3NeighborRotations.c 0)
add_h3_test_with_arg(testH3NeighborRotations src/apps/testapps/testH3NeighborRotations.c 1)
add_h3_test_with_arg(testH3NeighborRotations src/apps/testapps/testH3NeighborRotations.c 2)

# Miscellaneous testing applications
add_h3_executable(mkRandGeo src/apps/testapps/mkRandGeo.c ${APP_SOURCE_FILES})
add_h3_executable(mkRandGeoBoundary src/apps/testapps/mkRandGeoBoundary.c ${APP_SOURCE_FILES})

# Benchmarks
add_custom_target(benchmarks)

macro(add_h3_benchmark name srcfile)
add_h3_executable(${name} ${srcfile} ${APP_SOURCE_FILES})
add_custom_target(bench_${name} COMMAND ${name})
add_dependencies(benchmarks bench_${name})
endmacro()

add_h3_benchmark(benchmarkH3Api src/apps/benchmarks/benchmarkH3Api.c)
add_h3_benchmark(benchmarkPolyfill src/apps/benchmarks/benchmarkPolyfill.c)
endif()
Oops, something went wrong.

0 comments on commit 1dcd63b

Please sign in to comment.