Skip to content

Commit 1d9ced6

Browse files
committed
[Mac Build] Add compilers to the Mac Build
* Modify the compilers step to be re-usable between Windows and Mac. * Enable SWIFT_NATIVE_SWIFT_TOOLS_PATH on macOS * Remove unneeded quotes in extra_flags * Use proper build_arch value on macOS
1 parent 3cc1295 commit 1d9ced6

File tree

2 files changed

+181
-107
lines changed

2 files changed

+181
-107
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ jobs:
179179
WINDOWS_CMAKE_SHARED_LINKER_FLAGS: ${{ steps.context.outputs.WINDOWS_CMAKE_SHARED_LINKER_FLAGS }}
180180
DARWIN_CMAKE_C_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}
181181
DARWIN_CMAKE_CXX_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}
182+
DARWIN_CMAKE_EXE_LINKER_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_EXE_LINKER_FLAGS }}
183+
DARWIN_CMAKE_SHARED_LINKER_FLAGS: ${{ steps.context.outputs.DARWIN_CMAKE_SHARED_LINKER_FLAGS }}
182184
ANDROID_CMAKE_C_FLAGS: ${{ steps.context.outputs.ANDROID_CMAKE_C_FLAGS }}
183185
ANDROID_CMAKE_CXX_FLAGS: ${{ steps.context.outputs.ANDROID_CMAKE_CXX_FLAGS }}
184186
ANDROID_CMAKE_EXE_LINKER_FLAGS: ${{ steps.context.outputs.ANDROID_CMAKE_EXE_LINKER_FLAGS }}
@@ -288,6 +290,8 @@ jobs:
288290
echo WINDOWS_CMAKE_CXX_FLAGS="/GS- /Gw /Gy /Oi /Oy /Z7 /Zc:inline /Zc:preprocessor /Zc:__cplusplus /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" >> ${GITHUB_OUTPUT}
289291
echo DARWIN_CMAKE_C_FLAGS="-g" >> ${GITHUB_OUTPUT}
290292
echo DARWIN_CMAKE_CXX_FLAGS="-g" >> ${GITHUB_OUTPUT}
293+
echo DARWIN_CMAKE_EXE_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
294+
echo DARWIN_CMAKE_SHARED_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
291295
echo ANDROID_CMAKE_C_FLAGS="-ffunction-sections -fdata-sections -g" >> ${GITHUB_OUTPUT}
292296
echo ANDROID_CMAKE_CXX_FLAGS="-ffunction-sections -fdata-sections -g" >> ${GITHUB_OUTPUT}
293297
echo WINDOWS_CMAKE_EXE_LINKER_FLAGS="-incremental:no -debug -opt:ref -opt:icf" >> ${GITHUB_OUTPUT}
@@ -300,6 +304,8 @@ jobs:
300304
echo WINDOWS_CMAKE_CXX_FLAGS="/GS- /Gw /Gy /Oi /Oy /Zc:inline /Zc:preprocessor /Zc:__cplusplus /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" >> ${GITHUB_OUTPUT}
301305
echo DARWIN_CMAKE_C_FLAGS="" >> ${GITHUB_OUTPUT}
302306
echo DARWIN_CMAKE_CXX_FLAGS="" >> ${GITHUB_OUTPUT}
307+
echo DARWIN_CMAKE_EXE_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
308+
echo DARWIN_CMAKE_SHARED_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
303309
echo ANDROID_CMAKE_C_FLAGS="-ffunction-sections -fdata-sections" >> ${GITHUB_OUTPUT}
304310
echo ANDROID_CMAKE_CXX_FLAGS="-ffunction-sections -fdata-sections" >> ${GITHUB_OUTPUT}
305311
echo WINDOWS_CMAKE_EXE_LINKER_FLAGS="" >> ${GITHUB_OUTPUT}
@@ -410,13 +416,13 @@ jobs:
410416
"include": [
411417
{
412418
"arch": "amd64",
413-
"compiler_target": "x86_64-unknown-windows-msvc",
414419
"os": "Windows",
415420
"cc": "cl",
416421
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
417422
"cxx": "cl",
418423
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
419424
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
425+
"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 }}\"",
420426
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=AMD64 -D CMAKE_MT=mt"
421427
}
422428
]
@@ -426,13 +432,13 @@ jobs:
426432
"include": [
427433
{
428434
"arch": "arm64",
429-
"compiler_target": "aarch64-unknown-windows-msvc",
430435
"os": "Windows",
431436
"cc": "cl",
432437
"cflags": "${{ steps.context.outputs.WINDOWS_CMAKE_C_FLAGS }}",
433438
"cxx": "cl",
434439
"cxxflags": "${{ steps.context.outputs.WINDOWS_CMAKE_CXX_FLAGS }}",
435440
"swiftflags": "${{ steps.context.outputs.WINDOWS_CMAKE_Swift_FLAGS }}",
441+
"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 }}\"",
436442
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=ARM64 -D CMAKE_MT=mt"
437443
}
438444
]
@@ -552,25 +558,25 @@ jobs:
552558
"include": [
553559
{
554560
"arch": "x86_64",
555-
"compiler_target": "x86_64-apple-macosx10.15",
556561
"os": "Darwin",
557562
"cc": "clang",
558563
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
559564
"cxx": "clang++",
560565
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
561566
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
562-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=x86_64"
567+
"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 }}\"",
568+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=x86_64"
563569
},
564570
{
565571
"arch": "arm64",
566-
"compiler_target": "arm64-apple-macosx10.15",
567572
"os": "Darwin",
568573
"cc": "clang",
569574
"cflags": "${{ steps.context.outputs.DARWIN_CMAKE_C_FLAGS }}",
570575
"cxx": "clang++",
571576
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
572577
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
573-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=arm64"
578+
"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 }}",
579+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=arm64"
574580
}
575581
]
576582
}
@@ -585,7 +591,7 @@ jobs:
585591
"cxx": "clang++",
586592
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
587593
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
588-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=arm64"
594+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=arm64"
589595
}
590596
]
591597
}
@@ -600,7 +606,7 @@ jobs:
600606
"cxx": "clang++",
601607
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
602608
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
603-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=x86_64"
609+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=x86_64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=x86_64"
604610
},
605611
{
606612
"arch": "arm64",
@@ -610,7 +616,7 @@ jobs:
610616
"cxx": "clang++",
611617
"cxxflags": "${{ steps.context.outputs.DARWIN_CMAKE_CXX_FLAGS }}",
612618
"swiftflags": "${{ steps.context.outputs.DARWIN_CMAKE_Swift_FLAGS }}",
613-
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" -D CMAKE_OSX_ARCHITECTURES=arm64"
619+
"extra_flags": "-D CMAKE_SYSTEM_PROCESSOR=arm64 -D CMAKE_OSX_DEPLOYMENT_TARGET=15.0 -D CMAKE_OSX_ARCHITECTURES=arm64"
614620
}
615621
]
616622
}
@@ -706,7 +712,7 @@ jobs:
706712
uses: ./.github/workflows/swift-toolchain.yml
707713
with:
708714
build_os: Darwin
709-
build_arch: aarch64
715+
build_arch: arm64
710716
build_matrix: ${{ needs.context.outputs.darwin_build_matrix }}
711717
host_matrix: ${{ needs.context.outputs.darwin_host_matrix }}
712718
target_matrix: ${{ needs.context.outputs.darwin_target_matrix }}

0 commit comments

Comments
 (0)