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