How can I manually add a directory to a compile command, like -I in g++

Hi, I am building a cross platform project, Arduino isn't the final target but I want to test out a lightweight graphics library on it as I am not yet ready to implement a custom Display Driver on the final target (that should almost work) without having to develop it as an Arduino library. I am currently building the C++ code with a command in the likes of g++ .cpp LibraryA/.cpp -I LibraryA .... I would like to be able to compile a file, say arduinoInterface.ino or arduinoInterface.cpp to include and compile these libraries in their current folders.

I have used the Teensy before and I know I can do this with avr-gcc and then use the Teensy loader to upload the hex file, but I have had no luck with the Arduino so far. I am using the Arduino DUE.

So far I have attempted to use arm-none-eabi-g++ and I can build the project with no Arduino libraries (which I do need access to for the test, I am using a TFT), or with viewing the output of the Arduino IDE am able to generate an elf file, but it relied on having built something in the IDE first, referring back to /var/folders/ ... for what I presume are the additional libraries I had imported (Adafruit_gfx ect.)

I am then after a command (or easy tool) to load the o/hex/elf/whatever is generated for me to the Arduino. I got as far as running a bossac command (copied from the Arduino IDE output) but I got error messages saying the device was not found, although It should have been.

The reason I want to do it like this is to avoid having to import my code as Arduino libraries every time I make changes (I have quite a few folders acting as libraries). The closest I have really gotten is using Visual Studio Code Arduino plugin, but I cannot figure out a way to include files in directories, only the root directory (folders are important as I would be including different folders depending on the end target).

I know this probably isn't the best or recommended approach, but the end target isn't Arduino, I just want to test my code on an embedded system. Any guidance here is appreciated.

jaydz49:
The reason I want to do it like this is to avoid having to import my code as Arduino libraries every time I make changes

Use symlinks.

jaydz49:
I got error messages saying the device was not found, although It should have been.

You must open and close a 1200 baud connection to the board's serial port before running the bossac command. There are some examples of how to do that here:

You can also use the --libraries option of arduino-cli compile to define additional libraries paths:
https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_compile/
Note that the path is to the folder that contains libraries, not to the library folder itself.