Skip to content

Build

Build #11

name: Build and Release Windows (Ninja + Clang)
on:
push:
tags:
- 'v*'
branches:
- main # 建议加上这个,方便你在推送分支时直接测试
workflow_dispatch:
env:
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18497/w_BaseKit_p_2022.1.2.154_offline.exe
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18529/w_HPCKit_p_2022.1.2.116_offline.exe
LINUX_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18487/l_BaseKit_p_2022.1.2.146_offline.sh
LINUX_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18479/l_HPCKit_p_2022.1.2.117_offline.sh
MACOS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18341/m_HPCKit_p_2022.1.0.86_offline.dmg
WINDOWS_CPP_COMPONENTS: intel.oneapi.win.cpp-compiler
WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler
WINDOWS_DPCPP_COMPONENTS: intel.oneapi.win.dpcpp-compiler
LINUX_CPP_COMPONENTS: intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
LINUX_FORTRAN_COMPONENTS: intel-oneapi-compiler-fortran
LINUX_DPCPP_COMPONENTS: intel-oneapi-compiler-dpcpp-cpp
LINUX_CPP_COMPONENTS_WEB: intel.oneapi.lin.dpcpp-cpp-compiler-pro
LINUX_FORTRAN_COMPONENTS_WEB: intel.oneapi.lin.ifort-compiler
LINUX_DPCPP_COMPONENTS_WEB: intel.oneapi.lin.dpcpp-cpp-compiler
MACOS_CPP_COMPONENTS: intel.oneapi.mac.cpp-compiler
MACOS_FORTRAN_COMPONENTS: intel.oneapi.mac.ifort-compiler
SAMPLES_TAG: 2022.1.0
jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout oneAPI CI Scripts
uses: actions/checkout@v4
with:
repository: oneapi-src/oneapi-ci
path: oneapi-ci
- name: install
if: steps.cache-install.outputs.cache-hit != 'true'
run: oneapi-ci/scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_CPP_COMPONENTS
- name: build
run: oneapi-ci/scripts/build_windows.bat c++ "" $SAMPLES_TAG
- name: exclude unused files from cache
if: steps.cache-install.outputs.cache-hit != 'true'
shell: bash
run: oneapi-ci/scripts/cache_exclude_windows.sh
- name: Setup Ninja
uses: llvm/actions/install-ninja@main
- name: Set up MSVC Environment
# 必须在 Configure 之前运行,确保 clang-cl 能找到系统头文件
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
shell: pwsh
run: |
# 手动指定 IPP 的 CMake 配置文件路径,确保 CMake 能找到它
$ipp_cmake_dir = "C:/Program Files (x86)/Intel/oneAPI/ipp/latest/lib/cmake/ipp"
cmake -B build -G Ninja `
-DCMAKE_C_COMPILER=clang-cl `
-DCMAKE_CXX_COMPILER=clang-cl `
-DCMAKE_BUILD_TYPE=Release `
-DIPP_DIR="$ipp_cmake_dir" `
-DCMAKE_PREFIX_PATH="C:/Program Files (x86)/Intel/oneAPI"
- name: Build
run: cmake --build build --config Release --parallel
- name: Collect and Zip VST3 Plugins
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "./vst3_release"
# 仅从 build 目录下寻找,排除脚本下载的第三方库目录
Get-ChildItem -Path "./build" -Filter "*.vst3" -Recurse | Where-Object { $_.Attributes -match "Directory" } | ForEach-Object {
Write-Host "Found plugin: $($_.FullName)"
Copy-Item -Path $_.FullName -Destination "./vst3_release/" -Recurse
}
if ((Get-ChildItem "./vst3_release/").Count -eq 0) {
Write-Error "No VST3 plugins found! Check your build output."
exit 1
}
Compress-Archive -Path "./vst3_release/*" -DestinationPath "./Plugins_Windows_VST3.zip"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: windows-vst3-zip
path: Plugins_Windows_VST3.zip
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: windows-vst3-zip
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: Plugins_Windows_VST3.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}