Skip to content

Commit 6e26d5a

Browse files
committed
[Mac build] Add macros build
1 parent 33ba763 commit 6e26d5a

File tree

2 files changed

+61
-30
lines changed

2 files changed

+61
-30
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,13 @@ jobs:
375375
"triple": "x86_64-unknown-windows-msvc",
376376
"compiler_target": "x86_64-unknown-windows-msvc",
377377
"os": "Windows",
378+
"platform": "Windows",
379+
"triple": "x86_64-unknown-windows-msvc",
378380
"cc": "cl",
379381
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
380382
"cxx": "cl",
381383
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
384+
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
382385
"cmake_linker_flags": "-D CMAKE_EXE_LINKER_FLAGS=\"${{ steps.context.outputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}\" -D CMAKE_SHARED_LINKER_FLAGS=\"${{ steps.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}\" -D CMAKE_STATIC_LIBRARY_PREFIX_Swift=lib",
383386
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=AMD64"
384387
},
@@ -388,10 +391,13 @@ jobs:
388391
"triple": "aarch64-unknown-windows-msvc",
389392
"compiler_target": "aarch64-unknown-windows-msvc",
390393
"os": "Windows",
394+
"platform": "Windows",
395+
"triple": "aarch64-unknown-windows-msvc",
391396
"cc": "cl",
392397
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
393398
"cxx": "cl",
394399
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
400+
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
395401
"cmake_linker_flags": "-D CMAKE_EXE_LINKER_FLAGS=\"${{ steps.context.outputs.WINDOWS_CMAKE_EXE_LINKER_FLAGS }}\" -D CMAKE_SHARED_LINKER_FLAGS=\"${{ steps.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}\" -D CMAKE_STATIC_LIBRARY_PREFIX_Swift=lib",
396402
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64"
397403
}
@@ -654,21 +660,27 @@ jobs:
654660
"arch": "x86_64",
655661
"cpu": "x86_64",
656662
"os": "Darwin",
663+
"platform": "MacOSX",
664+
"triple": "x86_64-apple-macosx15.0",
657665
"cc": "clang",
658666
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
659667
"cxx": "clang++",
660668
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
669+
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
661670
"cmake_linker_flags": "-D CMAKE_EXE_LINKER_FLAGS=\"${{ steps.context.outputs.DARWIN_CMAKE_EXE_LINKER_FLAGS }}\" -D CMAKE_SHARED_LINKER_FLAGS=\"${{ steps.context.outputs.DARWIN_CMAKE_SHARED_LINKER_FLAGS }}\"",
662671
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=x86_64"
663672
},
664673
{
665674
"arch": "arm64",
666675
"cpu": "arm64",
667676
"os": "Darwin",
677+
"platform": "MacOSX",
678+
"triple": "arm64-apple-macosx15.0",
668679
"cc": "clang",
669680
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
670681
"cxx": "clang++",
671682
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
683+
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
672684
"cmake_linker_flags": "-D CMAKE_EXE_LINKER_FLAGS=${{ steps.context.outputs.DARWIN_CMAKE_EXE_LINKER_FLAGS }} -D CMAKE_SHARED_LINKER_FLAGS=${{ steps.context.outputs.DARWIN_CMAKE_SHARED_LINKER_FLAGS }}",
673685
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=arm64"
674686
}

.github/workflows/swift-toolchain.yml

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,38 +1775,37 @@ jobs:
17751775
searchPattern: '**/*.dll'
17761776

17771777
macros:
1778-
# TODO: Build this on macOS or make an equivalent Mac-only job
1779-
if: inputs.build_os == 'Windows'
17801778
needs: [compilers, cmark_gfm, stdlib]
17811779
runs-on: ${{ inputs.default_build_runner }}
17821780

17831781
strategy:
17841782
fail-fast: false
17851783
matrix: ${{ fromJSON(inputs.host_matrix) }}
17861784

1787-
name: Windows ${{ matrix.arch }} Macros
1785+
name: ${{ matrix.os }} ${{ matrix.arch }} Macros
17881786

