From f1c3f2564291f9ae33ae2c977b4166e97f23af5c Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Sun, 20 Oct 2024 09:15:48 -0700 Subject: [PATCH 1/2] Add ENABLE_POLYGON_TO_CELLS_ASSERT --- CMakeLists.txt | 6 ++++++ website/docs/core-library/compilation-options.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 302336bae..1caadf0b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,9 @@ option(BUILD_GENERATORS "Build code generation applications." ON) # for afl++ is provided instead. option(ENABLE_LIBFUZZER "Build fuzzers with libFuzzer support." OFF) +option(ENABLE_POLYGON_TO_CELLS_ASSERT "Build additional asserts into the polyfill algorithm for debuggin." OFF) +mark_as_advanced(ENABLE_POLYGON_TO_CELLS_ASSERT) + # These options exist for integration with OSS-Fuzz, so that the fuzzer options # can be passed through only to the fuzzer executables but not the H3 library, # since passing those options to the library too may result in too many implementations @@ -350,6 +353,9 @@ function(add_h3_library name h3_alloc_prefix_override) if(ENABLE_COVERAGE) target_compile_definitions(${name} PRIVATE H3_COVERAGE_TEST=1) endif() + if(ENABLE_POLYGON_TO_CELLS_ASSERT) + target_compile_definitions(${name} PRIVATE H3_POLYGON_TO_CELLS_ASSERT=1) + endif() target_compile_definitions(${name} PUBLIC H3_PREFIX=${H3_PREFIX}) target_compile_definitions(${name} PRIVATE BUILDING_H3=1) diff --git a/website/docs/core-library/compilation-options.md b/website/docs/core-library/compilation-options.md index be1b36cbc..38ae9f3b0 100644 --- a/website/docs/core-library/compilation-options.md +++ b/website/docs/core-library/compilation-options.md @@ -89,6 +89,12 @@ Whether to enable using clang-tidy to lint source files when building. Only invo [Makefile or Ninja CMake generators](https://cmake.org/cmake/help/latest/prop_tgt/LANG_CLANG_TIDY.html) are used. +## ENABLE_POLYGON_TO_CELLS_ASSERT + +Whether to enable additional debugging assertions in the `polygonToCells` functions. These are not compatible +with all tests and are intended for debugging only. It is not recommended to build release versions with +this flag because that configuration is not well tested. + ## H3_ALLOC_PREFIX Used for directing the library to use a [different set of functions for memory management](./custom-alloc). From 41695bec2983a7af6457b85285433610e31533e6 Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Sun, 20 Oct 2024 09:34:57 -0700 Subject: [PATCH 2/2] typo --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1caadf0b2..ecaead51d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ option(BUILD_GENERATORS "Build code generation applications." ON) # for afl++ is provided instead. option(ENABLE_LIBFUZZER "Build fuzzers with libFuzzer support." OFF) -option(ENABLE_POLYGON_TO_CELLS_ASSERT "Build additional asserts into the polyfill algorithm for debuggin." OFF) +option(ENABLE_POLYGON_TO_CELLS_ASSERT "Build additional asserts into the polyfill algorithm for debugging." OFF) mark_as_advanced(ENABLE_POLYGON_TO_CELLS_ASSERT) # These options exist for integration with OSS-Fuzz, so that the fuzzer options