How does APP_OPTIM manifest in code?

前端 未结 1 1480
误落风尘
误落风尘 2021-02-13 10:38

In Application.mk you can set:

APP_OPTIM := release
APP_OPTIM := debug

How can I test for release/debug build in C++?

I\'m assuming the

1条回答
  •  情书的邮戳
    2021-02-13 11:18

    In android-ndk-r8b/build/core/add-application.mk we read:

    ifeq ($(APP_OPTIM),debug)
      APP_CFLAGS := -O0 -g $(APP_CFLAGS)
    else
      APP_CFLAGS := -O2 -DNDEBUG -g $(APP_CFLAGS)
    endif
    

    So, to answer your question: in NDK r8b (the latest for today) you can check

    #ifdef NDEBUG
    // this is "release"
    #else
    // this is "debug"
    #endif
    

    But you can add any other compilation flags through your Android.mk or Application.mk depending on $(APP_OPTIM), if you want.

    0 讨论(0)
提交回复
热议问题