Skip to content

Commit 295fc9a

Browse files
committed
[Mac Build] Add compilers to the Mac Build
* Add custom upload/download actions for tarring artifacts before upload and after download to preserve permissions. * Add cache files for the Mac compilers build. * Modify the compilers step to be re-usable between Windows and Mac.
1 parent d88686e commit 295fc9a

File tree

6 files changed

+714
-149
lines changed

6 files changed

+714
-149
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Download Directory
2+
description: Downloads a tar artifact and extracts it to a directory, preserving permissions and symlinks.
3+
4+
inputs:
5+
name:
6+
description: 'The name of the artifact to download.'
7+
required: true
8+
path:
9+
description: 'The path to extract the artifact to.'
10+
required: true
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Create Temporary Directory
16+
shell: pwsh
17+
id: create-temp-dir
18+
run: |
19+
$TempDir = New-TemporaryFile | % { Remove-Item $_; New-Item -ItemType Directory -Path $_ }
20+
echo "temp-dir=$TempDir" >> $env:GITHUB_OUTPUT
21+
22+
- name: Download Artifact
23+
uses: actions/download-artifact@v4
24+
with:
25+
name: ${{ inputs.name }}
26+
path: ${{ steps.create-temp-dir.outputs.temp-dir }}
27+
28+
- name: Extract Tar Archive
29+
shell: pwsh
30+
id: extract-tar
31+
run: |
32+
New-Item -ItemType Directory -Path "${{ inputs.path }}" -Force | Out-Null
33+
$TarFile = Join-Path "${{ steps.create-temp-dir.outputs.temp-dir }}" "${{ inputs.name }}.tar.gz"
34+
tar -xzf $TarFile -C ${{ inputs.path }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Upload Directory
2+
description: Uploads a directory as a tar artifact, preserving permissions and symlinks.
3+
4+
inputs:
5+
name:
6+
description: 'The name of the artifact to create.'
7+
required: true
8+
path:
9+
description: 'The path to the file or directory to upload.'
10+
required: true
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Create Tar Archive
16+
shell: pwsh
17+
id: create-tar
18+
run: |
19+
$TempDir = New-TemporaryFile | % { Remove-Item $_; New-Item -ItemType Directory -Path $_ }
20+
$TarFile = Join-Path $TempDir "${{ inputs.name }}.tar.gz"
21+
echo "tar-file=$TarFile" >> $env:GITHUB_OUTPUT
22+
tar -czf $TarFile -C "${{ inputs.path }}" .
23+
24+
- uses: actions/upload-artifact@v4
25+
with:
26+
name: ${{ inputs.name }}
27+
path: ${{ steps.create-tar.outputs.tar-file }}

.github/workflows/build-toolchain.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ jobs:
142142
WINDOWS_CMAKE_SHARED_LINKER_FLAGS: ${{ steps.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}
143143
DARWIN_CMAKE_C_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}
144144
DARWIN_CMAKE_CXX_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}
145+
DARWIN_CMAKE_EXE_LINKER_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_EXE_LINKER_FLAGS }}
146+
DARWIN_CMAKE_SHARED_LINKER_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_SHARED_LINKER_FLAGS }}
145147
ANDROID_CMAKE_C_FLAGS: ${{ steps.context.outputs.ANDROID_CMAKE_C_FLAGS }}
146148
ANDROID_CMAKE_CXX_FLAGS: ${{ steps.context.outputs.ANDROID_CMAKE_CXX_FLAGS }}
147149
ANDROID_CMAKE_EXE_LINKER_FLAGS: ${{ steps.context.outputs.ANDROID_CMAKE_EXE_LINKER_FLAGS }}
@@ -244,6 +246,8 @@ jobs:
244246
echo WINDOWS_CMAKE_CXX_FLAGS="/GS- /Gw /Gy /Oi /Oy /Z7 /Zc:inline /Zc:preprocessor /Zc:__cplusplus /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" >> ${GITHUB_OUTPUT}
245247
echo DARWIN_CMAKE_C_FLAGS="-g" >> ${GITHUB_OUTPUT}
246248
echo DARWIN_CMAKE_CXX_FLAGS="-g" >> ${GITHUB_OUTPUT}
249+
echo DARWIN_CMAKE_EXE_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
250+
echo DARWIN_CMAKE_SHARED_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
247251
echo ANDROID_CMAKE_C_FLAGS="-ffunction-sections -fdata-sections -g" >> ${GITHUB_OUTPUT}
248252
echo ANDROID_CMAKE_CXX_FLAGS="-ffunction-sections -fdata-sections -g" >> ${GITHUB_OUTPUT}
249253
echo WINDOWS_CMAKE_EXE_LINKER_FLAGS="-incremental:no -debug -opt:ref -opt:icf" >> ${GITHUB_OUTPUT}
@@ -256,6 +260,8 @@ jobs:
256260
echo WINDOWS_CMAKE_CXX_FLAGS="/GS- /Gw /Gy /Oi /Oy /Zc:inline /Zc:preprocessor /Zc:__cplusplus /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" >> ${GITHUB_OUTPUT}
257261
echo DARWIN_CMAKE_C_FLAGS="" >> ${GITHUB_OUTPUT}
258262
echo DARWIN_CMAKE_CXX_FLAGS="" >> ${GITHUB_OUTPUT}
263+
echo DARWIN_CMAKE_EXE_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
264+
echo DARWIN_CMAKE_SHARED_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
259265
echo ANDROID_CMAKE_C_FLAGS="-ffunction-sections -fdata-sections" >> ${GITHUB_OUTPUT}
260266
echo ANDROID_CMAKE_CXX_FLAGS="-ffunction-sections -fdata-sections" >> ${GITHUB_OUTPUT}
261267
echo WINDOWS_CMAKE_EXE_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
@@ -306,24 +312,26 @@ jobs:
306312
"include": [
307313
{
308314
"arch": "amd64",
309-
"compiler_target": "x86_64-unknown-windows-msvc",
310315
"os": "Windows",
311316
"cc": "cl",
312317
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
313318
"cxx": "cl",
314319
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
320+
"ldflags": "${{ steps.context.outputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}",
321+
"shared_ldflags": "${{ steps.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}",
315322
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
316323
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=AMD64 -D CMAKE_MT=mt"
317324
},
318325
{
319326
"arch": "arm64",
320-
"compiler_target": "aarch64-unknown-windows-msvc",
321327
"os": "Windows",
322328
"cc": "cl",
323329
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
324330
"cxx": "cl",
325331
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
326332
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
333+
"ldflags": "${{ steps.context.outputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}",
334+
"shared_ldflags": "${{ steps.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}",
327335
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64 -D CMAKE_MT=mt"
328336
}
329337
]
@@ -423,25 +431,27 @@ jobs:
423431
"include": [
424432
{
425433
"arch": "x86_64",
426-
"compiler_target": "x86_64-apple-macosx10.15",
427434
"os": "Darwin",
428435
"cc": "clang",
429436
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
430437
"cxx": "clang++",
431438
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
432439
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
433-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=x86_64"
440+
"ldflags": "${{ steps.context.outputs.DARWIN_CMAKE_EXE_LINKER_FLAGS }}",
441+
"shared_ldflags": "${{ steps.context.outputs.DARWIN_CMAKE_SHARED_LINKER_FLAGS }}",
442+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=10.15 -D CMAKE_OSX_ARCHITECTURES=x86_64"
434443
},
435444
{
436445
"arch": "arm64",
437-
"compiler_target": "arm64-apple-macosx10.15",
438446
"os": "Darwin",
439447
"cc": "clang",
440448
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
441449
"cxx": "clang++",
442450
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
443451
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
444-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=arm64"
452+
"ldflags": "${{ steps.context.outputs.DARWIN_CMAKE_EXE_LINKER_FLAGS }}",
453+
"shared_ldflags": "${{ steps.context.outputs.DARWIN_CMAKE_SHARED_LINKER_FLAGS }}",
454+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=10.15 -D CMAKE_OSX_ARCHITECTURES=arm64"
445455
}
446456
]
447457
}
@@ -454,9 +464,9 @@ jobs:
454464
"cc": "clang",
455465
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
456466
"cxx": "clang++",
457-
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}"
467+
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
458468
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
459-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=arm64"
469+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=10.15 -D CMAKE_OSX_ARCHITECTURES=arm64"
460470
}
461471
]
462472
}
@@ -471,7 +481,7 @@ jobs:
471481
"cxx": "clang++",
472482
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
473483
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
474-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=x86_64"
484+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=10.15 -D CMAKE_OSX_ARCHITECTURES=x86_64"
475485
},
476486
{
477487
"arch": "arm64",
@@ -481,7 +491,7 @@ jobs:
481491
"cxx": "clang++",
482492
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
483493
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
484-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=arm64"
494+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=10.15 -D CMAKE_OSX_ARCHITECTURES=arm64"
485495
}
486496
]
487497
}

0 commit comments

Comments
 (0)