[usearch] fix NumKong dynamic dispatch linkage for consumers (#53115)

This commit is contained in:
Tom Conder 2026-07-31 15:06:59 -05:00 committed by GitHub
parent a388a8d0fe
commit 25b93347d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 64 additions and 18 deletions

View File

@ -1,6 +1,7 @@
{
"name": "tracy",
"version": "0.13.1",
"port-version": 1,
"description": "A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.",
"homepage": "https://github.com/wolfpld/tracy",
"license": "BSD-3-Clause",
@ -78,12 +79,7 @@
"ppqsort",
"pugixml",
"tidy-html5",
{
"name": "usearch",
"features": [
"fp16"
]
},
"usearch",
"zstd"
]
},

View File

@ -0,0 +1,46 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 711bbe3..a8b9efd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,7 +128,16 @@ endif ()
target_compile_definitions(${USEARCH_TARGET_NAME} INTERFACE "USEARCH_USE_OPENMP=$<BOOL:${USEARCH_USE_OPENMP}>")
# Supplementary compilation settings affecting "index_plugins.hpp"
-target_compile_definitions(${USEARCH_TARGET_NAME} INTERFACE "USEARCH_USE_NUMKONG=$<BOOL:${USEARCH_USE_NUMKONG}>")
+set(USEARCH_USE_NUMKONG_SHARED OFF)
+if (USEARCH_USE_NUMKONG)
+ find_package(unofficial-numkong CONFIG QUIET)
+ if (TARGET unofficial::numkong::nk_shared)
+ set(USEARCH_USE_NUMKONG_SHARED ON)
+ target_link_libraries(${USEARCH_TARGET_NAME} INTERFACE unofficial::numkong::nk_shared)
+ target_compile_definitions(${USEARCH_TARGET_NAME} INTERFACE "NK_DYNAMIC_DISPATCH=1")
+ endif ()
+endif ()
+target_compile_definitions(${USEARCH_TARGET_NAME} INTERFACE "USEARCH_USE_NUMKONG=$<BOOL:${USEARCH_USE_NUMKONG_SHARED}>")
# Define which types can be compiled
target_compile_definitions(
@@ -148,7 +157,7 @@ target_include_directories(
${USEARCH_TARGET_NAME} ${USEARCH_SYSTEM_INCLUDE} INTERFACE $<BUILD_INTERFACE:${USEARCH_INCLUDE_BUILD_DIR}>
$<INSTALL_INTERFACE:include>
)
-if (USEARCH_USE_NUMKONG)
+if (USEARCH_USE_NUMKONG_SHARED)
find_path(NUMKONG_INCLUDE_DIRS "numkong/attention.h")
target_include_directories(
${USEARCH_TARGET_NAME} ${USEARCH_SYSTEM_INCLUDE}
diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
index 7bba80c..8198810 100644
--- a/cmake/config.cmake.in
+++ b/cmake/config.cmake.in
@@ -3,6 +3,10 @@ set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE})
find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE)
if(NOT TARGET @PROJECT_NAME@::@USEARCH_TARGET_NAME@)
+ if(@USEARCH_USE_NUMKONG_SHARED@)
+ include(CMakeFindDependencyMacro)
+ find_dependency(unofficial-numkong CONFIG)
+ endif()
include("${CMAKE_CURRENT_LIST_DIR}/@USEARCH_TARGETS_EXPORT_NAME@.cmake")
if((NOT TARGET @USEARCH_TARGET_NAME@) AND
(NOT @PROJECT_NAME@_FIND_VERSION OR

View File

@ -1,3 +1,5 @@
set(VCPKG_BUILD_TYPE release) # header-only, no debug artifacts to build
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO unum-cloud/usearch
@ -7,11 +9,11 @@ vcpkg_from_github(
PATCHES
use-vcpkg-ports.patch
fix-map-failed.patch # official fix: https://github.com/unum-cloud/USearch/pull/720 , remove this patch in the next release
fix-numkong-dynamic-dispatch.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
fp16 USEARCH_USE_FP16LIB
jemalloc USEARCH_USE_JEMALLOC
numkong USEARCH_USE_NUMKONG
)
@ -30,6 +32,4 @@ vcpkg_cmake_config_fixup(CONFIG_PATH share/cmake/usearch)
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -1,6 +1,7 @@
{
"name": "usearch",
"version": "2.25.3",
"port-version": 1,
"description": "Fastest Search & Clustering engine × for Vectors & Strings",
"homepage": "https://github.com/unum-cloud/usearch",
"license": "Apache-2.0",
@ -15,12 +16,6 @@
}
],
"features": {
"fp16": {
"description": "Use software emulation for half-precision types",
"dependencies": [
"fp16"
]
},
"jemalloc": {
"description": "Use JeMalloc for faster memory allocations",
"dependencies": [

View File

@ -1378,7 +1378,6 @@ torch-th:arm64-windows-static-md=fail
torch-th:arm64-windows=fail
torch-th:x64-android=cascade
torch-th:x64-windows-static=fail
tracy[cli-tools]:arm64-linux=cascade
tracy[gui-tools]:arm64-linux=cascade
treehopper:arm64-linux=cascade
treehopper:x64-windows-static=fail

View File

@ -10334,7 +10334,7 @@
},
"tracy": {
"baseline": "0.13.1",
"port-version": 0
"port-version": 1
},
"transwarp": {
"baseline": "2.2.3",
@ -10534,7 +10534,7 @@
},
"usearch": {
"baseline": "2.25.3",
"port-version": 0
"port-version": 1
},
"usockets": {
"baseline": "0.8.8",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "14b48412157c33902fa555b1fa4aeb18a49a47c3",
"version": "0.13.1",
"port-version": 1
},
{
"git-tree": "b32705c81bb91643cf374d4e676e669f8fbc444c",
"version": "0.13.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "42d806b30d6da481fa467b9b18ef11bd15b96d5a",
"version": "2.25.3",
"port-version": 1
},
{
"git-tree": "01288cb8685358ea9fd57540e947bc1e0d2a9f1d",
"version": "2.25.3",