Fix win32 build. #52
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
name: CMake Build | |
on: [push] | |
jobs: | |
build: | |
runs-on: windows-2022 | |
permissions: | |
id-token: write | |
contents: write # This is required to create/push the new git tag | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
# maybe this helps with build times | |
- run: rustup toolchain install stable --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "src/rust" | |
- name: vcpkg | |
uses: johnwason/vcpkg-action@v6 | |
with: | |
pkgs: libqrencode | |
triplet: x86-windows-static | |
token: ${{ github.token }} | |
# NOTE: Ninja does not support specifying an architecture, so I am going with the default which seems to be MSBuild | |
# NOTE: CMAKE_GENERATOR_PLATFORM must take WIN32, not x86 because consistency (thanks to https://stackoverflow.com/questions/28350214/#comment121308920_52846043 and https://github.com/microsoft/vcpkg/issues/15465) | |
- name: Configure | |
run: cmake -DCMAKE_GENERATOR_PLATFORM=WIN32 -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x86-windows-static -DVCPKG_MANIFEST_MODE=OFF -DCMAKE_BUILD_TYPE=Release -S . -B build | |
- name: Build | |
run: cmake --build build --config Release | |
- name: Strip | |
run: strip -s build/Release/libpresage.dll | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: build/Release/libpresage.dll | |
name: libpresage.dll | |
- name: Prepare Release Info | |
run: | | |
$COMMIT_DATE = (git log -1 --date=format:'%Y%m%d' --format='%ad') | |
echo "COMMIT_DATE=$COMMIT_DATE" | Out-File -FilePath $Env:GITHUB_ENV -Append | |
[string](Get-Content "src\rust\Cargo.toml") -match 'presage = [^}]+rev = \"([a-f0-9]+)\"' | Out-Null | |
$PRESAGE_REVISION = $matches[1] | |
echo "PRESAGE_REVISION=$PRESAGE_REVISION" | Out-File -FilePath $Env:GITHUB_ENV -Append | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: build/Release/libpresage.dll | |
tag: nightly-${{ env.COMMIT_DATE }}-${{ env.PRESAGE_REVISION }} | |
#name: Nightly ${{ github.sha }} | |
allowUpdates: true | |
artifactErrorsFailBuild: true | |
makeLatest: true |