Skip to content

Commit

Permalink
[Add] --arch arg to swift build command.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvelousAnything committed Oct 9, 2023
1 parent 5fc773d commit 50a909d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src-rs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,19 @@ impl SwiftLinker {
let mut command = Command::new("swift");
command.current_dir(&package.path);

let arch = match std::env::consts::ARCH {
"aarch64" => "arm64",
arch => arch,
};

command
// Build the package (duh)
.args(["build"])
// SDK path for regular compilation (idk)
.args(["--sdk", sdk_path.trim()])
// Release/Debug configuration
.args(["-c", configuration])
.args(["--arch", arch])
// Where the artifacts will be generated to
.args(["--build-path", &out_path.display().to_string()])
// Override SDK path for each swiftc instance.
Expand All @@ -280,10 +286,7 @@ impl SwiftLinker {
// swift build uses this output folder no matter what is the target
.join(format!(
"{}-apple-macosx",
match std::env::consts::ARCH {
"aarch64" => "arm64",
arch => arch,
}
arch
))
.join(configuration);

Expand Down

0 comments on commit 50a909d

Please sign in to comment.