-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): prepare build for mobile targets (#4830)
Co-authored-by: Yu-Wei Wu <wusyong9104@gmail.com>
- Loading branch information
1 parent
5cc1fd0
commit c04d034
Showing
20 changed files
with
376 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"tauri-build": patch | ||
--- | ||
|
||
Create the `desktop` and `mobile` cfg aliases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-License-Identifier: MIT | ||
|
||
// creates a cfg alias if `has_feature` is true. | ||
// `alias` must be a snake case string. | ||
fn alias(alias: &str, has_feature: bool) { | ||
if has_feature { | ||
println!("cargo:rustc-cfg={}", alias); | ||
} | ||
} | ||
|
||
fn main() { | ||
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); | ||
let mobile = target_os == "ios" || target_os == "android"; | ||
alias("desktop", !mobile); | ||
alias("mobile", mobile); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.