diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfbe212..78b8473 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - VCPKG_COMMIT_SHA: 56bb2411609227288b70117ead2c47585ba07713 # corresponds to tag 2026.04.27 + VCPKG_COMMIT_SHA: 94a541197763a4f449a1b91478df48c0584a6256 # from 2026.08.15 # for matrix check https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners jobs: @@ -58,17 +58,6 @@ jobs: with: python-version: "3.13" - - name: Start ssh key agent - uses: webfactory/ssh-agent@v0.10.0 - with: - ssh-private-key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }} - - - name: Install SSH deploy key for rulessupport - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }} - known_hosts: github.com AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== - - name: Set vcpkg environment (Unix) if: "!startsWith(runner.os, 'Windows')" run: | @@ -117,7 +106,6 @@ jobs: conan-user: ${{secrets.LKEB_UPLOAD_USER}} conan-password: ${{secrets.LKEB_UPLOAD_USER_PASSWORD}} conan-pem: ${{secrets.LKEB_UPLOAD_CERT_CHAIN}} - rs_ssh_key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }} - name: Linux build if: startsWith(matrix.os, 'ubuntu') diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b3fb92..22798c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ endif() # ExamplePlugins # ----------------------------------------------------------------------------- set(PROJECT "ExamplePlugins") -PROJECT(${PROJECT} C CXX) +PROJECT(${PROJECT} LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/ExampleDependencies/CMakeLists.txt b/ExampleDependencies/CMakeLists.txt index 45ffb39..4a1d013 100644 --- a/ExampleDependencies/CMakeLists.txt +++ b/ExampleDependencies/CMakeLists.txt @@ -41,11 +41,8 @@ set_target_properties(hwy_list_targets PROPERTIES EXCLUDE_FROM_ALL True) if(${MV_EXAMPLES_USE_VCPKG}) find_package(blake3 CONFIG REQUIRED) - - if(NOT APPLE) - include(cmake/ci_fixes.cmake) - find_package(faiss CONFIG REQUIRED) - endif() + find_package(OpenMP REQUIRED) + find_package(faiss CONFIG REQUIRED) endif() # ----------------------------------------------------------------------------- @@ -106,12 +103,9 @@ target_link_libraries(${PROJECT_NAME} PRIVATE hwy hwy_contrib) if(${MV_EXAMPLES_USE_VCPKG}) target_link_libraries(${PROJECT_NAME} PRIVATE BLAKE3::blake3) - - if(NOT APPLE) target_link_libraries(${PROJECT_NAME} PRIVATE faiss) - endif() - target_compile_definitions (${PROJECT_NAME} PRIVATE __USE_VCPKG__) + target_compile_definitions (${PROJECT_NAME} PRIVATE __MV_EXAMPLES_USE_VCPKG__) endif() # Not used here, but you can use this in your plugin diff --git a/ExampleDependencies/src/ExampleDependenciesPlugin.cpp b/ExampleDependencies/src/ExampleDependenciesPlugin.cpp index 85cce8c..3a7ab26 100644 --- a/ExampleDependencies/src/ExampleDependenciesPlugin.cpp +++ b/ExampleDependencies/src/ExampleDependenciesPlugin.cpp @@ -6,21 +6,17 @@ #include #include +#include #include #include -#include #include #include #include -#if defined __USE_VCPKG__ +#ifdef __MV_EXAMPLES_USE_VCPKG__ #include - -#if !defined(__APPLE__) #include -using idx_t = faiss::idx_t; -#endif #endif Q_PLUGIN_METADATA(IID "studio.manivault.ExampleDependenciesPlugin") @@ -58,12 +54,12 @@ void ExampleDependenciesPlugin::init() void ExampleDependenciesPlugin::compute() { - std::cout << "ExampleDependenciesPlugin: Starting..." << std::endl; + std::cout << "ExampleDependenciesPlugin: Starting.../n" << std::endl; - auto printData = [](const std::vector& vec, size_t dims, size_t points) { - for (size_t dim = 0; dim < dims; dim++) + auto printData = [](const std::vector& vec, const int64_t dims, const int64_t points) { + for (int64_t dim = 0; dim < dims; dim++) { - for (size_t point = 0; point < points; point++) + for (int64_t point = 0; point < points; point++) std::cout << vec[point + points * dim] << " "; std::cout << std::endl; } @@ -71,8 +67,8 @@ void ExampleDependenciesPlugin::compute() // Get input data const auto inputPoints = getInputDataset(); - const size_t numDims = inputPoints->getNumDimensions(); - const size_t numPoints = inputPoints->getNumPoints(); + const auto numDims = static_cast(inputPoints->getNumDimensions()); + const auto numPoints = static_cast(inputPoints->getNumPoints()); std::vector data; std::vector dimensionIndices(numDims); @@ -84,9 +80,9 @@ void ExampleDependenciesPlugin::compute() std::cout << "ExampleDependenciesPlugin: Data before sorting" << std::endl; printData(data, numDims, numPoints); - for (size_t dim = 0; dim < numDims; dim++) + for (int64_t dim = 0; dim < numDims; dim++) { - size_t offset = numPoints * dim; + int64_t offset = numPoints * dim; hwy::VQSort(data.data() + offset, numPoints, hwy::SortAscending{}); } @@ -98,7 +94,7 @@ void ExampleDependenciesPlugin::compute() outputPoints->setData(data.data(), numPoints, numDims); events().notifyDatasetDataChanged(outputPoints); -#if defined __USE_VCPKG__ +#ifdef __MV_EXAMPLES_USE_VCPKG__ std::cout << "ExampleDependenciesPlugin: Using blake version: " << blake3_version() << std::endl; // Create hash @@ -116,25 +112,23 @@ void ExampleDependenciesPlugin::compute() } printf("\n"); -#if !defined(__APPLE__) // find knn faiss::IndexFlatL2 index(numDims); // call constructor index.add(numPoints, data.data()); // add vectors to the index - int k = std::max(static_cast(5), numPoints); - std::vector I(k * numPoints); + const int64_t k = std::max(static_cast(5), numPoints); + std::vector I(k * numPoints); std::vector D(k * numPoints); index.search(numPoints, data.data(), k, D.data(), I.data()); printf("knn results\n"); - for (size_t i = 0; i < numPoints; i++) { - for (int j = 0; j < k; j++) + for (int64_t i = 0; i < numPoints; i++) { + for (int64_t j = 0; j < k; j++) printf("%5zd ", I[i * k + j]); printf("\n"); } -#endif // __APPLE__ -#endif // __USE_VCPKG__ +#endif // __MV_EXAMPLES_USE_VCPKG__ std::cout << "ExampleDependenciesPlugin: Finished." << std::endl; } diff --git a/conanfile.py b/conanfile.py index cbc7a49..3a7a11d 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,6 +1,6 @@ from conans import ConanFile from conan.tools.cmake import CMakeDeps, CMake, CMakeToolchain -from conans.tools import save, load +from conans.tools import save, load, os_info, SystemPackageTool import os import pathlib import subprocess @@ -70,8 +70,11 @@ def configure(self): pass def system_requirements(self): - # May be needed for macOS or Linux - pass + if os_info.is_macos: + installer = SystemPackageTool() + installer.install("libomp") + proc = subprocess.run("brew --prefix libomp", shell=True, capture_output=True) + subprocess.run(f"ln {proc.stdout.decode('UTF-8').strip()}/lib/libomp.dylib /usr/local/lib/libomp.dylib", shell=True) def config_options(self): if self.settings.os == "Windows": @@ -103,6 +106,12 @@ def generate(self): tc.cache_variables["MV_UNITY_BUILD"] = "ON" tc.cache_variables["CMAKE_CONFIGURATION_TYPES"] = "RelWithDebInfo" + if os_info.is_macos: + proc = subprocess.run("brew --prefix libomp", shell=True, capture_output=True) + prefix_path = f"{proc.stdout.decode('UTF-8').strip()}" + tc.variables["OpenMP_ROOT"] = prefix_path + os.environ['OpenMP_ROOT'] = prefix_path # for vcpkg to find omp + # Use vcpkg-installed dependencies if there are any if os.environ.get("VCPKG_ROOT", None): vcpkg_dir = pathlib.Path(os.environ["VCPKG_ROOT"]) @@ -111,7 +120,7 @@ def generate(self): vcpkg_triplet = "x64-windows" if self.settings.os == "Macos": - vcpkg_triplet = "x64-osx" + vcpkg_triplet = "arm64-osx" if self.settings.os == "Linux": vcpkg_triplet = "x64-linux" @@ -127,6 +136,8 @@ def generate(self): tc.variables["CMAKE_PROJECT_INCLUDE"] = vcpkg_tc.as_posix() + tc.cache_variables["MV_EXAMPLES_USE_VCPKG"] = "ON" + tc.generate() def _configure_cmake(self): diff --git a/vcpkg.json b/vcpkg.json index 7b3fe05..a1c5358 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -3,14 +3,16 @@ "version": "0.0.1", "dependencies": [ "blake3", - { - "name": "faiss", - "platform": "!osx" - } + "faiss" ], - "builtin-baseline":"d5ec528843d29e3a52d745a64b469f810b2cedbf", + "builtin-baseline":"94a541197763a4f449a1b91478df48c0584a6256", "overrides": [ - { "name": "blake3", "version": "1.5.4" }, - { "name": "faiss", "version": "1.8.0" } - ] + { "name": "blake3", "version": "1.8.6#0" }, + { "name": "faiss", "version": "1.14.3#0" }, + { "name": "blas", "version": "2023-04-14#6" }, + { "name": "clapack", "version": "3.2.1#25" }, + { "name": "lapack", "version": "2023-06-10#4" }, + { "name": "lapack-reference", "version": "3.12.1#3" }, + { "name": "openblas", "version": "0.3.33#0" } +] } \ No newline at end of file