From 53f781802724f65be1a056dee7aa2e91dffcd2cf Mon Sep 17 00:00:00 2001 From: andriyDev Date: Thu, 4 May 2023 18:56:41 -0700 Subject: [PATCH] Add a CMake option to use dynamic dispatch for dtQueryFilter in Detour. (#628) --- CMakeLists.txt | 4 ++++ Detour/CMakeLists.txt | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e2a7ce..b7bd74f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ option(RECASTNAVIGATION_DEMO "Build demo" ON) option(RECASTNAVIGATION_TESTS "Build tests" ON) option(RECASTNAVIGATION_EXAMPLES "Build examples" ON) option(RECASTNAVIGATION_DT_POLYREF64 "Use 64bit polyrefs instead of 32bit for Detour" OFF) +option(RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER "Use dynamic dispatch for dtQueryFilter in Detour to allow for custom filters" OFF) if(MSVC AND BUILD_SHARED_LIBS) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) @@ -37,6 +38,9 @@ set(PACKAGE_VERSION "${LIB_VERSION}") if(RECASTNAVIGATION_DT_POLYREF64) set(PKG_CONFIG_CFLAGS "${PKG_CONFIG_CFLAGS} -DDT_POLYREF64") endif() +if(RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER) + set(PKG_CONFIG_CFLAGS "${PKG_CONFIG_CFLAGS} -DDT_VIRTUAL_QUERYFILTER") +endif() configure_file( "${RecastNavigation_SOURCE_DIR}/recastnavigation.pc.in" "${RecastNavigation_BINARY_DIR}/recastnavigation.pc" diff --git a/Detour/CMakeLists.txt b/Detour/CMakeLists.txt index 910ec34..c8eb858 100644 --- a/Detour/CMakeLists.txt +++ b/Detour/CMakeLists.txt @@ -9,6 +9,9 @@ set(Detour_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Include") if(RECASTNAVIGATION_DT_POLYREF64) target_compile_definitions(Detour PUBLIC DT_POLYREF64) endif() +if(RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER) + target_compile_definitions(Detour PUBLIC DT_VIRTUAL_QUERYFILTER) +endif() target_include_directories(Detour PUBLIC "$"