Define set by ProcessFlags (-D) is not seen by Arduino library on ESP32

Hello,

I’m using extra python script (a part of my library), that is called when a project with my library is compiled. This library uses WiFiManager internally and I want to define WM_NODEBUG to skip including debug logs.

	Import("projenv", "env")
	for e in (env, DefaultEnvironment(), projenv):
		e.ProcessFlags("-std=gnu++17")
		e.ProcessFlags("-DWM_NODEBUG")
		e.ProcessFlags("-DCORE_DEBUG_LEVEL=0")

It looks like this is not working properly (WiFiManager debug strings still present in binary file). How to get define propagated into another library? Using platformio.ini build_flags do the job, but I want to handle it at the library level.

Is there any way to mimic behaviour of build_flags in platformio.ini file?

	environments = [env, DefaultEnvironment(), projenv]
	for lb in env.GetLibBuilders():
		environments.append(lb.env)

Fixed by adding envs from GetLibBuilders

1 Like