gpt4 book ai didi

android-ndk - APP_OPTIM 如何在代码中体现?

转载 作者:行者123 更新时间:2023-12-03 23:23:27 26 4
gpt4 key购买 nike

在 Application.mk 中,您可以设置:

APP_OPTIM := release
APP_OPTIM := debug

如何在 C++ 中测试发布/调试版本?

我假设有定义,所以我试过这个,但只记录“NOT”消息:
#ifdef RELEASE
LOGV("RELEASE");
#else
LOGV("NOT RELEASE");
#endif

#ifdef DEBUG
LOGV("DEBUG");
#else
LOGV("NOT DEBUG");
#endif

最佳答案

android-ndk-r8b/build/core/add-application.mk我们读:

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

因此,要回答您的问题:在 NDK r8b(今天的最新版本)中,您可以查看
#ifdef NDEBUG
// this is "release"
#else
// this is "debug"
#endif

但是您可以通过您的 Android.mk 添加任何其他编译标志。或 Application.mk如果需要,取决于 $(APP_OPTIM)。

关于android-ndk - APP_OPTIM 如何在代码中体现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13099931/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com