Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preprocessor macro in Android.mk is ignored, but works in Application.mk

I created an Android project using jni. Now I want to use preprocessor macros to distinguish between the lite and the full version. It should look like this:

#ifdef LITE
    auto label = LabelTTF::create("Hello Cocos2dx Lite", "Arial", 24);
#else
    auto label = LabelTTF::create("Hello Cocos2dx Full", "Arial", 24);
#endif

For this I defined a variable in APP_CPPFLAGS within Android.mk like this:

APP_CPPFLAGS += -DLITE

Unfortunately the app completely ignores it and I still see the label "Hello Cocos2dx Full". However the same line works when I put it in the Application.mk.

  • Why is that?
  • How can I define the variable, so that I can have two different makefiles for the full and lite version?
like image 294
gebirgsbärbel Avatar asked Dec 25 '22 16:12

gebirgsbärbel


1 Answers

APP_CPPFLAGS and all other APP_ make variables should be set in Application.mk. For changes per module, use LOCAL_CPPFLAGS or LOCAL_CFLAGS

like image 120
Alex Cohn Avatar answered Jan 14 '23 00:01

Alex Cohn