Skip to content
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 required for rustc/cargo to build for iOS targets #73903

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,11 @@ impl Build {
if target.contains("apple-darwin") {
base.push("-stdlib=libc++".into());
}

// Required for LLVM to properly compile.
if target.contains("apple-ios") {
base.push("-miphoneos-version-min=10.0".into());
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
}

// Work around an apparently bad MinGW / GCC optimization,
// See: http://lists.llvm.org/pipermail/cfe-dev/2016-December/051980.html
Expand Down
8 changes: 8 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ impl Step for Llvm {
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
}

// Are we compiling for iOS/tvOS?
if target.contains("apple") && !target.contains("darwin") {
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
cfg.define("CMAKE_OSX_SYSROOT", "/");
cfg.define("CMAKE_OSX_DEPLOYMENT_TARGET", "");
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
cfg.define("LLVM_ENABLE_PLUGINS", "OFF"); // Prevent cmake from adding -bundle to CFLAGS automatically.
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
}

if builder.config.llvm_thin_lto {
cfg.define("LLVM_ENABLE_LTO", "Thin");
if !target.contains("apple") {
Expand Down