@@ -976,25 +976,27 @@ jobs:
976
976
key : ${{ steps.workspace_hash.outputs.hash }}-${{ matrix.os }}-${{ matrix.arch }}-compilers
977
977
variant : sccache
978
978
979
- - name : Configure Compilers
979
+ - name : Setup context
980
+ id : setup-context
980
981
run : |
981
982
$CxxFlags = "${{ matrix.cxxflags }}"
982
983
$SwiftFlags = ""
983
- $EXTRA_FLAGS = @()
984
+ $ExtraFlags = "${{ matrix.extra_flags }}"
984
985
985
986
if ( "${{ matrix.os }}" -eq "Windows" ) {
986
987
$SWIFTC = cygpath -m (Get-Command swiftc).Source
987
988
# Use toolchain clang to avoid broken __prefetch intrinsic on arm64 in Clang 18.
988
989
# TODO: Use llvm-19 when available. See https://github.com/compnerd/swift-build/issues/846
989
990
$CLANG_LOCATION = Split-Path (Get-Command swiftc).Source
990
991
if ( "${{ matrix.arch }}" -eq "arm64" ) {
991
- $EXTRA_FLAGS += "${{ matrix.extra_flags }}".Split()
992
- $EXTRA_FLAGS += @("-D", "CMAKE_SYSTEM_NAME=Windows")
992
+ $ExtraFlags += " -D CMAKE_SYSTEM_NAME=Windows"
993
993
$CACHE="${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake"
994
994
995
995
# FIXME(compnerd) re-enable runtimes after we sort out compiler-rt
996
996
(Get-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake).Replace(' runtimes', '') | Set-Content ${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-aarch64.cmake
997
997
} else {
998
+ # FIXME(steelskin) Setting `CMAKE_SYSTEM_NAME and `CMAKE_SYSTEM_PROCESSOR` breaks the compiler-rt build
999
+ $ExtraFlags = ""
998
1000
$CACHE="${{ github.workspace }}/SourceCache/swift/cmake/caches/Windows-x86_64.cmake"
999
1001
}
1000
1002
$CC = "cl"
@@ -1009,7 +1011,6 @@ jobs:
1009
1011
$LIBPYTHON_PATH = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/libs/python39.lib"
1010
1012
$PYTHON_INCLUDE_DIR = "${env:PYTHON_LOCATION_${{ matrix.arch }}}/include"
1011
1013
$PYTHON_BINARY="python.exe"
1012
- $ExeSuffix = ".exe"
1013
1014
Remove-Item env:\SDKROOT
1014
1015
} elseif ( "${{ matrix.os }}" -eq "Darwin" ) {
1015
1016
# Default swiftc comes from /usr/bin and is not compatible with the toolchain.
@@ -1021,10 +1022,10 @@ jobs:
1021
1022
$CXX = Join-Path $CLANG_LOCATION "clang++"
1022
1023
$CACHE = "${{ github.workspace }}/SourceCache/swift/cmake/caches/Darwin-${{ matrix.arch }}.cmake"
1023
1024
$SDKROOT = xcrun --sdk macosx --show-sdk-path
1024
- $EXTRA_FLAGS += "${{ matrix.extra_flags }}".Split()
1025
- $EXTRA_FLAGS += @("-D", " CMAKE_SYSTEM_NAME=Darwin")
1025
+
1026
+ $ExtraFlags += " -D CMAKE_SYSTEM_NAME=Darwin"
1026
1027
# TODO: Use early-swift-driver on Windows too.
1027
- $EXTRA_FLAGS += @("-D", " SWIFT_EARLY_SWIFT_DRIVER_BUILD=${{ github.workspace }}/BinaryCache/swift-driver/bin")
1028
+ $ExtraFlags += " -D SWIFT_EARLY_SWIFT_DRIVER_BUILD=${{ github.workspace }}/BinaryCache/swift-driver/bin"
1028
1029
$LIBPYTHON_PATH = "${env:pythonLocation}/lib/python3.9/config-3.9-darwin/libpython3.9.a"
1029
1030
$PYTHON_INCLUDE_DIR = "${env:pythonLocation}/include/python3.9"
1030
1031
$PYTHON_BINARY="python3"
@@ -1033,22 +1034,46 @@ jobs:
1033
1034
1034
1035
$SwiftFlags += " -sdk `"${SDKROOT}`""
1035
1036
1037
+ Write-Output "cc=${CC}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1038
+ Write-Output "cxx=${CXX}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1039
+ Write-Output "swiftc=${SWIFTC}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1040
+ Write-Output "cxxflags=${CxxFlags}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1041
+ Write-Output "swiftflags=${SwiftFlags}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1042
+ Write-Output "extra_flags=${ExtraFlags}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1043
+ Write-Output "cache=${CACHE}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1044
+ Write-Output "clang_location=${CLANG_LOCATION}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1045
+ Write-Output "libpython_path=${LIBPYTHON_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1046
+ Write-Output "python_include_dir=${PYTHON_INCLUDE_DIR}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1047
+ Write-Output "python_binary=${PYTHON_BINARY}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1048
+ Write-Output "sdkroot=${SDKROOT}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
1049
+
1050
+ - name : Configure Compilers
1051
+ env :
1052
+ NDKPATH : ${{ steps.setup-ndk.outputs.ndk-path }}
1053
+ run : |
1054
+ if ( "${{ matrix.os }}" -eq "Windows" ) {
1055
+ $ExeSuffix = ".exe"
1056
+ Remove-Item env:\SDKROOT
1057
+ } elseif ( "${{ matrix.os }}" -eq "Darwin" ) {
1058
+ $ExeSuffix = ""
1059
+ }
1060
+
1036
1061
cmake -B ${{ github.workspace }}/BinaryCache/1 `
1037
- -C "${CACHE }" `
1062
+ -C "${{ steps.setup-context.outputs.cache } }" `
1038
1063
-D CMAKE_BUILD_TYPE=Release `
1039
- -D CMAKE_C_COMPILER="${CC }" `
1064
+ -D CMAKE_C_COMPILER="${{ steps.setup-context.outputs.cc } }" `
1040
1065
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
1041
1066
-D CMAKE_C_FLAGS="${{ matrix.cflags }}" `
1042
- -D CMAKE_CXX_COMPILER="${CXX }" `
1067
+ -D CMAKE_CXX_COMPILER="${{ steps.setup-context.outputs.cxx } }" `
1043
1068
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
1044
- -D CMAKE_CXX_FLAGS="${CxxFlags }" `
1045
- -D CMAKE_Swift_COMPILER="${SWIFTC }" `
1069
+ -D CMAKE_CXX_FLAGS="${{ steps.setup-context.outputs.cxxflags } }" `
1070
+ -D CMAKE_Swift_COMPILER="${{ steps.setup-context.outputs.swiftc } }" `
1046
1071
-D CMAKE_Swift_COMPILER_WORKS=YES `
1047
- -D CMAKE_Swift_FLAGS="${SwiftFlags }" `
1072
+ -D CMAKE_Swift_FLAGS="${{ steps.setup-context.outputs.swiftlags } }" `
1048
1073
${{ matrix.cmake_linker_flags }} `
1049
1074
-D CMAKE_FIND_PACKAGE_PREFER_CONFIG=YES `
1050
1075
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr `
1051
- @EXTRA_FLAGS `
1076
+ ${{ steps.setup-context.outputs.extra_flags }} `
1052
1077
-G Ninja `
1053
1078
-S ${{ github.workspace }}/SourceCache/llvm-project/llvm `
1054
1079
-D CLANG_TABLEGEN="${{ github.workspace }}/BinaryCache/0/bin/clang-tblgen${ExeSuffix}" `
@@ -1063,7 +1088,7 @@ jobs:
1063
1088
-D SWIFT_BUILD_DYNAMIC_STDLIB=NO `
1064
1089
-D SWIFT_BUILD_REMOTE_MIRROR=NO `
1065
1090
-D SWIFT_BUILD_SWIFT_SYNTAX=YES `
1066
- -D SWIFT_CLANG_LOCATION=${CLANG_LOCATION} `
1091
+ -D SWIFT_CLANG_LOCATION="${{ steps.setup-context.outputs.clang_location }}" `
1067
1092
-D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=YES `
1068
1093
-D SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP=YES `
1069
1094
-D SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED=YES `
@@ -1075,7 +1100,7 @@ jobs:
1075
1100
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=${{ github.workspace }}/SourceCache/swift-corelibs-libdispatch `
1076
1101
-D SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE=${{ github.workspace }}/SourceCache/swift-syntax `
1077
1102
-D SWIFT_PATH_TO_STRING_PROCESSING_SOURCE=${{ github.workspace }}/SourceCache/swift-experimental-string-processing `
1078
- -D SWIFT_PATH_TO_SWIFT_SDK="${SDKROOT }" `
1103
+ -D SWIFT_PATH_TO_SWIFT_SDK="${{ steps.setup-context.outputs.sdkroot } }" `
1079
1104
-D CLANG_VENDOR=compnerd.org `
1080
1105
-D CLANG_VENDOR_UTI=org.compnerd.dt `
1081
1106
-D cmark-gfm_DIR=${{ github.workspace }}/BinaryCache/Library/cmark-gfm-${{ inputs.swift_cmark_version }}/usr/lib/cmake `
@@ -1086,12 +1111,12 @@ jobs:
1086
1111
-D SWIFT_PARALLEL_LINK_JOBS=2 `
1087
1112
-D LLVM_APPEND_VC_REV=NO `
1088
1113
-D LLVM_VERSION_SUFFIX="" `
1089
- -D LLDB_PYTHON_EXE_RELATIVE_PATH=${PYTHON_BINARY } `
1114
+ -D LLDB_PYTHON_EXE_RELATIVE_PATH=${{ steps.setup-context.outputs.python_binary } } `
1090
1115
-D LLDB_PYTHON_EXT_SUFFIX=.pyd `
1091
1116
-D LLDB_PYTHON_RELATIVE_PATH=lib/site-packages `
1092
1117
-D Python3_EXECUTABLE=${{ steps.python.outputs.python-path }} `
1093
- -D Python3_INCLUDE_DIR=$PYTHON_INCLUDE_DIR `
1094
- -D Python3_LIBRARY=$LIBPYTHON_PATH `
1118
+ -D Python3_INCLUDE_DIR=${{ steps.setup-context.outputs.python_include_dir }} `
1119
+ -D Python3_LIBRARY=${{ steps.setup-context.outputs.libpython_path }} `
1095
1120
-D Python3_ROOT_DIR=$env:pythonLocation
1096
1121
1097
1122
- name : Build Compiler Distribution
0 commit comments