-
Notifications
You must be signed in to change notification settings - Fork 38
147 lines (126 loc) · 6.05 KB
/
msvc_build.yml
File metadata and controls
147 lines (126 loc) · 6.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Build release (Windows)
on:
workflow_dispatch:
env:
BUILD_CONFIGURATION: Release
ARCH: x64
VCPKG_COMMIT: 'HEAD'
VCPKG_ROOT: ./vcpkg
VCPKG_INSTALL_FOLDER: ./vcpkg/installed
CS_XSD_INSTALL_FOLDER: xsd/libxsd-4.2.0
XSD_URL: https://www.codesynthesis.com/download/xsd/4.2/libxsd-4.2.0.tar.gz
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/487fd8c3-a3d8-4c22-a903-f8d54c2c57be/intel-oneapi-base-toolkit-2025.1.0.650_offline.exe
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/0ba263f5-de00-4e91-a780-fdb9e131c1e8/intel-oneapi-hpc-toolkit-2025.1.0.665_offline.exe
WINDOWS_CPP_COMPONENTS: intel.oneapi.win.cpp-dpcpp-common
CACHE_NUMBER: 3
VCPKG_PACKAGES: boost-process boost-iostreams boost-spirit boost-system boost-filesystem boost-timer boost-thread boost-program-options openblas 7zip xerces-c curl
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Prepare vcpkg
shell: powershell
run: |
if (-not (Test-Path $env:VCPKG_ROOT)) {
Write-Host "Cloning vcpkg repository..."
git clone https://github.com/microsoft/vcpkg $env:VCPKG_ROOT
} else {
Write-Host "vcpkg repository folder already exists."
}
if ($env:VCPKG_COMMIT -ne 'HEAD') {
Write-Host "Checking out vcpkg commit $env:VCPKG_COMMIT..."
git -C $env:VCPKG_ROOT checkout $env:VCPKG_COMMIT
}
# Bootstrap if needed
if (-not (Test-Path (Join-Path $env:VCPKG_ROOT 'vcpkg.exe'))) {
Write-Host "Bootstrapping vcpkg..."
& (Join-Path $env:VCPKG_ROOT 'bootstrap-vcpkg.bat') -disableMetrics
} else {
Write-Host "vcpkg.exe already exists; skipping bootstrap."
}
- name: Cache vcpkg
id: cache-vcpkg
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_ROOT }}/downloads
${{ env.VCPKG_ROOT }}/installed
key: vcpkg-${{ env.CACHE_NUMBER }}-${{ env.VCPKG_PACKAGES }}
- name: Install vcpkg prerequisites
shell: cmd
run: |
echo Installing packages: %VCPKG_PACKAGES%
.\vcpkg\vcpkg.exe install %VCPKG_PACKAGES% --triplet=%ARCH%-windows
.\vcpkg\vcpkg.exe integrate install
.\vcpkg\vcpkg.exe list
- name: Cache Intel OneAPI
id: cache-oneapi
uses: actions/cache@v3
with:
path: |
C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat
C:\Program Files (x86)\Intel\oneAPI\compiler
key: oneapi-${{ env.CACHE_NUMBER }}-${{ env.WINDOWS_BASEKIT_URL }}-${{ env.WINDOWS_HPCKIT_URL }}
- name: Install Intel OneAPI
if: steps.cache-oneapi.outputs.cache-hit != 'true'
shell: powershell
run: |
Write-Host "Installing Intel OneAPI..."
$url = $env:WINDOWS_HPCKIT_URL
$components = $env:WINDOWS_CPP_COMPONENTS
$tempExe = Join-Path $env:TEMP "webimage.exe"
Write-Host "Downloading installer from $url..."
curl.exe -L $url -o $tempExe
Write-Host "Extracting installer..."
$installerArgs = "-s -x -f webimage_extracted --log extract.log"
$proc = Start-Process -FilePath $tempExe -ArgumentList $installerArgs -NoNewWindow -Wait -PassThru
if ($proc.ExitCode -ne 0) {
throw "Installer execution failed with exit code $($proc.ExitCode)"
}
Remove-Item $tempExe -Force
if ([string]::IsNullOrEmpty($components)) {
$bootstrapArgs = "-s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=."
} else {
$bootstrapArgs = "-s --action install --components=$components --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=."
}
Write-Host "Running bootstrapper..."
$bootstrapperPath = Join-Path -Path (Join-Path $PWD "webimage_extracted") "bootstrapper.exe"
if (-Not (Test-Path $bootstrapperPath)) {
throw "Bootstrapper not found at $bootstrapperPath"
}
$procBootstrap = Start-Process -FilePath $bootstrapperPath -ArgumentList $bootstrapArgs -NoNewWindow -Wait -PassThru
if ($procBootstrap.ExitCode -ne 0) {
throw "Bootstrapper installation failed with exit code $($procBootstrap.ExitCode)"
}
Remove-Item -Recurse -Force "webimage_extracted"
- name: Find solution file
id: find_sln
shell: powershell
run: |
$sln = Get-ChildItem -Path $env:GITHUB_WORKSPACE -Filter *.sln -Recurse | Select-Object -First 1
if (-not $sln) { Write-Error "Solution file not found" }
Write-Host "Solution file: $($sln.FullName)"
echo "::set-output name=sln::$($sln.FullName)"
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Restore NuGet packages
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: nuget restore "${{ steps.find_sln.outputs.sln }}"
- name: Download and install xsd
shell: powershell
run: |
Write-Host "Downloading xsd from $env:XSD_URL..."
curl.exe -L $env:XSD_URL -o "./libxsd-4.2.0.tar.gz"
Write-Host "Extracting xsd..."
tar -xzf "./libxsd-4.2.0.tar.gz" -C "./xsd"
- name: Build DynAdjust
shell: cmd
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
set DEPS_DIR=%VCPKG_INSTALL_FOLDER%\%ARCH%-windows\include
set XSD_DIR=%GITHUB_WORKSPACE%\%CS_XSD_INSTALL_FOLDER%
set PATH=%DEPS_DIR%;%XSD_DIR%;%PATH%
echo %PATH%
msbuild /m /p:Configuration=%BUILD_CONFIGURATION% /p:Platform=%ARCH% /p:"VCBuildAdditionalOptions= /useenv" "${{ steps.find_sln.outputs.sln }}"