Skip to content

Commit

Permalink
Merge pull request #51 from pewsheen/xcode-15-cross-compile-ios
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Aug 3, 2023
2 parents 973c222 + 35a9bc6 commit 03d5b7b
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions src-rs/build.rs
Expand Up @@ -232,38 +232,38 @@ impl SwiftLinker {
.join("swift-rs")
.join(&package.name);

let sdk_path_output = Command::new("xcrun")
.args(["--sdk", &rust_target.sdk.to_string(), "--show-sdk-path"])
.output()
.unwrap();
if !sdk_path_output.status.success() {
panic!(
"Failed to get SDK path with `xcrun --sdk {} --show-sdk-path`",
rust_target.sdk
);
}

let sdk_path = String::from_utf8_lossy(&sdk_path_output.stdout);

let mut command = Command::new("swift");
command
.args(["build", "-c", configuration])
.args(["build"])
.args(["--sdk", sdk_path.trim()])
.args(["-c", configuration])
.current_dir(&package.path)
.args(["--build-path", &out_path.display().to_string()]);

let sdk_path_output = Command::new("xcrun")
.args(["--sdk", &rust_target.sdk.to_string(), "--show-sdk-path"])
.output()
.unwrap();
if !sdk_path_output.status.success() {
panic!(
"Failed to get SDK path with `xcrun --sdk {} --show-sdk-path`",
rust_target.sdk
);
}

let sdk_path = String::from_utf8_lossy(&sdk_path_output.stdout);

command.args([
"-Xswiftc",
"-sdk",
"-Xswiftc",
sdk_path.trim(),
"-Xswiftc",
"-target",
"-Xswiftc",
&rust_target.swift_target_triple(
&self.macos_min_version,
self.ios_min_version.as_deref(),
),
]);
command.args([
"-Xswiftc",
"-sdk",
"-Xswiftc",
sdk_path.trim(),
"-Xswiftc",
"-target",
"-Xswiftc",
&rust_target
.swift_target_triple(&self.macos_min_version, self.ios_min_version.as_deref()),
]);

if !command.status().unwrap().success() {
panic!("Failed to compile swift package {}", package.name);
Expand Down

0 comments on commit 03d5b7b

Please sign in to comment.