Skip to content

Commit 6301e28

Browse files
authored
Merge pull request stride3d#3187 from xen2/feature/xplat-assetcompiler
macOS support + cross-platform asset pipeline
2 parents 463537b + 442d6b6 commit 6301e28

917 files changed

Lines changed: 10271 additions & 47429 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@
2323
*.exp filter=lfs diff=lfs merge=lfs -text
2424
*.a filter=lfs diff=lfs merge=lfs -text
2525
*.so filter=lfs diff=lfs merge=lfs -text
26+
*.so.* filter=lfs diff=lfs merge=lfs -text
2627
*.dylib filter=lfs diff=lfs merge=lfs -text
2728
*.pdb filter=lfs diff=lfs merge=lfs -text
2829

30+
# FFmpeg per-platform CLI binaries (no extension)
31+
deps/FFmpeg/ffmpeg.linux-x64 filter=lfs diff=lfs merge=lfs -text
32+
deps/FFmpeg/ffmpeg.osx-arm64 filter=lfs diff=lfs merge=lfs -text
33+
2934
# setup
3035
*.msi filter=lfs diff=lfs merge=lfs -text
3136
*.cab filter=lfs diff=lfs merge=lfs -text

.github/workflows/dep-astcenc.yml

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
name: "Dep: Build astcenc"
2+
3+
# Builds the ARM astc-encoder shared library for desktop host platforms used by
4+
# the asset compiler (Stride.TextureConverter -> AstcTexLib backend).
5+
# Runtime/mobile targets do NOT need astcenc; mobile devices decode ASTC natively.
6+
#
7+
# Output layout matches deps/<dep>/dotnet/<rid>/ convention (see dep-freetype.yml).
8+
# After the workflow completes, download the "astcenc-all-platforms" artifact and
9+
# commit its contents to deps/astcenc/.
10+
#
11+
# ISA variant per RID:
12+
# * win-x64 / linux-x64 -> SSE4.1 (covers all x64 hardware since 2008)
13+
# * win-arm64 -> NEON (Windows on ARM)
14+
# * osx-arm64 -> NEON (Apple Silicon)
15+
# Only ONE ISA is built per binary; astcenc does not runtime-dispatch.
16+
17+
on:
18+
workflow_dispatch:
19+
inputs:
20+
astcenc-version:
21+
description: astcenc git tag (e.g. 5.3.0)
22+
default: 5.3.0
23+
required: true
24+
25+
jobs:
26+
build-windows:
27+
name: Build astcenc (Windows ${{ matrix.arch }})
28+
runs-on: windows-2025-vs2026
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
- arch: x64
34+
rid: win-x64
35+
isa-flag: ASTCENC_ISA_SSE41
36+
isa-suffix: sse4.1
37+
- arch: ARM64
38+
rid: win-arm64
39+
isa-flag: ASTCENC_ISA_NEON
40+
isa-suffix: neon
41+
steps:
42+
- name: Checkout astc-encoder
43+
uses: actions/checkout@v4
44+
with:
45+
repository: ARM-software/astc-encoder
46+
ref: ${{ github.event.inputs.astcenc-version }}
47+
path: astcenc-src
48+
49+
- name: Build
50+
shell: pwsh
51+
run: |
52+
cmake -S astcenc-src -B astcenc-build -A ${{ matrix.arch }} `
53+
-D${{ matrix.isa-flag }}=ON `
54+
-DASTCENC_SHAREDLIB=ON `
55+
-DASTCENC_CLI=OFF `
56+
-DASTCENC_UNITTEST=OFF `
57+
-DCMAKE_BUILD_TYPE=Release
58+
cmake --build astcenc-build --config Release
59+
60+
- name: Collect output
61+
shell: pwsh
62+
run: |
63+
New-Item -Path "out/${{ matrix.rid }}" -ItemType Directory -Force
64+
# astcenc-shared.dll lands in build/Source/Release/ for the VS generator.
65+
# Single ISA build -> single shared lib; rename to astcenc.dll.
66+
$dll = Get-ChildItem astcenc-build -Recurse -Filter "astcenc-${{ matrix.isa-suffix }}-shared.dll" | Select-Object -First 1
67+
if (-not $dll) { $dll = Get-ChildItem astcenc-build -Recurse -Filter "astcenc-shared.dll" | Select-Object -First 1 }
68+
if (-not $dll) { throw "astcenc shared library not found under astcenc-build" }
69+
Copy-Item $dll.FullName "out/${{ matrix.rid }}/astcenc.dll"
70+
$pdb = $dll.FullName -replace '\.dll$', '.pdb'
71+
if (Test-Path $pdb) { Copy-Item $pdb "out/${{ matrix.rid }}/astcenc.pdb" }
72+
73+
- name: Upload
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: astcenc-${{ matrix.rid }}
77+
path: out/${{ matrix.rid }}/
78+
79+
build-linux:
80+
name: Build astcenc (Linux x64)
81+
runs-on: ubuntu-24.04
82+
steps:
83+
- name: Checkout astc-encoder
84+
uses: actions/checkout@v4
85+
with:
86+
repository: ARM-software/astc-encoder
87+
ref: ${{ github.event.inputs.astcenc-version }}
88+
path: astcenc-src
89+
90+
- name: Build
91+
run: |
92+
cmake -S astcenc-src -B astcenc-build \
93+
-DASTCENC_ISA_SSE41=ON \
94+
-DASTCENC_SHAREDLIB=ON \
95+
-DASTCENC_CLI=OFF \
96+
-DASTCENC_UNITTEST=OFF \
97+
-DCMAKE_BUILD_TYPE=Release \
98+
-DCMAKE_CXX_FLAGS="-fPIC"
99+
cmake --build astcenc-build -- -j$(nproc)
100+
101+
- name: Collect output
102+
run: |
103+
mkdir -p out/linux-x64
104+
so=$(find astcenc-build -name "libastcenc-sse4.1-shared.so" -o -name "libastcenc-shared.so" | head -n1)
105+
if [ -z "$so" ]; then echo "astcenc shared library not found"; find astcenc-build -name '*.so'; exit 1; fi
106+
# Resolve symlinks so we copy the actual binary, not a soname link.
107+
cp "$(readlink -f "$so")" out/linux-x64/libastcenc.so
108+
109+
- name: Upload
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: astcenc-linux-x64
113+
path: out/linux-x64/
114+
115+
build-macos:
116+
name: Build astcenc (macOS arm64)
117+
runs-on: macos-15
118+
steps:
119+
- name: Checkout astc-encoder
120+
uses: actions/checkout@v4
121+
with:
122+
repository: ARM-software/astc-encoder
123+
ref: ${{ github.event.inputs.astcenc-version }}
124+
path: astcenc-src
125+
126+
- name: Build
127+
run: |
128+
cmake -S astcenc-src -B astcenc-build \
129+
-DASTCENC_ISA_NEON=ON \
130+
-DASTCENC_SHAREDLIB=ON \
131+
-DASTCENC_CLI=OFF \
132+
-DASTCENC_UNITTEST=OFF \
133+
-DCMAKE_BUILD_TYPE=Release \
134+
-DCMAKE_OSX_ARCHITECTURES=arm64
135+
cmake --build astcenc-build -- -j$(sysctl -n hw.ncpu)
136+
137+
- name: Collect output
138+
run: |
139+
mkdir -p out/osx-arm64
140+
dylib=$(find astcenc-build -name "libastcenc-neon-shared.dylib" -o -name "libastcenc-shared.dylib" | head -n1)
141+
if [ -z "$dylib" ]; then echo "astcenc shared library not found"; find astcenc-build -name '*.dylib'; exit 1; fi
142+
cp "$(readlink -f "$dylib")" out/osx-arm64/libastcenc.dylib
143+
144+
- name: Upload
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: astcenc-osx-arm64
148+
path: out/osx-arm64/
149+
150+
collect:
151+
name: Collect all platforms
152+
needs: [build-windows, build-linux, build-macos]
153+
runs-on: ubuntu-24.04
154+
steps:
155+
- name: Checkout astc-encoder (for version metadata + header)
156+
uses: actions/checkout@v4
157+
with:
158+
repository: ARM-software/astc-encoder
159+
ref: ${{ github.event.inputs.astcenc-version }}
160+
path: astcenc-src
161+
fetch-depth: 1
162+
163+
- name: Download all artifacts
164+
uses: actions/download-artifact@v4
165+
with:
166+
path: artifacts/
167+
168+
- name: Organize into deps/ layout
169+
run: |
170+
OUT=astcenc-out
171+
172+
# Desktop -> dotnet/{rid}/ (matches dep-freetype.yml convention)
173+
for rid in win-x64 win-arm64 linux-x64 osx-arm64; do
174+
mkdir -p $OUT/dotnet/$rid
175+
cp artifacts/astcenc-$rid/* $OUT/dotnet/$rid/ 2>/dev/null || true
176+
done
177+
178+
# Public header (single C API surface) for reference + future bindings.
179+
mkdir -p $OUT/Include
180+
cp astcenc-src/Source/astcenc.h $OUT/Include/
181+
182+
# License (Apache-2.0 from upstream).
183+
cp astcenc-src/LICENSE.txt $OUT/license.txt
184+
185+
# Version metadata.
186+
COMMIT=$(git -C astcenc-src rev-parse HEAD)
187+
URL=$(git -C astcenc-src config --get remote.origin.url)
188+
printf 'astcenc %s\nRepository: %s\nCommit: %s\nStride: %s/%s @ %s\nBuilt: %s\nWorkflow: %s\n' \
189+
"${{ github.event.inputs.astcenc-version }}" \
190+
"$URL" \
191+
"$COMMIT" \
192+
"${{ github.server_url }}" "${{ github.repository }}" "${{ github.sha }}" \
193+
"$(date -u +%Y-%m-%d)" \
194+
"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
195+
> $OUT/VERSION.txt
196+
197+
- name: List contents
198+
run: find astcenc-out -type f | sort
199+
200+
- name: Upload combined
201+
uses: actions/upload-artifact@v4
202+
with:
203+
name: astcenc-all-platforms
204+
path: astcenc-out/

0 commit comments

Comments
 (0)