Skip to content

Commit e191358

Browse files
author
aspen
committed
Changes required for rustc/cargo to build for iOS targets
1 parent 16957bd commit e191358

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/bootstrap/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,11 @@ impl Build {
811811
if target.contains("apple-darwin") {
812812
base.push("-stdlib=libc++".into());
813813
}
814+
815+
// Required for LLVM to properly compile.
816+
if target.contains("apple-ios") {
817+
base.push("-miphoneos-version-min=10.0".into());
818+
}
814819

815820
// Work around an apparently bad MinGW / GCC optimization,
816821
// See: http://lists.llvm.org/pipermail/cfe-dev/2016-December/051980.html

src/bootstrap/native.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,14 @@ impl Step for Llvm {
175175
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
176176
}
177177

178+
// Are we compiling for iOS/tvOS?
179+
if target.contains("apple") && !target.contains("darwin") {
180+
cfg.define("CMAKE_OSX_SYSROOT", "/");
181+
cfg.define("CMAKE_OSX_DEPLOYMENT_TARGET", "");
182+
cfg.define("LLVM_ENABLE_PLUGINS", "OFF"); // Prevent cmake from adding -bundle to CFLAGS automatically.
183+
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
184+
}
185+
178186
if builder.config.llvm_thin_lto {
179187
cfg.define("LLVM_ENABLE_LTO", "Thin");
180188
if !target.contains("apple") {

0 commit comments

Comments
 (0)