17891787
steps:
17901788
- name: Download Compilers
17911789
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
17921790
with:
1793-
name: Windows-${{ inputs.build_arch }}-compilers
1791+
name: ${{ inputs.build_os }}-${{ inputs.build_arch }}-compilers
17941792
path: ${{ github.workspace }}/BinaryCache/Library
17951793
- name: Download swift-syntax
17961794
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
17971795
with:
1798-
name: Windows-${{ matrix.arch }}-swift-syntax
1796+
name: ${{ matrix.os }}-${{ matrix.arch }}-swift-syntax
17991797
path: ${{ github.workspace }}/BinaryCache/swift-syntax
18001798
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
18011799
with:
1802-
name: Windows-${{ matrix.arch }}-stdlib
1800+
name: ${{ matrix.os }}-${{ matrix.arch }}-stdlib
18031801
path: ${{ github.workspace }}/BinaryCache/Library
18041802
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
1805-
if: matrix.arch == 'arm64'
1803+
if: matrix.os == 'Windows' && matrix.arch == 'arm64'
18061804
with:
18071805
name: Windows-${{ inputs.build_arch }}-stdlib
18081806
path: ${{ github.workspace }}/BinaryCache/Library
18091807
- uses: actions/download-artifact@v4
1808+
if: matrix.os == 'Windows'
18101809
with:
18111810
name: Windows-${{ matrix.arch }}-vfs-overlay
18121811
path: ${{ github.workspace }}/BinaryCache/swift/stdlib
@@ -1836,29 +1835,52 @@ jobs:
18361835
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
18371836
arch: ${{ matrix.arch }}
18381837

1839-
- run: |
1840-
$RTLPath = cygpath -w ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/bin
1841-
echo ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
1838+
- uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401
1839+
if: inputs.build_os == 'Darwin'
18421840

1843-
- name: extract swift-syntax
1841+
- name: Setup configuration
1842+
id: setup-config
18441843
run: |
1844+
$bindir = "${{ github.workspace }}/BinaryCache/swift-syntax"
1845+
$SWIFTFLAGS = "${{ matrix.swiftflags }} -strict-implicit-module-context"
1846+
1847+
if ("${{ matrix.os }}" -eq "Windows") {
1848+
$SWIFTC = cygpath -m "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe"
1849+
$bindir = cygpath -m $bindir
1850+
$SDKRoot = "${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk"
1851+
$SWIFTFLAGS += " -resource-dir ${SDKRoot}/usr/lib/swift"
1852+
$SWIFTFLAGS += " -L${SDKRoot}/usr/lib/swift/windows"
1853+
1854+
# Export the path to the runtime libraries. This is only needed for Windows.
1855+
$RTLPath = cygpath -w ${SDKRoot}/usr/bin
1856+
Write-Output ${RTLPath} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
1857+
1858+
# VFS Overlay is only required on Windows.
1859+
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1860+
$SWIFTFLAGS += " -vfsoverlay ${WINDOWS_VFS_OVERLAY}"
1861+
$SWIFTFLAGS += " -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules"
1862+
} else {
1863+
$SWIFTC = "${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc"
1864+
}
1865+
1866+
# Configure swift-syntax.
18451867
$module = "${{ github.workspace }}/BinaryCache/swift-syntax/cmake/modules/SwiftSyntaxConfig.cmake"
1846-
$bindir = cygpath -m ${{ github.workspace }}/BinaryCache/swift-syntax
18471868
(Get-Content $module).Replace('<BINARY_DIR>', "${bindir}") | Set-Content $module
18481869
1870+
# Export the configuration.
1871+
Write-Output "swiftc=${SWIFTC}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
1872+
Write-Output "swift-flags=${SWIFTFLAGS}" | Out-File -FilePath ${env:GITHUB_OUTPUT} -Encoding utf8 -Append
1873+
18491874
- name: Configure Foundation Macros
18501875
run: |
1851-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1852-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
1853-
18541876
cmake -B ${{ github.workspace }}/BinaryCache/swift-foundation-macros `
18551877
-D CMAKE_BUILD_TYPE=Release `
18561878
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
1857-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1879+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
18581880
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1859-
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift/windows -vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules ${{ inputs.CMAKE_Swift_FLAGS }}" `
1881+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
18601882
-D CMAKE_Swift_FLAGS_RELEASE="-O" `
1861-
-D CMAKE_SYSTEM_NAME=Windows `
1883+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
18621884
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
18631885
-G Ninja `
18641886
-S ${{ github.workspace }}/SourceCache/swift-foundation/Sources/FoundationMacros `
@@ -1868,16 +1890,13 @@ jobs:
18681890

