Skip to content

Fix ios cross compilation #197

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

Closed
Closed
Changes from all commits
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
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ impl Config {
panic!("unsupported msvc target: {}", target);
}
}
} else if target.contains("darwin") {
} else if target.contains("darwin") || target.contains("ios") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe:

Suggested change
} else if target.contains("darwin") || target.contains("ios") {
} else if target.contains("apple") {

To better support tvOS, watchOS and visionOS?

if !self.defined("CMAKE_OSX_ARCHITECTURES") {
if target.contains("x86_64") {
cmd.arg("-DCMAKE_OSX_ARCHITECTURES=x86_64");
Expand All @@ -671,6 +671,14 @@ impl Config {
panic!("unsupported darwin target: {}", target);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would need to be updated to support the other architectures used on Apple platforms, namely i686, arm64e, i386, armv7s, armv7k and arm64_32 (all of which should be passed with the same name to CMake).

}
}

if !self.defined("CMAKE_OSX_SYSROOT") && target.contains("ios") {
if target.contains("x86_64") || target.contains("sim") {
cmd.arg("-DCMAKE_OSX_SYSROOT=iphonesimulator");
} else {
cmd.arg("-DCMAKE_OSX_SYSROOT=iphoneos");
};
}
}
if let Some(ref generator) = generator {
cmd.arg("-G").arg(generator);
Expand Down