[SOLVED] How to detect code being compiled for esp32
Posted: Tue May 17, 2022 10:16 am
Hi. I have a shared code between the esp32 and the host system. I was seeking a way of knowing when a code is being compiled for esp32, I know I could do somethine like
but as this code may be compiled also for windows and maybe BSD I would prefer to have something like "#if defined(__esp32__)" but I didn't found any documentation regarding this. Someone has done something similar or knows if esp-idf defines something like that?
Thank you very much
Code: Select all
#if defined(__linux__) || defined(__APPLE__)
#else
#endif
Thank you very much