As I am still a PlatformIO newbie, I finally figured out how to get my same Teensy project to compile on both PC and Mac, but I have to keep editing my PlatformIO.ini file everytime I switch between my PC laptop and Mac laptop on the same project.
Is there a way to simplify this? See the last two lines:
[env:teensy40]
platform = teensy
board = teensy40
framework = arduino
upload_protocol = teensy-gui
lib_deps =
Arduino
https://github.com/pedvide/ADC
build_flags =
-D LAYOUT_US_ENGLISH
-D USB_CUSTOM
;;; Activate a few custom USB descriptor customizations without editing
;;; the original Teensy files, this overrides the system usb_desc.h when
;;; rebuilding the Teensy libraries. Need to "Full Clean" and rebuild.
;;; Include paths. Uncomment the Windows vs PC/Mac version as applicable.
-I src
-include .\\src\\usb_desc.h
; -include ./src/usb_desc.h
The last two lines I keep editing –
Is there a pragma (like an #ifdef WINDOWS versus #ifdef MAC) I can use for platformio.ini files?
I frequently switch between my Mac and PC for my project, since I’m doing a multiplatform project that can connect to a custom accessory I’m building that now has a custom USB VID/PID pair (legitimate) installed into the Teensy. It’s the only file I keep editing every time I switch…
I’d rather not resort to editing the teensy library files, as it’s reloaded automatically (library updates, fresh installs of the environment, etc)
What I’ve tried to do so far:
– Move file to try to remove the path requirement
– To try to standardize UNIX paths (which is a technique I do for other projects other than PlatformIO) – I also tried to use WSL on Windows but PlatformIO doesn’t support it. FWIW, command line via Linux arduino works to build project in WSL. Then manully load firmware via launching the Windows .exe version of teensy-cli from the WSL environment (had to use a bit of creativity due to my custom USB PID/VID).