-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix naked DMD-style asm emission for non-Mac x86 Darwin targets & add prebuilt druntime/Phobos for iOS/x86_64 to macOS package #3478
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,35 +267,48 @@ steps: | |
displayName: 'Android: Cross-compile x86 libraries and copy to install dir' | ||
condition: and(succeeded(), eq(variables['CI_OS'], 'android')) | ||
|
||
# Mac: add iOS/arm64 libraries | ||
# Mac: add iOS libraries (arm64 and x86_64) | ||
- script: | | ||
set -ex | ||
cd .. | ||
export PATH="$PWD/ninja:$PATH" | ||
triple="arm64-apple-ios$IOS_DEPLOYMENT_TARGET" | ||
# TODO: shared libs too, and look into `-fvisibility=hidden` requirement | ||
triple_arm64="arm64-apple-ios$IOS_DEPLOYMENT_TARGET" | ||
triple_x64="x86_64-apple-ios$IOS_DEPLOYMENT_TARGET" | ||
# TODO: build shared libs too, and look into `-fvisibility=hidden` requirement | ||
build/bin/ldc-build-runtime --ninja -j $PARALLEL_JOBS \ | ||
--buildDir=build-libs-arm64 \ | ||
--cFlags="-target;$triple" \ | ||
--dFlags="-mtriple=$triple;-fvisibility=hidden" \ | ||
--cFlags="-target;$triple_arm64" \ | ||
--dFlags="-mtriple=$triple_arm64;-fvisibility=hidden" \ | ||
--ldcSrcDir=$BUILD_SOURCESDIRECTORY \ | ||
CMAKE_SYSTEM_NAME=iOS \ | ||
CMAKE_OSX_ARCHITECTURES=arm64 \ | ||
CMAKE_OSX_DEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \ | ||
BUILD_SHARED_LIBS=OFF \ | ||
BUILD_LTO_LIBS=ON | ||
mkdir installed/lib-ios-arm64 | ||
build/bin/ldc-build-runtime --ninja -j $PARALLEL_JOBS \ | ||
--buildDir=build-libs-x86_64 \ | ||
--cFlags="-target;$triple_x64" \ | ||
--dFlags="-mtriple=$triple_x64;-fvisibility=hidden" \ | ||
--ldcSrcDir=$BUILD_SOURCESDIRECTORY \ | ||
CMAKE_SYSTEM_NAME=iOS \ | ||
CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard coding the path to the SDK should be avoided. The following command can be used retrieve the path: |
||
CMAKE_OSX_ARCHITECTURES=x86_64 \ | ||
CMAKE_OSX_DEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \ | ||
BUILD_SHARED_LIBS=OFF \ | ||
BUILD_LTO_LIBS=ON | ||
mkdir installed/lib-ios-{arm64,x86_64} | ||
cp build-libs-arm64/lib/*.a installed/lib-ios-arm64 | ||
rm installed/lib-ios-arm64/*-lto-debug.a | ||
section=" | ||
cp build-libs-x86_64/lib/*.a installed/lib-ios-x86_64 | ||
rm installed/lib-ios-{arm64,x86_64}/*-lto-debug.a | ||
sections=" | ||
\"arm64-apple-ios\": | ||
{ | ||
switches = [ | ||
\"-defaultlib=phobos2-ldc,druntime-ldc\", | ||
\"-link-defaultlib-shared=false\", | ||
\"-fvisibility=hidden\", | ||
\"-Xcc=-target\", | ||
\"-Xcc=$triple\", | ||
\"-Xcc=$triple_arm64\", | ||
\"-Xcc=-miphoneos-version-min=$IOS_DEPLOYMENT_TARGET\", | ||
\"-Xcc=-isysroot\", | ||
\"-Xcc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk\", | ||
|
@@ -304,10 +317,28 @@ steps: | |
\"%%ldcbinarypath%%/../lib-ios-arm64\", | ||
]; | ||
rpath = \"%%ldcbinarypath%%/../lib-ios-arm64\"; | ||
}; | ||
|
||
\"x86_64-apple-ios\": | ||
{ | ||
switches = [ | ||
\"-defaultlib=phobos2-ldc,druntime-ldc\", | ||
\"-link-defaultlib-shared=false\", | ||
\"-fvisibility=hidden\", | ||
\"-Xcc=-target\", | ||
\"-Xcc=$triple_x64\", | ||
\"-Xcc=-miphoneos-version-min=$IOS_DEPLOYMENT_TARGET\", | ||
\"-Xcc=-isysroot\", | ||
\"-Xcc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk\", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to run the above mentioned command to avoid hard coding the path? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's hardcoded just like the one for the arm64 triple, and noone has complained about that so far. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know. I'm just saying it would be better if it wasn't hard coded. Not for arm64 either. If someone only installs the command line tools and not Xcode, the path to the SDKs will be different. Also, Apple may decide to change the path. Originally when I started developing on Mac, the SDK was located somewhere in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we wanted to do this properly for the few users who might run into troubles (and aren't able to fix it themselves by adapting ldc2.conf), we would probably have to do something similar to the MSVC toolchain setup, invoking that |
||
]; | ||
lib-dirs = [ | ||
\"%%ldcbinarypath%%/../lib-ios-x86_64\", | ||
]; | ||
rpath = \"%%ldcbinarypath%%/../lib-ios-x86_64\"; | ||
};" | ||
echo "$section" >> installed/etc/ldc2.conf | ||
echo "$sections" >> installed/etc/ldc2.conf | ||
cat installed/etc/ldc2.conf | ||
displayName: 'Mac: Cross-compile iOS/arm64 libraries, copy to install dir and extend ldc2.conf' | ||
displayName: 'Mac: Cross-compile iOS libraries (arm64 and x86_64), copy to install dir and extend ldc2.conf' | ||
condition: and(succeeded(), eq(variables['CI_OS'], 'osx')) | ||
|
||
# Integration tests | ||
|
@@ -326,7 +357,8 @@ steps: | |
- script: | | ||
set -ex | ||
cd .. | ||
installed/bin/ldc2 -mtriple="arm64-apple-ios$IOS_DEPLOYMENT_TARGET" hello.d -of=hello_ios | ||
installed/bin/ldc2 -mtriple="arm64-apple-ios$IOS_DEPLOYMENT_TARGET" hello.d -of=hello_ios_arm64 | ||
installed/bin/ldc2 -mtriple="x86_64-apple-ios$IOS_DEPLOYMENT_TARGET" hello.d -of=hello_ios_x86_64 | ||
displayName: 'Mac: Cross-compile & -link hello-world for iOS' | ||
condition: and(succeeded(), eq(variables['CI_OS'], 'osx')) | ||
- script: | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure if it matters but Xcode does not use this triple for the simulator. I’m not currently at the computer but, IIRC, it uses
iphonesimulator
instead ofiOS
.