Slint cannot split the .slint compilation across crates, but a Slint LIBRARY crate exposes its generated Rust types to dependent crates (verified with a minimal proof). So: - NEW crate `qbz-ui` (lib): owns the whole .slint tree + build.rs + bundled translations; `slint::include_modules!()` + the generated types (AppWindow, MiniPlayerWindow, all globals/structs) are re-exported. Translation domain is now `qbz-ui` (the .po files renamed accordingly). - `qbz-slint` (bin) -> renamed to `qbz` (package + `[[bin]] name = "qbz"`), reclaiming the binary name from the retired Tauri app. It depends on `qbz-ui` and does `pub use qbz_ui::*;` so existing `crate::AppWindow` / `crate::*State` references resolve unchanged. This splits the single ~20 GB rustc into two crates (UI/codegen vs the 75k LOC of logic) — the foundation for lower build peak, incremental caching, and the upcoming per-feature crate extraction. Also fixed for the move: qbz-i18n bundled-.po include paths, the font/WGSL `include_bytes!`/`include_str!` paths (-> ../../qbz-ui/ui/), workspace members, dev scripts (`-p qbz`), and the CI workflows. `cargo check -p qbz` is green. cc
66 lines
3.0 KiB
Bash
Executable File
66 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# QBZ Slint — macOS dev build/run (Apple Silicon & Intel).
|
|
#
|
|
# macOS counterpart of slint-dev.sh / slint-dev-fast.sh. Same intent (build +
|
|
# run qbz-slint with the nightly PARALLEL FRONTEND so the giant Slint-generated
|
|
# module compiles across cores), but with the three Linux-only assumptions of
|
|
# those scripts removed because they break on Mach-O / Apple toolchains:
|
|
#
|
|
# 1. NO `-fuse-ld=mold`. mold only emits ELF; on macOS clang rejects it with
|
|
# "invalid linker name in argument '-fuse-ld=mold'" and the very first
|
|
# link (libc's build script) fails. Apple's default linker (ld-prime) is
|
|
# already fast, so we simply don't override the linker.
|
|
#
|
|
# 2. AES-NI/SSSE3 features are applied ONLY on x86_64. On Intel Macs they keep
|
|
# the offline CMAF decrypt fast (matches .cargo/config.toml); on aarch64
|
|
# they are meaningless (rustc warns "not a recognized feature" and ignores
|
|
# them — AES there comes from the armv8 crypto extensions automatically),
|
|
# so we omit them to keep the build output clean.
|
|
#
|
|
# 3. The nightly parallel frontend (`-Z threads`) is kept — it works on macOS
|
|
# and only cuts COMPILE time; the produced binary is identical to a plain
|
|
# `cargo build`/`cargo build --release`.
|
|
#
|
|
# By default this builds in RELEASE (release runtime perf is the whole reason we
|
|
# moved from Tauri to Slint — always measure at release). Pass --fast for a quick
|
|
# DEBUG build (opt-level 0, no debuginfo) for purely visual/layout iteration;
|
|
# DO NOT judge performance from a --fast build.
|
|
#
|
|
# Debug and release artifacts live in target/debug and target/release, so the
|
|
# two modes don't invalidate each other's cache.
|
|
#
|
|
# Usage: ./scripts/slint-dev-mac.sh [--fast] [extra cargo args]
|
|
# THREADS=8 ./scripts/slint-dev-mac.sh # override frontend threads
|
|
# ./scripts/slint-dev-mac.sh --fast -- --some-app-arg
|
|
set -euo pipefail
|
|
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
|
|
|
FAST=false
|
|
if [[ "${1:-}" == "--fast" ]]; then
|
|
FAST=true
|
|
shift
|
|
fi
|
|
|
|
# Re-list AES-NI/SSSE3 ONLY on x86_64. Setting RUSTFLAGS *overrides* (does not
|
|
# merge) .cargo/config.toml's [target.'cfg(target_arch = "x86_64")'] rustflags,
|
|
# so on an Intel Mac we must restate them here to keep the AES-NI decrypt path.
|
|
AES_FLAGS=""
|
|
if [[ "$(uname -m)" == "x86_64" ]]; then
|
|
AES_FLAGS="-C target-feature=+aes,+ssse3"
|
|
fi
|
|
|
|
# Parallel rustc frontend across cores. Defaults to the machine's logical CPU
|
|
# count; override with THREADS=N. This only speeds compilation.
|
|
THREADS="${THREADS:-$(sysctl -n hw.ncpu)}"
|
|
|
|
export RUSTFLAGS="${AES_FLAGS} -Z threads=${THREADS}"
|
|
|
|
if [[ "$FAST" == true ]]; then
|
|
# DEBUG: opt-level 0 skips the heavy LLVM passes; -C debuginfo=0 means less to
|
|
# generate and link. Unoptimised — never trust runtime behaviour from this.
|
|
export RUSTFLAGS="${RUSTFLAGS} -C debuginfo=0"
|
|
exec cargo +nightly run --manifest-path crates/Cargo.toml -p qbz "$@"
|
|
else
|
|
exec cargo +nightly run --release --manifest-path crates/Cargo.toml -p qbz "$@"
|
|
fi
|