Add cmake + native windows support for asymptote, with fully working make support #371
Workflow file for this run
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: build-asy-cxx-windows | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- "master" | |
- "a/*" | |
push: | |
branches: | |
- msvc-* | |
env: | |
pwsh_initialize_devenv: | | |
$VsInfo = Get-CimInstance MSFT_VSInstance -Namespace root/cimv2/vs | |
& "$($VsInfo.InstallLocation)\\Common7\\Tools\\Launch-VsDevShell.ps1" ` | |
-Arch amd64 -HostArch amd64 -SkipAutomaticLocation | |
$env:VCPKG_ROOT = "$env:VCPKG_INSTALLATION_ROOT" | |
cmake_msvc_profile: msvc/release-with-existing-asymptote-pdf | |
jobs: | |
configure-windows-msvc-x64: | |
runs-on: "windows-2022" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- uses: ./.github/actions/initialize-windows-env | |
- name: Configure MSVC-Release | |
shell: pwsh | |
run: | | |
${{ env.pwsh_initialize_devenv }} | |
cmake --preset ${{ env.cmake_msvc_profile }} | |
- name: zip cmake configuration | |
shell: pwsh | |
# Compress-Archive cmdlet does not support hidden files | |
# remove vcpkg_installed to make config zip smaller | |
run: | | |
$loc = Get-Location | |
Remove-Item -Recurse -Force cmake-build-msvc\release\vcpkg_installed | |
[System.IO.Compression.ZipFile]::CreateFromDirectory(` | |
"$($loc.Path)\cmake-build-msvc",` | |
"$($loc.Path)\cmake-msvc-x64-release-cfg.zip",` | |
[System.IO.Compression.CompressionLevel]::NoCompression,` | |
$true` | |
) | |
- name: Upload configuration artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cmake-msvc-x64-release-cfg-zip | |
path: cmake-msvc-x64-release-cfg.zip | |
build-windows-msvc-x64: | |
needs: configure-windows-msvc-x64 | |
runs-on: "windows-2022" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- uses: ./.github/actions/initialize-windows-env | |
- name: Setup TeXLive Action | |
uses: teatimeguest/[email protected] | |
with: | |
packages: | | |
scheme-basic | |
hypdoc | |
parskip | |
etoolbox | |
ocgx2 | |
media9 | |
- name: Install ghostscript | |
shell: pwsh | |
run: choco install ghostscript | |
- name: Download configuration artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: cmake-msvc-x64-release-cfg-zip | |
- name: Unzip configuration artifact | |
run: | | |
Expand-Archive ` | |
-Path cmake-msvc-x64-release-cfg.zip ` | |
-DestinationPath . | |
- name: Generate version suffix for github runner | |
run: | | |
"set(ASY_VERSION_SUFFIX `"/github-ci/ref=${{ github.sha }}`")" | Out-File -Path asy-pkg-version-suffix.cmake | |
- name: Remove CMakeCache.txt | |
run: Remove-Item cmake-build-msvc/release/CMakeCache.txt | |
- name: Reconfigure CMake (now that we have TeX Live) | |
run: | | |
${{ env.pwsh_initialize_devenv }} | |
cmake --preset ${{ env.cmake_msvc_profile }} | |
- name: Build asymptote on windows | |
run: | | |
${{ env.pwsh_initialize_devenv }} | |
cmake --build cmake-build-msvc/release --target asy-with-basefiles -j | |
- name: Archive Asymptote build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: asy-win-x64-buildfiles | |
path: | | |
cmake-build-msvc/release/asy.exe | |
cmake-build-msvc/release/base | |
cmake-build-msvc/release/*.dll | |
- name: Build Asymptote google test | |
run: | | |
${{ env.pwsh_initialize_devenv }} | |
cmake --build cmake-build-msvc/release --target asyCxxTests -j | |
- name: Archive Asymptote gtest files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: asy-win-x64-gtest-files | |
path: | | |
cmake-build-msvc/release/cxxtests/asyCxxTests.exe | |
cmake-build-msvc/release/cxxtests/*.cmake | |
cmake-build-msvc/release/cxxtests/*.dll | |
- name: Archive Asymptote test files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: asy-win-x64-testfiles | |
path: | | |
cmake-build-msvc/release/CTest*.cmake | |
- name: Build asymptote documentation (except asymptote.pdf) | |
run: | | |
${{ env.pwsh_initialize_devenv }} | |
cmake --build cmake-build-msvc/release --target docgen -j | |
- name: Archive asymptote documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: asy-win-x64-misc-docs | |
path: | | |
cmake-build-msvc/release/docbuild/asymptote.sty | |
cmake-build-msvc/release/docbuild/asy-latex.pdf | |
cmake-build-msvc/release/docbuild/CAD.pdf | |
cmake-build-msvc/release/docbuild/TeXShopAndAsymptote.pdf | |
cmake-build-msvc/release/docbuild/asyRefCard.pdf | |
cmake-build-msvc/release/docbuild/latexusage.pdf | |
test-windows-msvc-x64-cxxtests: | |
needs: build-windows-msvc-x64 | |
runs-on: "windows-2022" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- uses: ./.github/actions/initialize-windows-env | |
- name: Download test artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: asy-win-x64-testfiles | |
path: cmake-build-msvc/release/ | |
- name: Download artifacts for gtest | |
uses: actions/download-artifact@v4 | |
with: | |
name: asy-win-x64-gtest-files | |
path: cmake-build-msvc/release/cxxtests | |
- name: google test | |
run: ctest --test-dir cmake-build-msvc/release -R "^cxxtests." | |
test-windows-msvc-x64-asy-tests: | |
needs: build-windows-msvc-x64 | |
runs-on: "windows-2022" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- uses: ./.github/actions/initialize-windows-env | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: asy-win-x64-buildfiles | |
path: cmake-build-msvc/release/ | |
- name: Download test artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: asy-win-x64-testfiles | |
path: cmake-build-msvc/release/ | |
- name: asy test | |
run: ctest --test-dir cmake-build-msvc/release -R "^asy.*" -E "asy.(gc.*|pic.trans)" | |
package-asymptote-artifacts-win: | |
needs: [ test-windows-msvc-x64-cxxtests, test-windows-msvc-x64-asy-tests ] | |
runs-on: "windows-2022" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: asy-win-x64-buildfiles | |
path: zip-stage | |
- name: Copy examples to zip-stage | |
run: Copy-Item -Recurse -Path examples -Destination zip-stage/examples | |
- name: Archive Asymptote test files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: asymptote-build-windows | |
path: | | |
zip-stage/* |