Skip to content

Commit db5fa1c

Browse files
author
Administrator
committed
Update build scripts to pass target environment variable for backend processes
- Modified `build.rs` to pass the `TARGET` environment variable as `APP_TARGET` to `lib.rs`, ensuring consistent access to the target architecture during the build process. - Updated references in `lib.rs` to use `APP_TARGET` instead of `TARGET`, improving clarity and maintainability in backend process spawning.
1 parent 21d7f2d commit db5fa1c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

client/src-tauri/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
fn main() {
2+
// Pass TARGET to lib.rs - Cargo sets TARGET in build scripts but not always at compile time
3+
println!("cargo:rustc-env=APP_TARGET={}", std::env::var("TARGET").unwrap_or_else(|_| "unknown".into()));
24
tauri_build::build()
35
}

client/src-tauri/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn spawn_backend_process(app: Option<&tauri::AppHandle>) -> Result<BackendProces
5252
.path()
5353
.resource_dir()
5454
.map_err(|e| format!("resource_dir: {}", e))?;
55-
let target = env!("TARGET");
55+
let target = env!("APP_TARGET");
5656
let sidecar_name = format!(
5757
"backend-{}{}",
5858
target,
@@ -134,7 +134,7 @@ fn spawn_backend_build(
134134
.path()
135135
.resource_dir()
136136
.map_err(|e| format!("resource_dir: {}", e))?;
137-
let target = env!("TARGET");
137+
let target = env!("APP_TARGET");
138138
let sidecar_name = format!(
139139
"backend-{}{}",
140140
target,

0 commit comments

Comments
 (0)