Repository navigation
Expand file tree
/
Copy pathCargo.toml
More file actions
219 lines (205 loc) · 9.42 KB
/
Copy pathCargo.toml
File metadata and controls
219 lines (205 loc) · 9.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
[package]
name = "copperline"
version = "0.14.0"
edition = "2021"
rust-version = "1.93"
license = "GPL-3.0-or-later"
description = "A cycle-driven Amiga emulator written in Rust"
readme = "README.md"
repository = "https://github.com/CopperlineHQ/Copperline"
keywords = ["amiga", "emulator", "m68k"]
categories = ["emulators"]
publish = false
# `cargo run` should keep launching the emulator now that the headless
# `copperline-bench` bin target exists.
default-run = "copperline"
[build-dependencies]
# Compiles the vendored FloppyBridge sources; see build.rs.
cc = "1"
[features]
default = [
"midi",
"frontend",
"wasm-boards",
"control",
"ctl-bin",
"net-nat",
"net-bridge",
"floppybridge",
"cpu-jit",
]
display-plan-trace = []
# Local investigation switches that deliberately alter timing or rendering.
# Normal builds keep these environment-variable overrides inert so release
# behavior is hardware-derived and reproducible.
internal-diagnostics = []
# Host MIDI bridge for Paula's serial port (`[serial] mode = "midi"`). Built in
# by default; `--no-default-features` compiles it out, and a MIDI-free build
# pulls no MIDI code and links no MIDI framework. Native backends per platform:
# CoreMIDI (macOS), the ALSA sequencer (Linux), WinMM (Windows); other targets
# get a stub. See src/midi/.
midi = []
# The interactive desktop frontend: the winit/pixels window and launcher,
# host audio output, gamepads, file dialogs, and the debugger console's
# clipboard paste. Off, the crate is the portable headless core (the surface
# a wasm32 browser frontend builds against); the `copperline` binary
# requires it.
frontend = [
"dep:winit",
"dep:pixels",
"dep:cpal",
"dep:gilrs",
"dep:rfd",
"dep:arboard",
"dep:env_logger",
]
# The wasmtime host for functional Zorro boards (src/wasmboard.rs). Separate
# from `frontend` because it is a core-machine feature, but Cranelift cannot
# be compiled FOR wasm32, so browser builds turn it off.
wasm-boards = ["dep:wasmtime"]
# Native-code compilation of hot CPU traces (the m68k crate's Cranelift trace
# JIT), used by the `[cpu] jit` fast execution mode. Cranelift cannot be
# compiled FOR wasm32, so browser builds (--no-default-features) leave it off;
# `[cpu] jit` still works there through the crate's interpreted trace loop,
# just without native code generation.
cpu-jit = ["m68k/jit"]
# The headless `copperline-bench` benchmark binary (core-only; also builds
# for wasm32-wasip1). Off by default so native release artifacts are
# unchanged.
bench-bin = []
# The Copperline Control Protocol server (src/control/): a JSON-RPC interface
# over loopback TCP for driving the emulator from scripts and external tools
# (`--control` headless, `--control-gui` windowed). Uses std::net + threads,
# so browser builds (--no-default-features) compile it out.
control = ["dep:serde_json"]
# User-mode NAT backend for emulated NICs (`[a2065] net = "nat"`, src/net/nat/):
# a slirp-style virtual gateway giving the guest outbound IPv4 with no host
# privileges. Uses std::net + threads, so browser builds compile it out.
net-nat = ["dep:smoltcp"]
# Direct attachment of an emulated NIC to a host Ethernet adapter
# (`net = "bridge"`). Linux uses AF_PACKET (with the narrowly privileged
# copperline-net-helper when an unprivileged open is denied), macOS uses the
# system libpcap, and Windows loads an installed Npcap at runtime.
net-bridge = ["dep:pcap", "dep:libloading"]
# The `copperline-ctl` command-line client for the control protocol.
ctl-bin = ["dep:serde_json"]
# Real floppy drives through Rob Smith's FloppyBridge (src/floppybridge/): a
# DrawBridge, Greaseweazle, or Supercard Pro standing in for a disk image on any
# drive. On, build.rs compiles the vendored bridge (vendor/floppybridge) into the
# binary, so nothing has to be installed for a physical drive to work. Off, none
# of it is built -- neither the C++ nor the Rust side -- which is what browser
# builds (--no-default-features) want.
floppybridge = []
[dependencies]
m68k = { version = "0.7.1", features = ["serde"] }
pixels = { version = "0.17", optional = true }
winit = { version = "0.30", optional = true }
anyhow = "1"
log = "0.4"
env_logger = { version = "0.11", optional = true }
serde = { version = "1", features = ["derive", "rc"] }
serde_json = { version = "1", optional = true }
serde-big-array = "0.5"
bincode = "1"
toml = "0.8"
png = "0.17"
flate2 = "1"
cpal = { version = "0.15", optional = true }
# Kept unconditional (not `frontend`-gated) because the Windows MIDI backend
# (src/midi/winmm.rs) also uses it; it is pure Rust and wasm-safe.
ringbuf = "0.4"
hound = "3.5"
rfd = { version = "0.17.2", optional = true }
gilrs = { version = "0.11", optional = true }
# Host clipboard for the debugger console's paste (text only; the default
# image-data feature is left off). wayland-data-control covers Wayland
# hosts; X11 support is built in on Linux.
arboard = { version = "3", default-features = false, features = ["wayland-data-control"], optional = true }
# WASM plugin host for functional Zorro boards (src/wasmboard.rs). Lean feature
# set: the Cranelift JIT + runtime only -- no WASI, component model, GC, threads,
# or wat parsing in the shipped binary (kept deterministic; see the determinism
# Config in wasmboard.rs). Pin the version: save-state replay of a plugin's
# linear-memory snapshot is only guaranteed within one wasmtime build, so
# changing this is a savestate::STATE_VERSION bump, not a routine update.
# Track an LTS line (24.x, 36.x, 48.x, ...): those keep receiving security
# backports, which the line this was previously pinned to (27.x) did not.
wasmtime = { version = "=36.0.12", default-features = false, features = ["cranelift", "runtime"], optional = true }
# Userspace TCP/IP stack for the NAT backend (src/net/nat/): terminates the
# guest's ARP and TCP on the virtual gateway so flows can be spliced onto host
# sockets. Pure Rust, 0BSD, lean feature set: Ethernet + IPv4 + TCP sockets
# only (DHCP/DNS/UDP/ICMP are handled at frame level with the wire parsers).
smoltcp = { version = "0.12", default-features = false, features = [
"alloc",
"medium-ethernet",
"proto-ipv4",
"socket-tcp",
], optional = true }
# Already pulled in transitively; used directly only for localtime_r (local
# time-zone filename stamps) and, on macOS, the pthread QoS class used for the
# optional realtime-priority feature (see src/priority.rs).
libc = "0.2"
zerocopy = { version = "0.8", features = ["derive"] }
# CHD (MAME "Compressed Hunks of Data") CD images (src/cdrom/chd.rs). Pure
# Rust, so it builds for wasm32 browser targets like the rest of the core.
chd = "0.3"
# macOS dock icon: winit's with_window_icon is a no-op on macOS, so the dock
# icon must be set at runtime via NSApplication. These objc2 versions match the
# ones rfd already pulls in, so they add no new crate copies to the build.
[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.6"
objc2-app-kit = { version = "0.3", default-features = false, features = ["NSApplication", "NSImage"] }
objc2-foundation = { version = "0.3", default-features = false, features = ["NSData"] }
pcap = { version = "2.4", optional = true }
[target.'cfg(target_os = "windows")'.dependencies]
# Npcap is deliberately not linked at build time: the bridge backend loads it
# from a trusted system directory only when selected, so NAT-only installs do
# not acquire a runtime DLL dependency.
libloading = { version = "0.8", optional = true }
# Optional realtime-priority feature: cross-platform thread scheduling control.
# Only used off macOS -- the macOS path uses the libc pthread QoS API directly
# (Core Audio already runs the audio callback real-time), so this crate (and
# the windows-sys it pulls in) never enters the macOS build. Excluded on
# wasm32, where there are no host threads to schedule.
[target.'cfg(not(any(target_os = "macos", target_arch = "wasm32")))'.dependencies]
thread-priority = "3.1"
# Browser builds only: std::time::Instant/SystemTime panic on
# wasm32-unknown-unknown; web-time backs them with performance.now()/Date.now().
# See src/timebase.rs -- native targets re-export std::time unchanged.
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
web-time = "1"
[[bin]]
name = "copperline"
path = "src/main.rs"
required-features = ["frontend"]
[[bin]]
name = "copperline-bench"
path = "src/bin/bench.rs"
required-features = ["bench-bin"]
[[bin]]
name = "copperline-ctl"
path = "src/bin/copperline-ctl.rs"
required-features = ["ctl-bin"]
[[bin]]
name = "copperline-net-helper"
path = "src/bin/copperline-net-helper.rs"
required-features = ["net-bridge"]
[dev-dependencies]
# Compile WAT to wasm bytes in the WASM-plugin-host tests, so golden test
# plugins live as readable text in the tests rather than checked-in binaries.
wat = "1"
[lints.clippy]
# Chipset pipeline functions take per-signal argument lists that mirror the
# hardware; bundling them into structs would obscure the data flow.
too_many_arguments = "allow"
# Indexed loops over fixed-size register banks (bitplanes, sprites, audio
# channels) keep the channel number visible and often index several parallel
# arrays; iterator rewrites obscure that.
needless_range_loop = "allow"
[profile.release]
opt-level = 3
# Copperline's hottest paths cross the CPU/bus/chipset/render module
# boundaries. Whole-program optimization is measurably worthwhile here:
# the AROS benchmark is about 10% faster core-only and 7% faster with
# rendering than thin LTO, and the resulting executable is smaller.
lto = "fat"
codegen-units = 1