I am working on something were during dev I can use an emulator for development. My plan/idea is two have two platforms with the same api, one that uses the emulator and the other that actually targets the device. is it possible to do something like that without having to change the source code, just by saying roc build vs roc run?
Ive been doing basically that for wasm type platforms. Ill build the native host as a test runner with all kinds of telemetry and defensive checks etc, and then the wasm target uses a host intended for deployment. So all the .roc files are identical but the host is swapped out just by using a different --target=...
You could definitely do the same with multiple targets, just duplicate your platform main.roc and point to a different prebuilt host.
interesting, are the targets arbitrary or architecture tuples?
See https://github.com/lukewilliamboswell/roc-platform-template-zig/blob/main/platform/main.roc
There is a targets: section in the header
does the names on the header (x64musl, etc) map to folders in the input_dir?
We want to have a way to program the Software You Can Love Badge with Roc, we have an emulator for it, but also need to target the actual badge
it will be very fun
Last updated: Jul 23 2026 at 13:15 UTC