-
Notifications
You must be signed in to change notification settings - Fork 215
SwiftDriver: initial work to properly handle android cross-compilation #1560
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
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -147,14 +147,25 @@ extension GenericUnixToolchain { | |
| } | ||
| } | ||
|
|
||
| if let sdk = parsedOptions.getLastArgument(.sdk)?.asSingle ?? env["SDKROOT"], !sdk.isEmpty { | ||
hyp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| for libpath in targetInfo.runtimeLibraryImportPaths { | ||
| commandLine.appendFlag(.L) | ||
| commandLine.appendPath(VirtualPath.lookup(libpath.path)) | ||
| } | ||
| } | ||
|
|
||
| if !isEmbeddedEnabled && !parsedOptions.hasArgument(.nostartfiles) { | ||
| let swiftrtPath = VirtualPath.lookup(targetInfo.runtimeResourcePath.path) | ||
| .appending( | ||
| components: targetTriple.platformName() ?? "", | ||
| String(majorArchitectureName(for: targetTriple)), | ||
| "swiftrt.o" | ||
| ) | ||
| commandLine.appendPath(swiftrtPath) | ||
| let rsrc: VirtualPath | ||
| if let sdk = parsedOptions.getLastArgument(.sdk)?.asSingle ?? env["SDKROOT"], !sdk.isEmpty { | ||
hyp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| rsrc = try VirtualPath(path: AbsolutePath(validating: sdk) | ||
| .appending(components: "usr", "lib", "swift") | ||
| .pathString) | ||
|
||
| } else { | ||
| rsrc = VirtualPath.lookup(targetInfo.runtimeResourcePath.path) | ||
| } | ||
| let platform: String = targetTriple.platformName() ?? "" | ||
| let architecture: String = majorArchitectureName(for: targetTriple) | ||
| commandLine.appendPath(rsrc.appending(components: platform, architecture, "swiftrt.o")) | ||
| } | ||
|
|
||
| // If we are linking statically, we need to add all | ||
|
|
@@ -194,7 +205,25 @@ extension GenericUnixToolchain { | |
| commandLine.appendPath(try VirtualPath(path: opt.argument.asSingle)) | ||
| } | ||
|
|
||
| if let path = targetInfo.sdkPath?.path { | ||
| if targetTriple.environment == .android { | ||
| if let ndk = env["ANDROID_NDK_ROOT"] { | ||
| var sysroot: AbsolutePath = | ||
| try AbsolutePath(validating: ndk) | ||
| .appending(components: "toolchains", "llvm", "prebuilt") | ||
| #if arch(x86_64) | ||
| #if os(Windows) | ||
| .appending(component: "windows-x86_64") | ||
| #elseif os(Linux) | ||
| .appending(component: "linux-x86_64") | ||
| #else | ||
| .appending(component: "darwin-x86_64") | ||
| #endif | ||
| #endif | ||
| .appending(component: "sysroot") | ||
| commandLine.appendFlag("--sysroot") | ||
| commandLine.appendPath(sysroot) | ||
| } | ||
| } else if let path = targetInfo.sdkPath?.path { | ||
| commandLine.appendFlag("--sysroot") | ||
| commandLine.appendPath(VirtualPath.lookup(path)) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.