RadioHead linux

What would be the best way to get RadioHead to compile using platformio on linux? There is a little script include the right headers, but this does not translate well to platformio.

g++ -g -I . -I RHutil -x c++ $INPUT tools/simMain.cpp RHGenericDriver.cpp RHMesh.cpp RHRouter.cpp RHReliableDatagram.cpp RHDatagram.cpp RH_TCP.cpp RH_Serial.cpp RHCRC.cpp RHutil/HardwareSerial.cpp -o $OUTPUT

How about platform = native?

Thanks, that’s where I started with, but there is code specific for arduino and code that is not. He uses a simulator.h and simMain.cpp to simulate arduino functions for Native. But some files are completely incompatible with native, like device driver libraries. It needs some kind of distinction between what files to include for native and for arduino. I ended up just making a version for native containing all the files in the root library folder and removing incompatible libraries and including simulator.h for native files.

You can filter files with Redirecting...

Is that source filter also applied when using it as a library, say I have a .git repo and including it as a lib_dep ? Or only the project platformio.ini? For libraries that’s completely done in library.json?

For a library you can use library.json manifest and srcFilter option.

But!!! In your case is better to use extraScript and configure SRC_FILTER on-the-fly. See extra_script.py in

So, you know which dev/platform is in process via env['PIOPLATFORM'], you can compare it with native and configure env.Replace(SRC_FILTER=[.....])