-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from AleksandrKent/160-feature-c-bindings-and…
…-semantic-kernel-integration Refactor of C# Bindings
- Loading branch information
Showing
61 changed files
with
3,303 additions
and
829 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This workflow builds USearch native libraries, then build and test C# USearch wrapper | ||
# Currently for development purposes an if condition specified below to work only fork | ||
|
||
name: Test C# wrapper | ||
|
||
on: | ||
push: | ||
branches: ["160-feature-c-bindings-and-semantic-kernel-integration"] | ||
|
||
env: | ||
LINUX_OSX_SCRIPT: build_and_test.sh | ||
WINDOWS_SCRIPT: build_and_test.cmd | ||
|
||
jobs: | ||
matrix-test: | ||
if: github.repository == 'AleksandrKent/usearch' | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: "160-feature-c-bindings-and-semantic-kernel-integration" | ||
- run: | | ||
git submodule update --init --recursive | ||
shell: bash | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
|
||
# Ubuntu and macOS steps | ||
- name: Run ${{ env.LINUX_OSX_SCRIPT }} on Ubuntu or macOS | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
run: | | ||
cd ./csharp | ||
"./${{ env.LINUX_OSX_SCRIPT }}" | ||
shell: bash | ||
|
||
# Windows step | ||
- name: Run ${{ env.WINDOWS_SCRIPT }} on Windows | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
cd .\csharp | ||
${{ env.WINDOWS_SCRIPT }} | ||
shell: cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "usearch" | ||
version = "0.22.3" | ||
version = "1.1.0" | ||
authors = ["Ash Vardanian <[email protected]>"] | ||
description = "Smaller & Faster Single-File Vector Search Engine from Unum" | ||
edition = "2021" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.22.3 | ||
1.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
|
||
set(USEARCH_PUNNED_INCLUDE_DIRS | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../include" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../fp16/include" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../robin-map/include" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../simsimd/include" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/" | ||
) | ||
|
||
# This article discusses a better way to allow building either static or shared libraries | ||
# https://alexreinking.com/blog/building-a-dual-shared-and-static-library-with-cmake.html | ||
if (${USEARCH_BUILD_STATIC}) | ||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -static-libstdc++") | ||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -static") | ||
endif() | ||
|
||
add_library(usearch_c STATIC "${CMAKE_CURRENT_SOURCE_DIR}/lib.cpp") | ||
else() | ||
add_library(usearch_c SHARED "${CMAKE_CURRENT_SOURCE_DIR}/lib.cpp") | ||
endif() | ||
|
||
set_target_properties(usearch_c PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
set_target_properties(usearch_c PROPERTIES CXX_STANDARD 11) | ||
set_target_properties(usearch_c PROPERTIES C_STANDARD 99) | ||
|
||
target_include_directories(usearch_c PRIVATE ${USEARCH_PUNNED_INCLUDE_DIRS}) | ||
set_target_properties(usearch_c PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) | ||
set_target_properties(usearch_c PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) | ||
set_target_properties(usearch_c PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) | ||
|
||
|
||
target_include_directories(usearch_c PRIVATE ${USEARCH_PUNNED_INCLUDE_DIRS}) | ||
|
||
if(${USEARCH_DEBUG_BUILD_ASAN}) | ||
# For ASAN in debug builds | ||
target_link_libraries(usearch_c PRIVATE gcov) | ||
endif() | ||
|
||
if(${USEARCH_USE_SIMSIMD}) | ||
target_compile_definitions(usearch_c PRIVATE USEARCH_USE_SIMSIMD=1) | ||
endif() | ||
if (${USEARCH_LOOKUP_LABEL}) | ||
target_compile_definitions(usearch_c PRIVATE USEARCH_LOOKUP_LABEL=1) | ||
endif() | ||
|
||
if(${USEARCH_BUILD_TEST}) | ||
add_executable(test_c "${CMAKE_CURRENT_SOURCE_DIR}/test.c") | ||
target_link_libraries(test_c usearch_c) | ||
set_target_properties(test_c PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) | ||
endif() |
Oops, something went wrong.