-
Notifications
You must be signed in to change notification settings - Fork 4
213 lines (188 loc) · 7.13 KB
/
package.yml
File metadata and controls
213 lines (188 loc) · 7.13 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: Package
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
package:
name: ${{ matrix.os }} / ${{ matrix.format }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
format: DEB
generators: DEB
deb_arch: amd64
rpm_arch: x86_64
- os: ubuntu-24.04
format: RPM
generators: RPM
deb_arch: amd64
rpm_arch: x86_64
- os: ubuntu-24.04-arm
format: DEB
generators: DEB
deb_arch: arm64
rpm_arch: aarch64
- os: ubuntu-24.04-arm
format: RPM
generators: RPM
deb_arch: arm64
rpm_arch: aarch64
- os: windows-latest
format: NSIS
generators: NSIS
- os: macos-15
format: productbuild
generators: productbuild
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install LLVM toolchain (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y wget gnupg lsb-release software-properties-common ca-certificates
codename=$(lsb_release -cs)
llvm_version="20"
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \
| sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/llvm-snapshot.gpg
echo "deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${llvm_version} main" \
| sudo tee /etc/apt/sources.list.d/llvm-${llvm_version}.list
sudo apt-get update
sudo apt-get install -y \
llvm-${llvm_version}-dev \
libclang-${llvm_version}-dev \
clang-${llvm_version} \
cmake \
ninja-build \
rpm \
libzstd-dev
llvm_cmakedir="$(llvm-config-${llvm_version} --cmakedir)"
clang_cmakedir="$(dirname "${llvm_cmakedir}")/clang"
echo "LLVM_DIR=${llvm_cmakedir}" >> "$GITHUB_ENV"
echo "Clang_DIR=${clang_cmakedir}" >> "$GITHUB_ENV"
- name: Install LLVM toolchain (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
set -euxo pipefail
brew update
brew install --quiet cmake ninja llvm@20
llvm_prefix="$(brew --prefix llvm@20)"
echo "CC=/usr/bin/clang" >> "$GITHUB_ENV"
echo "CXX=/usr/bin/clang++" >> "$GITHUB_ENV"
echo "LLVM_DIR=${llvm_prefix}/lib/cmake/llvm" >> "$GITHUB_ENV"
echo "Clang_DIR=${llvm_prefix}/lib/cmake/clang" >> "$GITHUB_ENV"
- name: Install LLVM toolchain (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ver = "19.1.7"
$archive = "clang+llvm-${ver}-x86_64-pc-windows-msvc.tar.xz"
$url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${ver}/${archive}"
Invoke-WebRequest -Uri $url -OutFile $archive -UseBasicParsing
tar -xf $archive
$src = (Get-ChildItem -Directory "clang+llvm-*")[0].FullName
New-Item -ItemType Directory -Force "C:\Program Files\LLVM" | Out-Null
Copy-Item "$src\*" "C:\Program Files\LLVM\" -Recurse -Force
choco install ninja -y --no-progress
$llvm_prefix = "C:\Program Files\LLVM"
"LLVM_DIR=$llvm_prefix\lib\cmake\llvm" >> $env:GITHUB_ENV
"Clang_DIR=$llvm_prefix\lib\cmake\clang" >> $env:GITHUB_ENV
"$llvm_prefix\bin" >> $env:GITHUB_PATH
- name: Patch LLVM cmake for DIA SDK (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# LLVM 18.1.8 was built with VS 2019; its cmake exports hardcode the VS 2019 DIA SDK path.
# This step runs every time (not gated on cache) and rewrites that path to wherever
# diaguids.lib actually lives on this runner.
$old_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK/lib/amd64/diaguids.lib"
$dia_file = Get-ChildItem "C:\Program Files\Microsoft Visual Studio" -Filter "diaguids.lib" `
-Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.FullName -like "*amd64*" } |
Select-Object -First 1
if (-not $dia_file) {
Write-Warning "diaguids.lib not found — linker may fail for PDB targets"
exit 0
}
$actual = $dia_file.FullName -replace '\\', '/'
Write-Host "diaguids.lib found at: $actual"
$patched = 0
Get-ChildItem "C:\Program Files\LLVM\lib\cmake" -Filter "*.cmake" -Recurse |
ForEach-Object {
$text = [System.IO.File]::ReadAllText($_.FullName)
if ($text.Contains($old_path)) {
Write-Host "Patching $($_.Name)"
$text = $text.Replace($old_path, $actual)
[System.IO.File]::WriteAllText($_.FullName, $text)
$patched++
}
}
Write-Host "Patched $patched cmake file(s)"
- name: Configure (Linux / macOS)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_DIR="$LLVM_DIR" \
-DClang_DIR="$Clang_DIR" \
-DH5CPP_STATIC_LINK_LLVM=ON
- name: Configure (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cmake -S . -B build `
-G "Visual Studio 17 2022" -A x64 `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_DIR="$env:LLVM_DIR" `
-DClang_DIR="$env:Clang_DIR" `
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
- name: Build
shell: bash
run: cmake --build build --parallel --config Release
- name: Package
shell: bash
run: |
set -euxo pipefail
cd build
cpack -G "${{ matrix.generators }}" --config CPackConfig.cmake
env:
CPACK_DEBIAN_PACKAGE_ARCHITECTURE: ${{ matrix.deb_arch }}
CPACK_RPM_PACKAGE_ARCHITECTURE: ${{ matrix.rpm_arch }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: h5cpp-compiler-${{ matrix.os }}-${{ matrix.format }}
path: build/h5cpp-compiler-*
publish:
name: Publish Release
needs: package
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: h5cpp-compiler-*
- name: Create Release and upload assets
shell: bash
run: |
set -euxo pipefail
tag="${GITHUB_REF_NAME}"
gh release create "$tag" --generate-notes || true
find artifacts -type f -name "h5cpp-compiler-*" -print0 | \
xargs -0 gh release upload "$tag" --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}