Skip to content

Commit

Permalink
CI: Always include macOS version in explicit triples
Browse files Browse the repository at this point in the history
Wrt. issue #4501.
  • Loading branch information
kinke committed Jan 6, 2024
1 parent 530d41b commit 476c67a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/actions/3-build-cross/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ runs:
set -eux
cd ..
arch='${{ inputs.arch }}'
triple="$arch-apple-macos"
triple="$arch-apple-macos$MACOSX_DEPLOYMENT_TARGET"
echo "DFLAGS=-mtriple=$triple -L-L$PWD/build-cross-libs/lib -Xcc=-target -Xcc=$triple -Xcc=-isysroot -Xcc=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" >> $GITHUB_ENV
echo "CROSS_TRIPLE=$triple" >> $GITHUB_ENV
echo "CROSS_CMAKE_FLAGS=-DCMAKE_OSX_ARCHITECTURES=$arch" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/merge-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ runs:
switches = [
\"-defaultlib=phobos2-ldc,druntime-ldc\",
\"-Xcc=-target\",
\"-Xcc=x86_64-apple-macos\",
\"-Xcc=x86_64-apple-macos$MACOSX_DEPLOYMENT_TARGET\",
];
lib-dirs = [
\"%%ldcbinarypath%%/../lib-x86_64\",
Expand All @@ -77,7 +77,7 @@ runs:
switches = [
\"-defaultlib=phobos2-ldc,druntime-ldc\",
\"-Xcc=-target\",
\"-Xcc=arm64-apple-macos\",
\"-Xcc=arm64-apple-macos$MACOSX_DEPLOYMENT_TARGET\",
];
lib-dirs = [
\"%%ldcbinarypath%%/../lib-arm64\",
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ jobs:
name: macOS universal
runs-on: macos-latest
timeout-minutes: 30
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
needs:
- build-native
- build-cross
Expand Down
4 changes: 2 additions & 2 deletions driver/targetmachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,10 @@ createTargetMachine(const std::string targetTriple, const std::string arch,
triple = llvm::Triple(
llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple()));

// Apple: translate darwin to macos, apparently like clang
if (triple.getOS() == llvm::Triple::Darwin) {
// We only support OSX, so darwin should really be macosx.
llvm::SmallString<16> osname;
osname += "macosx";
osname += "macos";
// We have to specify OS version in the triple to avoid linker warnings,
// see https://github.com/ldc-developers/ldc/issues/4501.
// If environment variable MACOSX_DEPLOYMENT_TARGET is not set, then use
Expand Down
2 changes: 1 addition & 1 deletion tests/compilable/gh4489.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// REQUIRES: target_AArch64
// RUN: %ldc -mtriple=arm64-apple-macos -c %s
// RUN: %ldc -mtriple=arm64-apple-macos11.0 -c %s

void foo(inout float[3]);

Expand Down

0 comments on commit 476c67a

Please sign in to comment.