ext/h3/src/CMakeLists.txt in h3-3.3.1 vs ext/h3/src/CMakeLists.txt in h3-3.4.0
- old
+ new
@@ -43,10 +43,14 @@
endif()
file(READ VERSION H3_VERSION LIMIT_COUNT 1)
# Clean any newlines
string(REPLACE "\n" "" H3_VERSION "${H3_VERSION}")
+string(REPLACE "." ";" H3_VERSION_LIST "${H3_VERSION}")
+list(GET H3_VERSION_LIST 0 H3_VERSION_MAJOR)
+list(GET H3_VERSION_LIST 1 H3_VERSION_MINOR)
+list(GET H3_VERSION_LIST 2 H3_VERSION_PATCH)
set(H3_SOVERSION 1)
project(h3 LANGUAGES C VERSION ${H3_VERSION})
set(H3_COMPILE_FLAGS "")
@@ -97,11 +101,10 @@
src/h3lib/include/vertexGraph.h
src/h3lib/include/mathExtensions.h
src/h3lib/include/constants.h
src/h3lib/include/coordijk.h
src/h3lib/include/algos.h
- src/h3lib/include/h3api.h
src/h3lib/include/stackAlloc.h
src/h3lib/lib/algos.c
src/h3lib/lib/coordijk.c
src/h3lib/lib/bbox.c
src/h3lib/lib/polygon.c
@@ -182,12 +185,16 @@
src/apps/benchmarks/benchmarkH3Api.c)
set(ALL_SOURCE_FILES
${LIB_SOURCE_FILES} ${APP_SOURCE_FILES} ${OTHER_SOURCE_FILES})
+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})
+
# Build the H3 library
-add_library(h3 ${LIB_SOURCE_FILES})
+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})
find_library(M_LIB m)
@@ -205,11 +212,12 @@
endif()
if(have_vla)
target_compile_definitions(h3 PUBLIC H3_HAVE_VLA)
endif()
target_include_directories(h3 PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/h3lib/include>)
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/h3lib/include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src/h3lib/include>)
# Automatic code formatting
find_program(CLANG_FORMAT_PATH clang-format)
cmake_dependent_option(
ENABLE_FORMAT "Enable running clang-format before compiling" ON
@@ -220,10 +228,11 @@
COMMAND ${CLANG_FORMAT_PATH}
-style=file
-i
${ALL_SOURCE_FILES}
${EXAMPLE_SOURCE_FILES}
+ ${UNCONFIGURED_API_HEADER}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Formatting sources"
)
# Always do formatting
add_dependencies(h3 format)
@@ -276,10 +285,16 @@
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/binding_functions.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
+# Website publishing
+add_custom_target(publish-website
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/publish_website.sh
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+
# Link all executables against H3
macro(add_h3_executable name)
# invoke built-in add_executable
add_executable(${ARGV})
if(TARGET ${name})
@@ -468,10 +483,11 @@
add_h3_test(testVec3d src/apps/testapps/testVec3d.c)
add_h3_test(testH3ToLocalIj src/apps/testapps/testH3ToLocalIj.c)
add_h3_test(testH3Distance src/apps/testapps/testH3Distance.c)
add_h3_test(testH3Line src/apps/testapps/testH3Line.c)
add_h3_test(testCoordIj src/apps/testapps/testCoordIj.c)
+ 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)
@@ -550,10 +566,10 @@
# Headers:
# * src/h3lib/include/h3api.h -> <prefix>/include/h3/h3api.h
# Only the h3api.h header is needed by applications using H3.
install(
- FILES src/h3lib/include/h3api.h
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/src/h3lib/include/h3api.h"
DESTINATION "${include_install_dir}/h3"
)
# Config
# * <prefix>/lib/cmake/h3/h3Config.cmake