ext/h3/src/CMakeLists.txt in h3-3.4.4 vs ext/h3/src/CMakeLists.txt in h3-3.5.0
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright 2017, 2018 Uber Technologies, Inc.
+# Copyright 2017-2019 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
#
@@ -27,10 +27,13 @@
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchain.cmake"
CACHE FILEPATH
"Toolchain to use for building this project")
option(ENABLE_COVERAGE "Enable compiling tests with coverage." ON)
+option(BUILD_BENCHMARKS "Build benchmarking applications." ON)
+option(BUILD_FILTERS "Build filter applications." ON)
+option(BUILD_GENERATORS "Build code generation applications." ON)
if(WIN32)
set(SHELL PowerShell -Command)
set(EXECUTABLE_OUTPUT_PATH bin)
@@ -115,13 +118,15 @@
set(APP_SOURCE_FILES
src/apps/applib/include/test.h
src/apps/applib/include/kml.h
src/apps/applib/include/benchmark.h
src/apps/applib/include/utility.h
+ src/apps/applib/include/args.h
+ src/apps/applib/lib/test.c
src/apps/applib/lib/kml.c
src/apps/applib/lib/utility.c
- src/apps/applib/lib/test.c)
+ src/apps/applib/lib/args.c)
set(EXAMPLE_SOURCE_FILES
examples/index.c
examples/distance.c
examples/neighbors.c
examples/compact.c
@@ -147,10 +152,11 @@
src/apps/testapps/testH3NeighborRotations.c
src/apps/testapps/testMaxH3ToChildrenSize.c
src/apps/testapps/testHexRanges.c
src/apps/testapps/testH3ToGeo.c
src/apps/testapps/testH3ToChildren.c
+ src/apps/testapps/testH3GetFaces.c
src/apps/testapps/testGeoCoord.c
src/apps/testapps/testHexRing.c
src/apps/testapps/testH3SetToVertexGraph.c
src/apps/testapps/testBBox.c
src/apps/testapps/testPolygon.c
@@ -184,10 +190,12 @@
set(UNCONFIGURED_API_HEADER src/h3lib/include/h3api.h.in)
set(CONFIGURED_API_HEADER src/h3lib/include/h3api.h)
configure_file(${UNCONFIGURED_API_HEADER} ${CONFIGURED_API_HEADER})
+set(INSTALL_TARGETS h3)
+
# Build the H3 library
add_library(h3 ${LIB_SOURCE_FILES} ${CONFIGURED_API_HEADER})
target_compile_options(h3 PRIVATE ${H3_COMPILE_FLAGS})
target_link_libraries(h3 PRIVATE ${H3_LINK_FLAGS})
@@ -280,10 +288,16 @@
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/binding_functions.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
+# Release publishing
+add_custom_target(update-version
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/update_version.sh
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
# Website publishing
add_custom_target(publish-website
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/publish_website.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
@@ -299,48 +313,63 @@
target_compile_options(${name} PRIVATE ${H3_COMPILE_FLAGS})
target_link_libraries(${name} PRIVATE ${H3_LINK_FLAGS})
endif()
endmacro()
-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(h3ToLocalIj src/apps/filters/h3ToLocalIj.c ${APP_SOURCE_FILES})
-add_h3_executable(localIjToH3 src/apps/filters/localIjToH3.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(generateNumHexagons src/apps/miscapps/generateNumHexagons.c ${APP_SOURCE_FILES})
-add_h3_executable(generateFaceCenterPoint src/apps/miscapps/generateFaceCenterPoint.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})
+if(BUILD_FILTERS)
+ macro(add_h3_filter name)
+ add_h3_executable(${ARGV})
+ list(APPEND INSTALL_TARGETS ${name})
+ endmacro()
-# 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)
+ add_h3_filter(geoToH3 src/apps/filters/geoToH3.c ${APP_SOURCE_FILES})
+ add_h3_filter(h3ToComponents src/apps/filters/h3ToComponents.c ${APP_SOURCE_FILES})
+ add_h3_filter(h3ToGeo src/apps/filters/h3ToGeo.c ${APP_SOURCE_FILES})
+ add_h3_filter(h3ToLocalIj src/apps/filters/h3ToLocalIj.c ${APP_SOURCE_FILES})
+ add_h3_filter(localIjToH3 src/apps/filters/localIjToH3.c ${APP_SOURCE_FILES})
+ add_h3_filter(h3ToGeoBoundary src/apps/filters/h3ToGeoBoundary.c ${APP_SOURCE_FILES})
+ add_h3_filter(hexRange src/apps/filters/hexRange.c ${APP_SOURCE_FILES})
+ add_h3_filter(kRing src/apps/filters/kRing.c ${APP_SOURCE_FILES})
+ add_h3_filter(h3ToGeoBoundaryHier src/apps/miscapps/h3ToGeoBoundaryHier.c ${APP_SOURCE_FILES})
+ add_h3_filter(h3ToGeoHier src/apps/miscapps/h3ToGeoHier.c ${APP_SOURCE_FILES})
+ add_h3_filter(h3ToHier src/apps/miscapps/h3ToHier.c ${APP_SOURCE_FILES})
-# 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 ${SHELL} "$<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 ${SHELL} "$<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()
+ # 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 ${SHELL} "$<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 ${SHELL} "$<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()
+endif()
+
+if(BUILD_GENERATORS)
+ # Code generation
+ add_h3_executable(generateBaseCellNeighbors src/apps/miscapps/generateBaseCellNeighbors.c ${APP_SOURCE_FILES})
+ add_h3_executable(generateNumHexagons src/apps/miscapps/generateNumHexagons.c ${APP_SOURCE_FILES})
+ add_h3_executable(generateFaceCenterPoint src/apps/miscapps/generateFaceCenterPoint.c ${APP_SOURCE_FILES})
+
+ # Miscellaneous testing applications - generating random data
+ add_h3_executable(mkRandGeo src/apps/testapps/mkRandGeo.c ${APP_SOURCE_FILES})
+ add_h3_executable(mkRandGeoBoundary src/apps/testapps/mkRandGeoBoundary.c ${APP_SOURCE_FILES})
+endif()
+
if(BUILD_TESTING)
option(PRINT_TEST_FILES "Print which test files correspond to which tests" OFF)
include(TestWrapValgrind)
@@ -461,10 +490,11 @@
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(testH3GetFaces src/apps/testapps/testH3GetFaces.c)
add_h3_test(testMaxH3ToChildrenSize src/apps/testapps/testMaxH3ToChildrenSize.c)
add_h3_test(testH3Index src/apps/testapps/testH3Index.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)
@@ -485,15 +515,13 @@
add_h3_test(testBaseCells src/apps/testapps/testBaseCells.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)
+endif()
- # 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})
-
+if(BUILD_BENCHMARKS)
# Benchmarks
add_custom_target(benchmarks)
macro(add_h3_benchmark name srcfile)
add_h3_executable(${name} ${srcfile} ${APP_SOURCE_FILES})
@@ -550,11 +578,10 @@
# * <prefix>/lib/libh3.so
# * header location after install: <prefix>/include/h3/h3api.h
# * headers can be included by C++ code `#include <h3/h3api.h>`
# Installing the library and filters system-wide.
install(
- TARGETS h3 geoToH3 h3ToComponents h3ToGeo h3ToGeoBoundary hexRange
- kRing h3ToGeoBoundaryHier h3ToGeoHier h3ToHier
+ TARGETS ${INSTALL_TARGETS}
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
RUNTIME DESTINATION "bin"
INCLUDES DESTINATION "${include_install_dir}"