Replies: 2 comments
-
This isn't yet supported, but I think it would be reasonable to add |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks! For reference, the solution to my above problem using Objective
profile := env_var_or_default("profile", "debug")
# Map OS to "macos" "windows" "linux"
os := \
if \
env_var_or_default("os", "") == "Windows_NT" { "windows" } \
else if \
env_var_or_default("os", "") != "" { env_var("os") } \
else \
{ os() }
# Map Arch to "arm64" "amd64"
arch := \
if \
env_var_or_default("arch", "") != "" { env_var("arch") } \
else if \
arch() == "x86_64" { "amd64" } \
else if \
arch() == "aarch64" { "arm64" } \
else \
{ arch() }
# Map OS and Arch to Cargo target
target := \
if \
os + arch == "linuxamd64" { "x86_64-unknown-linux-gnu" } \
else if \
os + arch == "linuxarm64" { "aarch64-unknown-linux-gnu" } \
else if \
os + arch == "macosamd64" { "x86_64-apple-darwin" } \
else if\
os + arch == "macosarm64" { "aarch64-apple-darwin" } \
else if \
os + arch == "windowsamd64" { "x86_64-pc-windows-msvc" } \
else if \
os + arch == "windowsarm64" { "aarch64-pc-windows-msvc" } \
else \
{ env_var_or_default("target", "debug") }
build:
cargo build \
{{ if profile != "debug" { "--profile " + profile } else { "" } }} \
{{ if target != "" { "--target " + target } else { "" } }} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to use an
&&
or||
in my build script to reduce the size of my if statement responsible for mapping os/arch env variables to Cargo argumentsHowever I can't seem to find a way to do this. I can use a gigantic if statement however that's pretty messy.
Also can I create multi-line if statements without newline escape characters?
\
Beta Was this translation helpful? Give feedback.
All reactions