Skip to content

Commit 5a8213c

Browse files
author
Roy Lin
committed
fix: make calculator recipe cross-platform
1 parent cb34cc5 commit 5a8213c

1 file changed

Lines changed: 11 additions & 18 deletions

File tree

justfile

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
default:
44
@just --list
55

6+
native-backend := if os() == "macos" {
7+
"appkit"
8+
} else if os() == "linux" {
9+
"gtk4"
10+
} else if os() == "windows" {
11+
"winui"
12+
} else {
13+
error("unsupported operating system for native GUI examples")
14+
}
15+
616
# ============================================================================
717
# Build
818
# ============================================================================
@@ -418,24 +428,7 @@ controls-native:
418428
419429
# Run the native calculator app for this operating system
420430
calculator:
421-
#!/usr/bin/env bash
422-
set -euo pipefail
423-
424-
case "$(uname -s)" in
425-
Darwin)
426-
cargo run --locked --features appkit-native --example appkit_calculator
427-
;;
428-
Linux)
429-
cargo run --locked --features gtk4-native --example gtk4_calculator
430-
;;
431-
MINGW*|MSYS*|CYGWIN*|Windows_NT)
432-
cargo run --locked --features winui-native --example winui_calculator
433-
;;
434-
*)
435-
echo "unsupported operating system for native GUI calculator: $(uname -s)" >&2
436-
exit 1
437-
;;
438-
esac
431+
cargo run --locked --features {{ native-backend }}-native --example {{ native-backend }}_calculator
439432

440433
# Run the native semantic component playground for this operating system
441434
playground:

0 commit comments

Comments
 (0)