mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-01 14:27:00 +00:00
* ci: build the Windows x64 dependencies and slicer with clang-cl Passes -l -x from the Windows jobs, using the clang-cl and Ninja options added in #15373. Ninja runs each dependency's build step as a plain command, so the jobs set up a VC environment for OpenSSL's nmake. arm64 stays on MSVC for now. The deps cache key gains the compiler, so windows-x64 becomes windows-x64-clang and windows-arm64 becomes windows-arm64-msvc. * deps: select OpenSSL's ARM64 target from DEPS_ARCH CMAKE_GENERATOR_PLATFORM is only set by -A, which Ninja never receives, so the Ninja build selected the x64 target on ARM64. DEPS_ARCH is derived from CMAKE_SYSTEM_PROCESSOR and is already independent of the generator. * ci: build the Windows ARM64 dependencies and slicer with clang-cl Three dependencies need handling first. libpng and OpenCV each build an ARM SIMD path that does not compile with clang-cl, so those paths are off; PNG already had the same opt-out for Apple ARM. OCCT is built with cl, since clang-cl cannot emit one of its large generated files and there is no option to turn that off. All three are gated to Windows ARM64 with clang.
224 lines
8.6 KiB
YAML
224 lines
8.6 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
cache-key:
|
|
required: true
|
|
type: string
|
|
cache-path:
|
|
required: true
|
|
type: string
|
|
valid-cache:
|
|
required: true
|
|
type: boolean
|
|
os:
|
|
required: true
|
|
type: string
|
|
arch:
|
|
required: false
|
|
type: string
|
|
compiler:
|
|
required: false
|
|
type: string
|
|
default: msvc
|
|
build-deps-only:
|
|
required: false
|
|
type: boolean
|
|
force-build:
|
|
required: false
|
|
type: boolean
|
|
|
|
jobs:
|
|
build_deps:
|
|
name: Build Deps
|
|
if: ${{ !cancelled() && (inputs.build-deps-only || inputs.force-build || inputs.valid-cache != true) }}
|
|
runs-on: ${{ inputs.os }}
|
|
env:
|
|
date:
|
|
steps:
|
|
|
|
# Setup the environment
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
lfs: 'false'
|
|
|
|
- name: load cached deps
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: ${{ inputs.cache-path }}
|
|
key: ${{ inputs.cache-key }}
|
|
|
|
- uses: lukka/get-cmake@latest
|
|
# The windows-11-arm runner needs CMake <= 3.31 (handled in the next step).
|
|
if: ${{ !(runner.os == 'Windows' && inputs.arch == 'arm64') }}
|
|
with:
|
|
cmakeVersion: "~4.3.0" # use most recent 4.3.x version
|
|
useLocalCache: true # <--= Use the local cache (default is 'false').
|
|
useCloudCache: true
|
|
|
|
- name: Install CMake 3.31.x (Windows ARM64)
|
|
# windows-11-arm ships CMake 4.x, which removed pre-3.5 policy
|
|
# compatibility AND has incomplete ASM_ARMASM linker modules
|
|
# (breaks Boost.Context on ARM64). Pin to the last 3.x release.
|
|
if: runner.os == 'Windows' && inputs.arch == 'arm64'
|
|
shell: pwsh
|
|
run: |
|
|
$ver = "3.31.6"
|
|
$url = "https://github.com/Kitware/CMake/releases/download/v$ver/cmake-$ver-windows-arm64.zip"
|
|
Invoke-WebRequest -Uri $url -OutFile "$env:RUNNER_TEMP\cmake.zip"
|
|
Expand-Archive -Path "$env:RUNNER_TEMP\cmake.zip" -DestinationPath "$env:RUNNER_TEMP\cmake" -Force
|
|
$cmakeBin = "$env:RUNNER_TEMP\cmake\cmake-$ver-windows-arm64\bin"
|
|
if (-not (Test-Path "$cmakeBin\cmake.exe")) { throw "cmake.exe not found at $cmakeBin" }
|
|
Add-Content -Path $env:GITHUB_PATH -Value $cmakeBin
|
|
|
|
- name: setup dev on Windows
|
|
if: runner.os == 'Windows'
|
|
uses: microsoft/setup-msbuild@v3
|
|
|
|
- name: Get the date on Ubuntu and macOS
|
|
if: runner.os != 'Windows'
|
|
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Get the date on Windows
|
|
if: runner.os == 'Windows'
|
|
run: echo "date=$(Get-Date -Format 'yyyyMMdd')" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
|
|
shell: pwsh
|
|
|
|
|
|
- name: Install MSYS2 (clangarm64) with GMP/MPFR and LLVM tools
|
|
if: runner.os == 'Windows' && inputs.arch == 'arm64'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: CLANGARM64
|
|
update: true
|
|
install: >-
|
|
mingw-w64-clang-aarch64-gmp
|
|
mingw-w64-clang-aarch64-mpfr
|
|
mingw-w64-clang-aarch64-llvm
|
|
|
|
- name: Stage ARM64 GMP/MPFR (no prebuilt blobs exist for win-arm64)
|
|
# GMP/MPFR ship prebuilt x64/x86 blobs in-tree but none for ARM64.
|
|
# Pull them from MSYS2 clangarm64 and generate MSVC import libs via
|
|
# llvm-dlltool, then stage into deps/{GMP,MPFR}/.../win-arm64 where the
|
|
# MSVC branch of GMP.cmake/MPFR.cmake copies them into the dep prefix.
|
|
if: runner.os == 'Windows' && inputs.arch == 'arm64'
|
|
shell: msys2 {0}
|
|
run: |
|
|
set -euo pipefail
|
|
BIN=/clangarm64/bin
|
|
REPO=$(cygpath -u "$GITHUB_WORKSPACE")
|
|
|
|
make_import_lib() {
|
|
local dll="$1"; local lib="$2"; local def="/tmp/${dll%.dll}.def"
|
|
echo "EXPORTS" > "$def"
|
|
llvm-readobj --coff-exports "$BIN/$dll" | awk '/Name: /{print $2}' >> "$def"
|
|
llvm-dlltool -m arm64 -D "$dll" -d "$def" -l "$BIN/$lib"
|
|
}
|
|
|
|
make_import_lib libgmp-10.dll libgmp-10.lib
|
|
|
|
# MPFR 4.x ships as libmpfr-6.dll; rename to libmpfr-4 BEFORE generating
|
|
# the import lib so the baked-in runtime DLL name is correct.
|
|
MPFR_DLL=$(ls $BIN/libmpfr-*.dll | head -1 | xargs basename)
|
|
if [ "$MPFR_DLL" != "libmpfr-4.dll" ]; then cp "$BIN/$MPFR_DLL" "$BIN/libmpfr-4.dll"; fi
|
|
make_import_lib libmpfr-4.dll libmpfr-4.lib
|
|
|
|
mkdir -p $REPO/deps/GMP/gmp/lib/win-arm64 $REPO/deps/MPFR/mpfr/lib/win-arm64
|
|
cp $BIN/libgmp-10.dll $BIN/libgmp-10.lib $REPO/deps/GMP/gmp/lib/win-arm64/
|
|
cp $BIN/libmpfr-4.dll $BIN/libmpfr-4.lib $REPO/deps/MPFR/mpfr/lib/win-arm64/
|
|
cp /clangarm64/include/gmp.h $REPO/deps/GMP/gmp/include/
|
|
cp /clangarm64/include/mpfr.h $REPO/deps/MPFR/mpfr/include/ || true
|
|
|
|
# Build Dependencies
|
|
- name: Build on Windows
|
|
if: runner.os == 'Windows'
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
if (-not "${{ vars.SELF_HOSTED }}") {
|
|
choco install strawberryperl
|
|
}
|
|
$arch = "${{ inputs.arch }}"
|
|
# -l selects clang-cl and -x Ninja; together they build the deps with clang.
|
|
$clang = "${{ inputs.compiler }}" -eq "clang"
|
|
$flags = if ($clang) { "-l", "-x" } else { @() }
|
|
if ($clang) {
|
|
# OpenSSL builds with nmake, which needs a VC environment.
|
|
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
$vs = & $vswhere -latest -property installationPath
|
|
$devArch = if ($arch -eq "arm64") { "arm64" } else { "amd64" }
|
|
Import-Module "$vs\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
|
|
Enter-VsDevShell -VsInstallPath $vs -SkipAutomaticLocation -DevCmdArguments "-arch=$devArch"
|
|
}
|
|
if ($arch -eq "arm64") {
|
|
.\build_release_vs.bat deps arm64 @flags
|
|
.\build_release_vs.bat pack arm64
|
|
} else {
|
|
.\build_release_vs.bat deps @flags
|
|
.\build_release_vs.bat pack
|
|
}
|
|
shell: pwsh
|
|
|
|
- name: Build on Mac ${{ inputs.arch }}
|
|
if: runner.os == 'macOS'
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
if [ -z "${{ vars.SELF_HOSTED }}" ]; then
|
|
brew install automake texinfo libtool pkgconf yasm nasm
|
|
fi
|
|
./build_release_macos.sh -dx ${{ !vars.SELF_HOSTED && '-j 3' || '' }} -a ${{ inputs.arch }} -t 10.15
|
|
(cd "${{ github.workspace }}/deps/build/${{ inputs.arch }}" && \
|
|
find . -mindepth 1 -maxdepth 1 ! -name 'OrcaSlicer_dep' -exec rm -rf {} +)
|
|
|
|
|
|
- name: Apt-Install Dependencies
|
|
if: runner.os == 'Linux' && !vars.SELF_HOSTED
|
|
uses: ./.github/actions/apt-install-deps
|
|
|
|
- name: Build on Ubuntu
|
|
if: runner.os == 'Linux'
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
mkdir -p ${{ github.workspace }}/deps/build/destdir
|
|
./build_linux.sh -drlL
|
|
cd deps/build
|
|
tar -czvf OrcaSlicer_dep_ubuntu_$(date +"%Y%m%d").tar.gz destdir
|
|
|
|
|
|
# Upload Artifacts
|
|
# - name: Upload Mac ${{ inputs.arch }} artifacts
|
|
# if: runner.os == 'macOS'
|
|
# uses: actions/upload-artifact@v6
|
|
# with:
|
|
# name: OrcaSlicer_dep_mac_${{ env.date }}
|
|
# path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep*.tar.gz
|
|
|
|
# - name: Upload Windows artifacts
|
|
# if: runner.os == 'Windows'
|
|
# uses: actions/upload-artifact@v6
|
|
# with:
|
|
# name: OrcaSlicer_dep_win64_${{ env.date }}
|
|
# path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep*.zip
|
|
|
|
# - name: Upload Ubuntu artifacts
|
|
# if: runner.os == 'Linux' && !env.ACT
|
|
# env:
|
|
# ubuntu-ver: '2404'
|
|
# uses: actions/upload-artifact@v6
|
|
# with:
|
|
# name: OrcaSlicer_dep_ubuntu_${{ env.ubuntu-ver }}_${{ env.date }}
|
|
# path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep_ubuntu_*.tar.gz
|
|
|
|
build_orca:
|
|
name: Build OrcaSlicer
|
|
needs: [build_deps]
|
|
if: ${{ !cancelled() && !inputs.build-deps-only && (inputs.force-build || (inputs.valid-cache == true && needs.build_deps.result == 'skipped') || (inputs.valid-cache != true && success())) }}
|
|
uses: ./.github/workflows/build_orca.yml
|
|
with:
|
|
cache-key: ${{ inputs.cache-key }}
|
|
cache-path: ${{ inputs.cache-path }}
|
|
os: ${{ inputs.os }}
|
|
arch: ${{ inputs.arch }}
|
|
compiler: ${{ inputs.compiler }}
|
|
secrets: inherit
|