@@ -241,6 +241,11 @@ jobs:
241241 shell : bash
242242 run : just --justfile "$JUSTFILE" copy-python-metadata
243243
244+ - name : Use static MSVC CRT for Windows wheel
245+ if : matrix.target == 'x86_64-pc-windows-msvc'
246+ shell : bash
247+ run : echo "RUSTFLAGS=-C target-feature=+crt-static" >> "$GITHUB_ENV"
248+
244249 - name : Build Linux wheel
245250 if : startsWith(matrix.os, 'ubuntu')
246251 uses : PyO3/maturin-action@v1
@@ -271,15 +276,12 @@ jobs:
271276 echo "WHEEL_PATH=${WHEEL_PATH}" >> "$GITHUB_ENV"
272277
273278 - name : Install built wheel
274- if :
275- matrix.name == 'linux-x86_64-manylinux2014' || !startsWith(matrix.os,
276- ' ubuntu' )
277- run : " $PYTHON_PATH" -m pip install --force-reinstall --no-deps "${{ env.WHEEL_PATH }}"
279+ if : matrix.name == 'linux-x86_64-manylinux2014' || !startsWith(matrix.os, 'ubuntu')
280+ run : |
281+ "$PYTHON_PATH" -m pip install --force-reinstall --no-deps "${{ env.WHEEL_PATH }}"
278282
279283 - name : Verify wheel import and version
280- if :
281- matrix.name == 'linux-x86_64-manylinux2014' || !startsWith(matrix.os,
282- ' ubuntu' )
284+ if : matrix.name == 'linux-x86_64-manylinux2014' || !startsWith(matrix.os, 'ubuntu')
283285 shell : bash
284286 env :
285287 BASE_VERSION : ${{ needs.verify-tag.outputs.base_version }}
@@ -288,9 +290,7 @@ jobs:
288290 run : just --justfile "$JUSTFILE" verify-wheel-version "$RELEASE_MODE" "$VERSION" "$BASE_VERSION"
289291
290292 - name : Run wheel tests
291- if :
292- matrix.name == 'linux-x86_64-manylinux2014' || !startsWith(matrix.os,
293- ' ubuntu' )
293+ if : matrix.name == 'linux-x86_64-manylinux2014' || !startsWith(matrix.os, 'ubuntu')
294294 shell : bash
295295 run : just --justfile "$JUSTFILE" test-wheel
296296
@@ -520,11 +520,19 @@ jobs:
520520 $src = "target/${{ matrix.target }}/release/${{ matrix.lib_name }}"
521521 $dst = "dist/openpit-ffi--${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.lib_name }}"
522522 Copy-Item $src $dst -Force
523+ $implibSrc = "$src.lib"
524+ if (!(Test-Path $implibSrc)) {
525+ throw "MSVC import library not found at $implibSrc"
526+ }
527+ $implibDst = "$dst.lib"
528+ Copy-Item $implibSrc $implibDst -Force
523529 Copy-Item bindings/c/openpit.h dist/openpit.h -Force
524530 Copy-Item LICENSE dist/LICENSE -Force
525531 Copy-Item OWNERS dist/OWNERS -Force
526532 $hash = (Get-FileHash -Path $dst -Algorithm SHA256).Hash.ToLower()
527533 Set-Content -Path "$dst.sha256" -Value $hash
534+ $implibHash = (Get-FileHash -Path $implibDst -Algorithm SHA256).Hash.ToLower()
535+ Set-Content -Path "$implibDst.sha256" -Value $implibHash
528536
529537 - name : Upload runtime artifacts
530538 if : ${{ needs.verify-tag.outputs.release_mode == 'production' }}
@@ -543,12 +551,82 @@ jobs:
543551 if-no-files-found : error
544552 retention-days : 1
545553
554+ build-cpp-distributable :
555+ name : Build C++ distributable
556+ needs :
557+ - verify
558+ - verify-tag
559+ runs-on : ubuntu-22.04
560+ steps :
561+ - name : Checkout
562+ uses : actions/checkout@v4
563+
564+ - name : Load CI versions
565+ shell : bash
566+ run : cat "$GITHUB_WORKSPACE/.github/ci-versions.env" >> "$GITHUB_ENV"
567+
568+ - name : Setup Rust
569+ uses : dtolnay/rust-toolchain@stable
570+ with :
571+ toolchain : ${{ env.CI_RUST }}
572+
573+ - name : Cache Rust build
574+ uses : Swatinem/rust-cache@v2
575+
576+ - name : Setup CMake
577+ uses : jwlawson/actions-setup-cmake@v2
578+ with :
579+ cmake-version : " 3.28"
580+
581+ - name : Setup just
582+ uses : extractions/setup-just@v3
583+
584+ - name : Build C++ binding
585+ shell : bash
586+ run : just build-cpp
587+
588+ - name : Install C++ binding into staging prefix
589+ shell : bash
590+ env :
591+ VERSION : ${{ needs.verify-tag.outputs.version }}
592+ run : |
593+ set -euo pipefail
594+ cmake --install bindings/cpp/build \
595+ --prefix /tmp/openpit-cpp-install \
596+ --config Release
597+ cp LICENSE /tmp/openpit-cpp-install/LICENSE
598+ cp OWNERS /tmp/openpit-cpp-install/OWNERS
599+
600+ - name : Package C++ distributable
601+ shell : bash
602+ env :
603+ VERSION : ${{ needs.verify-tag.outputs.version }}
604+ run : just --justfile "$JUSTFILE" package-cpp /tmp/openpit-cpp-install
605+
606+ - name : Upload C++ artifact
607+ if : ${{ needs.verify-tag.outputs.release_mode == 'production' }}
608+ uses : actions/upload-artifact@v4
609+ with :
610+ name : cpp-distributable
611+ path : dist/openpit-cpp--*.tar.gz*
612+ if-no-files-found : error
613+
614+ - name : Upload C++ artifact (dry-run)
615+ if : ${{ needs.verify-tag.outputs.release_mode == 'dry-run' }}
616+ uses : actions/upload-artifact@v4
617+ with :
618+ name : cpp-distributable
619+ path : dist/openpit-cpp--*.tar.gz*
620+ if-no-files-found : error
621+ retention-days : 1
622+
546623 publish-go-sources :
547624 name : Publish pit-go sources
548625 needs :
549626 - publish-rust
550627 - publish-sdist
551628 - build-runtime-artifacts
629+ - build-cpp-distributable
552630 - verify-tag
553631 runs-on : ubuntu-22.04
554632 permissions :
@@ -708,6 +786,7 @@ jobs:
708786 - publish-rust
709787 - publish-sdist
710788 - build-runtime-artifacts
789+ - build-cpp-distributable
711790 - verify-tag
712791 if : ${{ needs.verify-tag.outputs.release_mode == 'production' }}
713792 runs-on : ubuntu-22.04
@@ -724,6 +803,12 @@ jobs:
724803 path : release-assets
725804 merge-multiple : true
726805
806+ - name : Download C++ distributable artifact
807+ uses : actions/download-artifact@v4
808+ with :
809+ name : cpp-distributable
810+ path : release-assets
811+
727812 - name : Create GitHub Release with runtime assets
728813 shell : bash
729814 run : |
@@ -736,8 +821,12 @@ jobs:
736821 - crates.io: https://crates.io/crates/openpit
737822 - PyPI: https://pypi.org/project/openpit/${{ needs.verify-tag.outputs.version }}/
738823
739- Runtime artifacts for Go SDK delivery are attached to this release
740- (`.so`, `.dylib`, `.dll` and `.sha256` files per target).
824+ Runtime artifacts for SDK delivery are attached to this release
825+ (\`.so\`, \`.dylib\`, \`.dll\`, Windows \`.dll.lib\`, and
826+ \`.sha256\` files per target).
827+
828+ The C++ distributable (\`openpit-cpp--${{ needs.verify-tag.outputs.version }}.tar.gz\`)
829+ contains the public headers and CMake config-file package.
741830 EOF
742831
743832 mapfile -t ASSETS < <(find release-assets -type f | sort)
0 commit comments