204 lines
6.0 KiB
Markdown
204 lines
6.0 KiB
Markdown
# Layers
|
|
|
|
A Photoshop-style logical-layer panel for KiCad 10. Group items into named logical layers,
|
|
hide them as a unit, rename/colour/lock/annotate, run set ops (merge/subtract/intersect),
|
|
snap to grid, snapshot and restore — all live against an open `pcbnew` session over KiCad's
|
|
IPC API.
|
|
|
|
Rendering of in-panel board previews is powered by [Siphon](https://git.else-if.org/jess/Siphon),
|
|
a pure-Rust KiCad-board-to-vectors crate. No shell-outs, no `kicad-cli`.
|
|
|
|
## Install
|
|
|
|
Every platform installs into KiCad 10's 3rd-party plugin directory. After install, open
|
|
KiCad's **Plugin and Content Manager** and rescan, or relaunch KiCad; the Layers toolbar
|
|
button appears in `pcbnew`.
|
|
|
|
### macOS
|
|
|
|
Requires Xcode Command-Line Tools, Rust (`rustup`), and `rsvg-convert` (optional; only used
|
|
to regenerate icons from `resources/Layers.svg`).
|
|
|
|
```sh
|
|
git clone https://git.else-if.org/jess/Layers
|
|
cd Layers
|
|
./scripts/install.sh
|
|
```
|
|
|
|
Installs to `~/Documents/KiCad/10.0/plugins/com.jesshunter.layers/`.
|
|
|
|
### Windows (10 / 11, ARM64 or x86_64)
|
|
|
|
The Windows shell is a **WinUI 3** (.NET 8) app that hosts the Rust renderer through
|
|
a `SwapChainPanel`. The Rust side builds as a cdylib via **MSYS2 + MinGW** — no full
|
|
Visual Studio Build Tools required. Both ARM64 and x86_64 hosts work the same way.
|
|
|
|
#### 1. Install MSYS2
|
|
|
|
Download and run the installer from <https://www.msys2.org>. Accept the defaults
|
|
(`C:\msys64`). When it finishes, launch the **MSYS2** shell it drops on your Start menu.
|
|
|
|
#### 2. Install the toolchain for your CPU
|
|
|
|
In the MSYS2 shell:
|
|
|
|
```sh
|
|
# ARM64 (Snapdragon X, Surface Pro 11, etc.)
|
|
pacman -Syu
|
|
pacman -S --needed \
|
|
mingw-w64-clang-aarch64-toolchain \
|
|
mingw-w64-clang-aarch64-cmake \
|
|
mingw-w64-clang-aarch64-ninja \
|
|
mingw-w64-clang-aarch64-librsvg \
|
|
git
|
|
|
|
# x86_64 (Intel / AMD)
|
|
pacman -Syu
|
|
pacman -S --needed \
|
|
mingw-w64-ucrt-x86_64-toolchain \
|
|
mingw-w64-ucrt-x86_64-cmake \
|
|
mingw-w64-ucrt-x86_64-ninja \
|
|
mingw-w64-ucrt-x86_64-librsvg \
|
|
git
|
|
```
|
|
|
|
(You can close + reopen the shell after the first `pacman -Syu` if it asks you to.)
|
|
|
|
#### 3. Install Rust + the GNU target
|
|
|
|
In **PowerShell** (not MSYS2):
|
|
|
|
```powershell
|
|
# Install rustup
|
|
winget install --id Rustlang.Rustup
|
|
# or: irm https://win.rustup.rs/x86_64 | iex
|
|
|
|
# After rustup finishes, add the matching GNU target:
|
|
# ARM64:
|
|
rustup target add aarch64-pc-windows-gnullvm
|
|
# x86_64:
|
|
rustup target add x86_64-pc-windows-gnu
|
|
```
|
|
|
|
#### 4. Add MinGW to your user PATH
|
|
|
|
Rust's GNU target calls out to the MinGW linker, so that directory needs to be on
|
|
PATH. Run this **once** in PowerShell (elevated shell not required):
|
|
|
|
```powershell
|
|
# ARM64
|
|
[Environment]::SetEnvironmentVariable(
|
|
"Path",
|
|
[Environment]::GetEnvironmentVariable("Path", "User") + ";C:\msys64\clangarm64\bin",
|
|
"User"
|
|
)
|
|
|
|
# x86_64
|
|
[Environment]::SetEnvironmentVariable(
|
|
"Path",
|
|
[Environment]::GetEnvironmentVariable("Path", "User") + ";C:\msys64\ucrt64\bin",
|
|
"User"
|
|
)
|
|
```
|
|
|
|
Close and reopen every PowerShell / cmd window after this so they pick up the change.
|
|
|
|
#### 5. Install .NET 8 SDK + Windows App SDK workload
|
|
|
|
In PowerShell:
|
|
|
|
```powershell
|
|
winget install Microsoft.DotNet.SDK.8
|
|
dotnet workload install maui-windows
|
|
```
|
|
|
|
The Windows App SDK itself is pulled in via NuGet when the shell builds. The
|
|
`maui-windows` workload supplies the MSBuild tasks that WinUI 3's PRI/MRT targets
|
|
reach for, which would otherwise only be available with a full Visual Studio install.
|
|
|
|
#### 6. Build + install
|
|
|
|
```bat
|
|
git clone https://git.else-if.org/jess/Layers
|
|
cd Layers
|
|
install.bat
|
|
```
|
|
|
|
Installs to `%USERPROFILE%\Documents\KiCad\10.0\plugins\com.jesshunter.layers\`
|
|
(or the OneDrive-redirected equivalent).
|
|
|
|
Runtime requirement on the target machine: **.NET 8 Desktop Runtime**. `winget install
|
|
Microsoft.DotNet.DesktopRuntime.8` — the installer's ~100 MB and common on modern
|
|
Windows boxes.
|
|
|
|
For a polished build you'll also want ImageMagick — it composes the Windows `.ico`
|
|
from the SVG, called from an MSBuild `<Target>` inside `LayersShell.csproj` so it runs
|
|
as part of `dotnet publish`. `rsvg-convert` was already pulled in via the MSYS2
|
|
`…-librsvg` package.
|
|
|
|
```powershell
|
|
winget install ImageMagick.ImageMagick
|
|
```
|
|
|
|
Neither tool is strictly required — the Target's `ContinueOnError="true"` and the
|
|
ApplicationIcon `Condition="Exists(...)"` let the build skip icon baking and fall
|
|
through to the default .NET exe icon if either is missing. If you don't want MSYS2
|
|
and need a standalone `rsvg-convert` (x86_64 only), grab a release from
|
|
<https://github.com/charls-data/static-rsvg-convert/releases> and drop it on PATH.
|
|
|
|
### Linux — Debian / Ubuntu / Pop!_OS (apt)
|
|
|
|
```sh
|
|
sudo apt update
|
|
sudo apt install -y \
|
|
build-essential pkg-config curl git \
|
|
libgtk-3-dev libxkbcommon-dev libwayland-dev \
|
|
libvulkan-dev mesa-vulkan-drivers \
|
|
librsvg2-bin
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
source "$HOME/.cargo/env"
|
|
|
|
git clone https://git.else-if.org/jess/Layers
|
|
cd Layers
|
|
./scripts/install-linux.sh
|
|
```
|
|
|
|
Installs to `~/.local/share/kicad/10.0/3rdparty/plugins/com.jesshunter.layers/`.
|
|
|
|
### Linux — Arch / Manjaro (pacman)
|
|
|
|
```sh
|
|
sudo pacman -Syu --needed \
|
|
base-devel pkgconf curl git \
|
|
gtk3 libxkbcommon wayland \
|
|
vulkan-icd-loader vulkan-headers \
|
|
librsvg
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
source "$HOME/.cargo/env"
|
|
|
|
git clone https://git.else-if.org/jess/Layers
|
|
cd Layers
|
|
./scripts/install-linux.sh
|
|
```
|
|
|
|
Installs to `~/.local/share/kicad/10.0/3rdparty/plugins/com.jesshunter.layers/`.
|
|
|
|
## Configuration
|
|
|
|
`resources/colors.toml` in the installed plugin directory controls every UI colour and the
|
|
window-fade alphas. Edit to taste and restart the plugin to pick up the change.
|
|
|
|
The plugin writes settings and state to:
|
|
|
|
| Platform | Path |
|
|
|---|---|
|
|
| macOS | `~/Library/Application Support/com.jesshunter.layers/` |
|
|
| Linux | `$XDG_DATA_HOME/com.jesshunter.layers/` (typically `~/.local/share/com.jesshunter.layers/`) |
|
|
| Windows | `%APPDATA%\com.jesshunter.layers\` |
|
|
|
|
## Licence
|
|
|
|
Unlicensed — see `LICENCE`.
|
|
|
|
Written by [pszsh](https://else-if.org).
|