18691891
- name: Configure Testing Macros
18701892
run: |
1871-
$WINDOWS_VFS_OVERLAY = cygpath -m ${{ github.workspace }}/BinaryCache/swift/stdlib/windows-vfs-overlay.yaml
1872-
$SWIFTC = cygpath -m ${{ github.workspace }}/BinaryCache/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr/bin/swiftc.exe
1873-
18741893
cmake -B ${{ github.workspace }}/BinaryCache/swift-testing-macros `
18751894
-D CMAKE_BUILD_TYPE=Release `
18761895
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/${{ inputs.swift_version }}+Asserts/usr `
1877-
-D CMAKE_Swift_COMPILER=${SWIFTC} `
1896+
-D CMAKE_Swift_COMPILER=${{ steps.setup-config.outputs.swiftc }} `
18781897
-D CMAKE_Swift_COMPILER_TARGET=${{ matrix.triple }} `
1879-
-D CMAKE_Swift_FLAGS="-resource-dir ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift -L${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift/windows -vfsoverlay ${WINDOWS_VFS_OVERLAY} -strict-implicit-module-context -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules ${{ inputs.CMAKE_Swift_FLAGS }}" `
1880-
-D CMAKE_SYSTEM_NAME=Windows `
1898+
-D CMAKE_Swift_FLAGS="${{ steps.setup-config.outputs.swift-flags }}" `
1899+
-D CMAKE_SYSTEM_NAME=${{ matrix.os }} `
18811900
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.cpu }} `
18821901
-G Ninja `
18831902
-S ${{ github.workspace }}/SourceCache/swift-testing/Sources/TestingMacros `
@@ -1891,14 +1910,14 @@ jobs:
18911910
run: cmake --build ${{ github.workspace }}/BinaryCache/swift-testing-macros --target install
18921911

18931912
- name: Upload macros
1894-
uses: actions/upload-artifact@v4
1913+
uses: thebrowsercompany/gha-upload-tar-artifact@e18c33b1cd416d0d96a91dc6dce06219f98e4e27 # main
18951914
with:
18961915
name: ${{ matrix.os }}-${{ matrix.arch }}-macros
18971916
path: ${{ github.workspace }}/BuildRoot/Library
18981917

18991918
- name: Upload PDBs to Azure
19001919
uses: microsoft/[email protected]
1901-
if: ${{ inputs.debug_info }}
1920+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
19021921
with:
19031922
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
19041923
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -1907,7 +1926,7 @@ jobs:
19071926

19081927
- name: Upload DLLs to Azure
19091928
uses: microsoft/[email protected]
1910-
if: ${{ inputs.debug_info }}
1929+
if: ${{ inputs.debug_info && matrix.os == 'Windows' }}
19111930
with:
19121931
accountName: ${{ vars.SYMBOL_SERVER_ACCOUNT }}
19131932
personalAccessToken: ${{ secrets.SYMBOL_SERVER_PAT }}
@@ -2525,7 +2544,7 @@ jobs:
25252544
with:
25262545
name: Windows-${{ matrix.arch }}-sdk
25272546
path: ${{ github.workspace }}/BinaryCache/Library/Developer/Platforms/Windows.platform
2528-
- uses: actions/download-artifact@v4
2547+
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
25292548
with:
25302549
name: Windows-${{ inputs.build_arch }}-macros
25312550
path: ${{ github.workspace }}/BinaryCache/Library
@@ -3341,7 +3360,7 @@ jobs:
33413360
path: ${{ github.workspace }}/BuildRoot/Library
33423361

33433362
- name: Download Macros
3344-
uses: actions/download-artifact@v4
3363+
uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
33453364
with:
33463365
name: Windows-${{ matrix.arch }}-macros
33473366
path: ${{ github.workspace }}/BuildRoot/Library
@@ -3626,7 +3645,7 @@ jobs:
36263645
triple_no_api_level: x86_64-unknown-linux-android
36273646

36283647
steps:
3629-
- uses: actions/download-artifact@v4
3648+
- uses: thebrowsercompany/gha-download-tar-artifact@59992d91335d4ecba543c8535f7d07238e42125d # main
36303649
# There is currently no Android NDK for Windows ARM64 so build Android only on Windows X64 host only
36313650
if: inputs.build_android
36323651
with:

0 commit comments

Comments
 (0)