I am coding some C app on my Linux laptop, but at office, will occasionally port it to an android platform using ndk-build. Every time I switch platforms, I need to change a bunch of paths specific to either my laptop or the android platform. So I currently set it up something like:
#define ANDROID 1
#ifdef ANDROID
#define ....
#define ... bunch of stuff specific to android
#else
#define ... bunch of stuff specific to my laptop.
#endif
Each time I have to remember to comment/uncomment out the #define ANDROID line. It’s getting to be irritating. Is there any way to directly detect if I am running in an android environment or a regular linux environment and then setup my paths accordingly ? Thanks.
Put something like this in your Android.mk
Where -D is a flag to pre-define a symbol and ANDROID is the symbol to define
Then your #ifdef ANDROID blocks in code will work.