From 4bacea5bf48ea5ca6c9bdd10e28e85e67a0c6ef9 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Thu, 17 Feb 2022 19:00:19 -0300 Subject: [PATCH] feat(core): set `MACOSX_DEPLOYMENT_TARGET` environment variable, closes #2732 (#3496) --- .changes/macos-deployment-target.md | 5 +++++ core/tauri-build/src/lib.rs | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 .changes/macos-deployment-target.md diff --git a/.changes/macos-deployment-target.md b/.changes/macos-deployment-target.md new file mode 100644 index 000000000..b3220657a --- /dev/null +++ b/.changes/macos-deployment-target.md @@ -0,0 +1,5 @@ +--- +"tauri-build": patch +--- + +Automatically emit `cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET` with the value set on `tauri.conf.json > tauri > bundle > macos > minimumSystemVersion`. diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 4d2f6de79..0d891ad1d 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -240,6 +240,13 @@ pub fn try_build(attributes: Attributes) -> Result<()> { copy_resources(ResourcePaths::new(paths.as_slice(), true), target_dir)?; } + #[cfg(target_os = "macos")] + { + if let Some(version) = config.tauri.bundle.macos.minimum_system_version { + println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={}", version); + } + } + #[cfg(windows)] { use anyhow::Context;