Skip to content

Commit 7f54163

Browse files
LimHyungTaeclaude
andcommitted
🚀 Add FLANN as bundled dependency to fix Python wheel builds
Critical fix for Python wheel failures: **FLANN Bundled Integration:** - Added flann.cmake with FetchContent from official flann-lib/flann repo - Integrated into find_dependencies.cmake system - Linked flann_cpp to kiss_matcher_core library **CI Configuration Updates:** - Set USE_SYSTEM_FLANN=OFF across all workflows - Python wheels now use bundled FLANN (no system dependency needed) - C++ builds also use bundled FLANN for consistency - ROS2 builds updated with FLANN settings **Build System:** - pyproject.toml: Added -DUSE_SYSTEM_FLANN=OFF flag - All platforms now build with static FLANN library - No external FLANN installation required This should resolve all Python wheel build failures by eliminating the FLANN system dependency that was causing issues in cibuildwheel. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 110a2f4 commit 7f54163

File tree

7 files changed

+64
-5
lines changed

7 files changed

+64
-5
lines changed

.github/workflows/ci-cpp.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ jobs:
112112
-DUSE_CCACHE=ON \
113113
-DUSE_SYSTEM_EIGEN3=ON \
114114
-DUSE_SYSTEM_TBB=ON \
115-
-DUSE_SYSTEM_ROBIN=OFF
115+
-DUSE_SYSTEM_ROBIN=OFF \
116+
-DUSE_SYSTEM_FLANN=OFF
116117
117118
- name: Configure CMake (Windows)
118119
if: runner.os == 'Windows'
@@ -125,7 +126,8 @@ jobs:
125126
-DUSE_CCACHE=OFF `
126127
-DUSE_SYSTEM_EIGEN3=OFF `
127128
-DUSE_SYSTEM_TBB=OFF `
128-
-DUSE_SYSTEM_ROBIN=OFF
129+
-DUSE_SYSTEM_ROBIN=OFF `
130+
-DUSE_SYSTEM_FLANN=OFF
129131
130132
- name: Build C++ Core
131133
run: cmake --build build --config Release --parallel
@@ -200,7 +202,8 @@ jobs:
200202
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
201203
-DUSE_SYSTEM_EIGEN3=ON \
202204
-DUSE_SYSTEM_TBB=ON \
203-
-DUSE_SYSTEM_ROBIN=OFF
205+
-DUSE_SYSTEM_ROBIN=OFF \
206+
-DUSE_SYSTEM_FLANN=OFF
204207
cmake --build build/core --config Release --parallel
205208
206209
- name: Install KISS-Matcher Core

.github/workflows/ci-python.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
USE_SYSTEM_EIGEN3=OFF
4848
USE_SYSTEM_TBB=OFF
4949
USE_SYSTEM_ROBIN=OFF
50+
USE_SYSTEM_FLANN=OFF
5051
CMAKE_BUILD_PARALLEL_LEVEL=2
5152
5253
# Test command

.github/workflows/ci-ros2.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jobs:
103103
-DUSE_SYSTEM_EIGEN3=ON \
104104
-DUSE_SYSTEM_TBB=ON \
105105
-DUSE_SYSTEM_ROBIN=OFF \
106+
-DUSE_SYSTEM_FLANN=OFF \
106107
--parallel-workers $(nproc)
107108
108109
- name: Build ROS2 wrapper

cpp/kiss_matcher/3rdparty/find_dependencies.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ endfunction()
4040
find_external_dependency("Eigen3" "Eigen3::Eigen" "${CMAKE_CURRENT_LIST_DIR}/eigen/eigen.cmake")
4141
find_external_dependency("TBB" "TBB::tbb" "${CMAKE_CURRENT_LIST_DIR}/tbb/tbb.cmake")
4242
find_external_dependency("robin" "robin::robin" "${CMAKE_CURRENT_LIST_DIR}/robin/robin.cmake")
43+
find_external_dependency("flann" "flann_cpp" "${CMAKE_CURRENT_LIST_DIR}/flann/flann.cmake")
4344
# ToDos
4445
# find_external_dependency("tsl-robin-map" "tsl::robin_map" "${CMAKE_CURRENT_LIST_DIR}/tsl_robin/tsl_robin.cmake")
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2025 Hyungtae Lim and coauthors.
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
include(FetchContent)
24+
25+
# Build FLANN as static library for easier wheel distribution
26+
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
27+
28+
FetchContent_Declare(
29+
flann
30+
GIT_REPOSITORY https://github.com/flann-lib/flann.git
31+
GIT_TAG 1.9.2
32+
GIT_SHALLOW TRUE
33+
)
34+
35+
# Configure FLANN options
36+
set(BUILD_EXAMPLES OFF CACHE BOOL "Build FLANN examples" FORCE)
37+
set(BUILD_TESTS OFF CACHE BOOL "Build FLANN tests" FORCE)
38+
set(BUILD_DOC OFF CACHE BOOL "Build FLANN documentation" FORCE)
39+
set(BUILD_MATLAB_BINDINGS OFF CACHE BOOL "Build MATLAB bindings" FORCE)
40+
set(BUILD_PYTHON_BINDINGS OFF CACHE BOOL "Build Python bindings" FORCE)
41+
set(USE_OPENMP ON CACHE BOOL "Use OpenMP" FORCE)
42+
43+
FetchContent_MakeAvailable(flann)
44+
45+
# Ensure FLANN headers are treated as system includes
46+
if(TARGET flann)
47+
get_target_property(flann_include_dirs flann INTERFACE_INCLUDE_DIRECTORIES)
48+
set_target_properties(flann PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${flann_include_dirs}")
49+
elseif(TARGET flann_cpp)
50+
get_target_property(flann_include_dirs flann_cpp INTERFACE_INCLUDE_DIRECTORIES)
51+
set_target_properties(flann_cpp PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${flann_include_dirs}")
52+
endif()

cpp/kiss_matcher/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ add_library(${TARGET_NAME} STATIC
7171
add_library(kiss_matcher::kiss_matcher_core ALIAS kiss_matcher_core)
7272

7373
target_link_libraries(${TARGET_NAME}
74-
PUBLIC Eigen3::Eigen robin::robin ${OpenMP_LIBS} ${EIGEN3_LIBS} TBB::tbb ${LZ4_LIBRARY}
74+
PUBLIC Eigen3::Eigen robin::robin flann_cpp ${OpenMP_LIBS} ${EIGEN3_LIBS} TBB::tbb ${LZ4_LIBRARY}
7575
)
7676

7777
# To make kiss_matcher::core global for Pybinding

python/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ cmake.build-type = "Release"
4848
cmake.args = [
4949
"-DUSE_SYSTEM_EIGEN3=OFF",
5050
"-DUSE_SYSTEM_TBB=OFF",
51-
"-DUSE_SYSTEM_ROBIN=OFF"
51+
"-DUSE_SYSTEM_ROBIN=OFF",
52+
"-DUSE_SYSTEM_FLANN=OFF"
5253
]
5354
cmake.define = {
5455
CMAKE_CXX_STANDARD = "17",

0 commit comments

Comments
 (0)