From 67f9dfb160c0cdfb472f20184bef88aebefb80e4 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Sun, 10 Aug 2025 14:45:16 -0400 Subject: [PATCH 01/18] add gsl and nlopt --- .github/workflows/test.yml | 2 +- .github/workflows/wheels.yml | 6 +++--- CMakeLists.txt | 17 +++++++++++++++- src/cpp/main.cpp | 38 ++++++++++++++++++++++++++++++++++++ tests/test_basic.py | 11 +++++++++++ 5 files changed, 69 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 193aee2..60d9f13 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04, windows-2022, macos-14] + os: [ubuntu-24.04] python-version: ["3.13"] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index edd1509..8d7b584 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -2,7 +2,7 @@ name: Build package wheels on: workflow_dispatch: - pull_request: + # pull_request: push: branches: - main @@ -14,12 +14,12 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04, windows-2022, macos-14] + os: [ubuntu-24.04] steps: - uses: actions/checkout@v4 - - name: Cache dependencies + - name: Cache dependencies. # TODO - this may not work on linux b/c os is different than container? id: cache-vcpkg-deps uses: actions/cache@v4 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bfb83e..2f70686 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,9 +13,24 @@ message(STATUS "vcpkg Triplet: ${VCPKG_HOST_TRIPLET}") set(EIGEN_PATH "${CMAKE_SOURCE_DIR}/vcpkg_installed/${VCPKG_HOST_TRIPLET}/include") message(STATUS "Eigen Path: ${EIGEN_PATH}") +set(GSL_DIR "${CMAKE_SOURCE_DIR}/vcpkg_installed/${VCPKG_HOST_TRIPLET}") +message(STATUS "GSL Path: ${GSL_DIR}") +set(GSL_INCLUDE_DIR "${GSL_DIR}/include") +set(GSL_LIBRARY_DIR "${GSL_DIR}/lib") +find_library(GSL_LIB gsl PATHS "${GSL_LIBRARY_DIR}") +find_library(GSLCBLAS_LIB gslcblas PATHS "${GSL_LIBRARY_DIR}") + +set(NLOPT_DIR "${CMAKE_SOURCE_DIR}/vcpkg_installed/${VCPKG_HOST_TRIPLET}") +message(STATUS "NLOPT Path: ${NLOPT_DIR}") +set(NLOPT_DIR_INCLUDE_DIR "${NLOPT_DIR}/include") +set(NLOPT_DIR_LIBRARY_DIR "${NLOPT_DIR}/lib") +find_library(NLOPT_LIB nlopt PATHS "${NLOPT_DIR_LIBRARY_DIR}") + pybind11_add_module(cppcore src/cpp/main.cpp) -include_directories(${CMAKE_SOURCE_DIR}/src/cpp ${EIGEN_PATH}) +include_directories(${CMAKE_SOURCE_DIR}/src/cpp ${EIGEN_PATH} ${GSL_INCLUDE_DIR} ${NLOPT_DIR_INCLUDE_DIR}) +target_include_directories(cppcore PRIVATE ${GSL_INCLUDE_DIR} ${NLOPT_DIR_INCLUDE_DIR}) +target_link_libraries(cppcore PRIVATE ${GSL_LIB} ${GSLCBLAS_LIB} ${NLOPT_LIB}) target_compile_definitions( cppcore diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index 9601dfd..24a8261 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -1,6 +1,9 @@ #include #include +#include +#include #include +#include #define STRINGIFY(x) #x #define MACRO_STRINGIFY(x) STRINGIFY(x) @@ -32,6 +35,37 @@ py::array_t eigen_matmul(py::array_t nlopt_demo(const std::vector& lower_bounds, + const std::vector& upper_bounds) { + if (lower_bounds.size() != 2 || upper_bounds.size() != 2) + throw std::invalid_argument("Bounds must have size 2"); + + nlopt_opt opt = nlopt_create(NLOPT_LD_LBFGS, 2); + nlopt_set_lower_bounds(opt, lower_bounds.data()); + nlopt_set_upper_bounds(opt, upper_bounds.data()); + nlopt_set_min_objective(opt, objfunc, nullptr); + + double x[2] = {0.0, 0.0}; + double minf; + int result = nlopt_optimize(opt, x, &minf); + nlopt_destroy(opt); + if (result < 0) throw std::runtime_error("nlopt failed"); + return {x[0], x[1]}; +} + PYBIND11_MODULE(cppcore, m) { m.doc() = R"pbdoc( Pybind11 example plugin @@ -59,4 +93,8 @@ PYBIND11_MODULE(cppcore, m) { )pbdoc"); m.def("eigen_matmul", &eigen_matmul, "Matrix multiplication using Eigen"); + m.def("gsl_bessel", &gsl_bessel, "Bessel function using GSL"); + m.def("nlopt_optimize", &nlopt_demo, + py::arg("lower_bounds"), py::arg("upper_bounds"), + "Run NLOPT optimization with specified bounds"); } diff --git a/tests/test_basic.py b/tests/test_basic.py index fbb9120..0592450 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -1,3 +1,4 @@ +import pytest import numpy as np import demo @@ -16,3 +17,13 @@ def test_eigen_matmul(): result = cppcore.eigen_matmul(a, b) expected = np.matmul(a, b) np.testing.assert_allclose(result, expected) + + +def test_gsl_bessel(): + assert pytest.approx(1.0, rel=1e-8) == cppcore.gsl_bessel(0.0) + assert pytest.approx(0.7651976865, rel=1e-8) == cppcore.gsl_bessel(1.0) + + +def test_nlopt_optimize(): + res = cppcore.nlopt_optimize([-10, -10], [10, 10]) + assert pytest.approx([1.0, 2.0]) == res From 7046bfa41de834bf33ebea4ea8fde1b1ce30c544 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Sun, 10 Aug 2025 14:49:05 -0400 Subject: [PATCH 02/18] all os --- .github/workflows/test.yml | 56 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60d9f13..5c11adf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04] + os: [ubuntu-24.04, windows-2022, macos-14] python-version: ["3.13"] runs-on: ${{ matrix.os }} @@ -55,43 +55,43 @@ jobs: ./vcpkg/bootstrap-vcpkg.sh ./vcpkg/vcpkg install --host-triplet="$VCPKG_HOST_TRIPLET" - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + # - uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python-version }} - - name: Install uv - uses: astral-sh/setup-uv@v5 - with: - cache-dependency-glob: "**/pyproject.toml" + # - name: Install uv + # uses: astral-sh/setup-uv@v5 + # with: + # cache-dependency-glob: "**/pyproject.toml" - - name: Build pybmds - if: runner.os != 'Windows' - run: | - uv pip install pybind11==3.0.0 --target=./pybind11 + # - name: Build pybmds + # if: runner.os != 'Windows' + # run: | + # uv pip install pybind11==3.0.0 --target=./pybind11 - uv venv --python=${{ matrix.python-version }} + # uv venv --python=${{ matrix.python-version }} - source .venv/bin/activate + # source .venv/bin/activate - export CMAKE_PREFIX_PATH=${{ github.workspace }}/pybind11/pybind11/share/cmake - export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) + # export CMAKE_PREFIX_PATH=${{ github.workspace }}/pybind11/pybind11/share/cmake + # export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) - uv pip install -v -e . + # uv pip install -v -e . - py.test + # py.test - - name: Build pybmds - if: runner.os == 'Windows' - run: | - uv pip install pybind11==3.0.0 --target=./pybind11 + # - name: Build pybmds + # if: runner.os == 'Windows' + # run: | + # uv pip install pybind11==3.0.0 --target=./pybind11 - uv venv --python=${{ matrix.python-version }} + # uv venv --python=${{ matrix.python-version }} - .venv/Scripts/activate + # .venv/Scripts/activate - $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" - $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount + # $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" + # $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount - uv pip install -v -e . + # uv pip install -v -e . - py.test + # py.test From 3fac2eb0858fb417145fc8d446a06ce50c23066b Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Sun, 10 Aug 2025 15:13:19 -0400 Subject: [PATCH 03/18] downstream --- .github/workflows/test.yml | 54 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c11adf..193aee2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,43 +55,43 @@ jobs: ./vcpkg/bootstrap-vcpkg.sh ./vcpkg/vcpkg install --host-triplet="$VCPKG_HOST_TRIPLET" - # - uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python-version }} + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - # - name: Install uv - # uses: astral-sh/setup-uv@v5 - # with: - # cache-dependency-glob: "**/pyproject.toml" + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + cache-dependency-glob: "**/pyproject.toml" - # - name: Build pybmds - # if: runner.os != 'Windows' - # run: | - # uv pip install pybind11==3.0.0 --target=./pybind11 + - name: Build pybmds + if: runner.os != 'Windows' + run: | + uv pip install pybind11==3.0.0 --target=./pybind11 - # uv venv --python=${{ matrix.python-version }} + uv venv --python=${{ matrix.python-version }} - # source .venv/bin/activate + source .venv/bin/activate - # export CMAKE_PREFIX_PATH=${{ github.workspace }}/pybind11/pybind11/share/cmake - # export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) + export CMAKE_PREFIX_PATH=${{ github.workspace }}/pybind11/pybind11/share/cmake + export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) - # uv pip install -v -e . + uv pip install -v -e . - # py.test + py.test - # - name: Build pybmds - # if: runner.os == 'Windows' - # run: | - # uv pip install pybind11==3.0.0 --target=./pybind11 + - name: Build pybmds + if: runner.os == 'Windows' + run: | + uv pip install pybind11==3.0.0 --target=./pybind11 - # uv venv --python=${{ matrix.python-version }} + uv venv --python=${{ matrix.python-version }} - # .venv/Scripts/activate + .venv/Scripts/activate - # $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" - # $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount + $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" + $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount - # uv pip install -v -e . + uv pip install -v -e . - # py.test + py.test From dbf8d5a75f615c4055f76e9931c16adeeaf608f5 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Sun, 10 Aug 2025 15:18:06 -0400 Subject: [PATCH 04/18] continue --- .github/workflows/test.yml | 2 ++ src/cpp/main.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 193aee2..71826b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,6 +89,8 @@ jobs: .venv/Scripts/activate + ls -Recurse ./vcpkg_installed + $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index 24a8261..38e0c98 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -53,7 +53,7 @@ std::vector nlopt_demo(const std::vector& lower_bounds, if (lower_bounds.size() != 2 || upper_bounds.size() != 2) throw std::invalid_argument("Bounds must have size 2"); - nlopt_opt opt = nlopt_create(NLOPT_LD_LBFGS, 2); + nlopt_opt opt = nlopt_create(NLOPT_LN_NELDERMEAD, 2); nlopt_set_lower_bounds(opt, lower_bounds.data()); nlopt_set_upper_bounds(opt, upper_bounds.data()); nlopt_set_min_objective(opt, objfunc, nullptr); From 940c308a41345e94008c19fea8b859b9915daec7 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Sun, 10 Aug 2025 15:36:42 -0400 Subject: [PATCH 05/18] try more on windows --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 71826b1..bd5e8b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04, windows-2022, macos-14] + # os: [ubuntu-24.04, windows-2022, macos-14] + os: [windows-2022] python-version: ["3.13"] runs-on: ${{ matrix.os }} @@ -33,7 +34,7 @@ jobs: if [[ "$RUNNER_OS" == "Linux" ]]; then VCPKG_HOST_TRIPLET=x64-linux-dynamic elif [[ "$RUNNER_OS" == "Windows" ]]; then - VCPKG_HOST_TRIPLET=x64-mingw-dynamic + VCPKG_HOST_TRIPLET=x64-windows elif [[ "$RUNNER_OS" == "macOS" ]]; then VCPKG_HOST_TRIPLET=arm64-osx-dynamic fi From 2d356991b6d5d590bdec93068964dc61f54fbb87 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Sun, 10 Aug 2025 15:53:25 -0400 Subject: [PATCH 06/18] get cache working --- .github/workflows/test.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd5e8b0..5a88f8f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -81,20 +81,22 @@ jobs: py.test - - name: Build pybmds - if: runner.os == 'Windows' - run: | - uv pip install pybind11==3.0.0 --target=./pybind11 + # - name: Build pybmds + # if: runner.os == 'Windows' + # run: | + # uv pip install pybind11==3.0.0 --target=./pybind11 - uv venv --python=${{ matrix.python-version }} + # uv venv --python=${{ matrix.python-version }} - .venv/Scripts/activate + # .venv/Scripts/activate - ls -Recurse ./vcpkg_installed + # ls -Recurse ./vcpkg_installed - $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" - $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount + # $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" + # $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount - uv pip install -v -e . + # uv pip install -v -e . - py.test + # ls -Recurse ./src + + # py.test From d13a399692dc800876780b63533e6fb9cae7cca4 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Sun, 10 Aug 2025 15:57:43 -0400 Subject: [PATCH 07/18] continue --- .github/workflows/test.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5a88f8f..f710e71 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -81,22 +81,22 @@ jobs: py.test - # - name: Build pybmds - # if: runner.os == 'Windows' - # run: | - # uv pip install pybind11==3.0.0 --target=./pybind11 + - name: Build pybmds + if: runner.os == 'Windows' + run: | + uv pip install pybind11==3.0.0 --target=./pybind11 - # uv venv --python=${{ matrix.python-version }} + uv venv --python=${{ matrix.python-version }} - # .venv/Scripts/activate + .venv/Scripts/activate - # ls -Recurse ./vcpkg_installed + ls -Recurse ./vcpkg_installed - # $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" - # $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount + $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" + $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount - # uv pip install -v -e . + uv pip install -v -e . - # ls -Recurse ./src + ls -Recurse ./src - # py.test + py.test From da8054cb7195be1577dac9357f86ba960567b773 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 21:32:16 -0400 Subject: [PATCH 08/18] continue --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f710e71..661caf4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -97,6 +97,9 @@ jobs: uv pip install -v -e . - ls -Recurse ./src + cp vcpkg_installed/x64-windows/lib/*.lib src/demo/ + cp vcpkg_installed/x64-windows/bin/*.dll src/demo/ + + ls cp vcpkg_installed/x64-windows/ py.test From 6167249539f36d08bac0943840ff5c6d3193b60e Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 21:34:24 -0400 Subject: [PATCH 09/18] fix --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 661caf4..d3bfb3e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -100,6 +100,6 @@ jobs: cp vcpkg_installed/x64-windows/lib/*.lib src/demo/ cp vcpkg_installed/x64-windows/bin/*.dll src/demo/ - ls cp vcpkg_installed/x64-windows/ + ls vcpkg_installed/x64-windows/ py.test From 186e0d264e5eb3c11da261b8474f942230e1e5db Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 21:36:09 -0400 Subject: [PATCH 10/18] just add dll not lib --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d3bfb3e..47d3046 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -97,7 +97,6 @@ jobs: uv pip install -v -e . - cp vcpkg_installed/x64-windows/lib/*.lib src/demo/ cp vcpkg_installed/x64-windows/bin/*.dll src/demo/ ls vcpkg_installed/x64-windows/ From 80d97017e22e605bd779f32bfaf703cb677f80a5 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 21:39:08 -0400 Subject: [PATCH 11/18] try wheels --- .github/workflows/wheels.yml | 2 +- CMakeLists.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 8d7b584..e90cc04 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04] + os: [windows-2022] steps: - uses: actions/checkout@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f70686..34d1481 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.4...3.18) project(cppcore) -set(VCPKG_HOST_TRIPLET $ENV{VCPKG_HOST_TRIPLET}) set(VCPKG_HOST_TRIPLET $ENV{VCPKG_HOST_TRIPLET}) set(PYBIND11_FINDPYTHON ON) From 30e3a1a7d3f79c08e39b8b674a80dc8a07b3b1a0 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 21:40:43 -0400 Subject: [PATCH 12/18] wheels --- .github/workflows/test.yml | 2 +- .github/workflows/wheels.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 47d3046..9405982 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Run tests on: workflow_dispatch: - pull_request: + # pull_request: push: branches: - main diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index e90cc04..7a858cd 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -2,7 +2,7 @@ name: Build package wheels on: workflow_dispatch: - # pull_request: + pull_request: push: branches: - main From 0b97a35d027334112e3f4f7475eab2f385a3f642 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 21:44:00 -0400 Subject: [PATCH 13/18] change triplet --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 7a858cd..5c41018 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -38,7 +38,7 @@ jobs: run: | case "${RUNNER_OS}" in "Windows") - VCPKG_HOST_TRIPLET="x64-mingw-dynamic" + VCPKG_HOST_TRIPLET="x64-windows" ;; "Linux") VCPKG_HOST_TRIPLET="x64-linux-dynamic" From b190e39db029246d2766e8901b92db9d791ff386 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 22:02:07 -0400 Subject: [PATCH 14/18] use different triplet --- .github/workflows/test.yml | 14 +++++++------- .github/workflows/wheels.yml | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9405982..b847808 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,10 +31,10 @@ jobs: - name: Set compile target shell: bash run: | - if [[ "$RUNNER_OS" == "Linux" ]]; then + if [[ "$RUNNER_OS" == "Windows" ]]; then + VCPKG_HOST_TRIPLET=x64-windows-static-md + elif [[ "$RUNNER_OS" == "Linux" ]]; then VCPKG_HOST_TRIPLET=x64-linux-dynamic - elif [[ "$RUNNER_OS" == "Windows" ]]; then - VCPKG_HOST_TRIPLET=x64-windows elif [[ "$RUNNER_OS" == "macOS" ]]; then VCPKG_HOST_TRIPLET=arm64-osx-dynamic fi @@ -95,10 +95,10 @@ jobs: $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount - uv pip install -v -e . + # uv pip install -v -e . - cp vcpkg_installed/x64-windows/bin/*.dll src/demo/ + # cp vcpkg_installed/x64-windows/bin/*.dll src/demo/ - ls vcpkg_installed/x64-windows/ + # ls vcpkg_installed/x64-windows/ - py.test + # py.test diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5c41018..3dd603e 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -2,7 +2,7 @@ name: Build package wheels on: workflow_dispatch: - pull_request: + #pull_request: push: branches: - main @@ -38,7 +38,7 @@ jobs: run: | case "${RUNNER_OS}" in "Windows") - VCPKG_HOST_TRIPLET="x64-windows" + VCPKG_HOST_TRIPLET="x64-windows-static-md" ;; "Linux") VCPKG_HOST_TRIPLET="x64-linux-dynamic" From f40ce8d24fe1f7c88ff76fb294e3644b85339a3b Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 22:02:57 -0400 Subject: [PATCH 15/18] run tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b847808..ba1f0a8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Run tests on: workflow_dispatch: - # pull_request: + pull_request: push: branches: - main From e83fb6cb59e1cf54dfe19b3848f59d0ef1e8d864 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 22:12:17 -0400 Subject: [PATCH 16/18] try with static deps? --- .github/workflows/test.yml | 8 +++----- .github/workflows/wheels.yml | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ba1f0a8..ef56e59 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -95,10 +95,8 @@ jobs: $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount - # uv pip install -v -e . - - # cp vcpkg_installed/x64-windows/bin/*.dll src/demo/ + uv pip install -v -e . - # ls vcpkg_installed/x64-windows/ + ls vcpkg_installed/x64-windows/ - # py.test + py.test diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 3dd603e..49cdaed 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -2,7 +2,7 @@ name: Build package wheels on: workflow_dispatch: - #pull_request: + pull_request: push: branches: - main From ccbe4f8df5f124d3bebd4cc05a28ba0672034b34 Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 22:15:10 -0400 Subject: [PATCH 17/18] remove debugging --- .github/workflows/test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ef56e59..a5549f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -90,13 +90,9 @@ jobs: .venv/Scripts/activate - ls -Recurse ./vcpkg_installed - $env:CMAKE_PREFIX_PATH="${{ github.workspace }}\pybind11\pybind11\share\cmake" $env:CMAKE_BUILD_PARALLEL_LEVEL = [Environment]::ProcessorCount uv pip install -v -e . - ls vcpkg_installed/x64-windows/ - py.test From bb9c29ceb57cdc68e0f49ebf4926fffc76a6823f Mon Sep 17 00:00:00 2001 From: Andy Shapiro Date: Mon, 11 Aug 2025 22:19:44 -0400 Subject: [PATCH 18/18] use static cpp dependencies for mac and linux --- .github/workflows/test.yml | 7 +++---- .github/workflows/wheels.yml | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a5549f9..87d27d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,8 +12,7 @@ jobs: strategy: fail-fast: false matrix: - # os: [ubuntu-24.04, windows-2022, macos-14] - os: [windows-2022] + os: [ubuntu-24.04, windows-2022, macos-14] python-version: ["3.13"] runs-on: ${{ matrix.os }} @@ -34,9 +33,9 @@ jobs: if [[ "$RUNNER_OS" == "Windows" ]]; then VCPKG_HOST_TRIPLET=x64-windows-static-md elif [[ "$RUNNER_OS" == "Linux" ]]; then - VCPKG_HOST_TRIPLET=x64-linux-dynamic + VCPKG_HOST_TRIPLET=x64-linux elif [[ "$RUNNER_OS" == "macOS" ]]; then - VCPKG_HOST_TRIPLET=arm64-osx-dynamic + VCPKG_HOST_TRIPLET=arm64-osx fi echo VCPKG_HOST_TRIPLET="$VCPKG_HOST_TRIPLET" >> $GITHUB_ENV echo $VCPKG_HOST_TRIPLET diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 49cdaed..929e237 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2022] + os: [ubuntu-24.04, windows-2022, macos-14] steps: - uses: actions/checkout@v4 @@ -41,10 +41,10 @@ jobs: VCPKG_HOST_TRIPLET="x64-windows-static-md" ;; "Linux") - VCPKG_HOST_TRIPLET="x64-linux-dynamic" + VCPKG_HOST_TRIPLET="x64-linux" ;; "macOS") - VCPKG_HOST_TRIPLET="arm64-osx-dynamic" + VCPKG_HOST_TRIPLET="arm64-osx" ;; *) echo "Unsupported RUNNER_OS: ${RUNNER_OS}"