2012-10-27 8 views
10

In Application.mk è possibile impostare:In che modo APP_OPTIM si manifesta nel codice?

APP_OPTIM := release 
APP_OPTIM := debug 

Come posso provare per il rilascio/debug in C++?

Sto presupponendo che ci sono definisce così che ho provato questo, ma solo "NOT" I messaggi sono registrati:

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

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

risposta

20

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

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

Quindi, per rispondere la tua domanda: in NDK r8b (l'ultima per oggi) è possibile controllare

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

Ma è possibile aggiungere qualsiasi altra Compilatio n flag attraverso il tuo Android.mk o Application.mk secondo $ (APP_OPTIM), se vuoi.

+0

Quindi si ottiene sempre il flag '-g', anche per una build di rilascio? E mi chiedevo perché i breakpoint funzionassero anche per 'APP_OPTIM: = release'. – sashoalm

+1

@sashoalm: puoi cambiarlo, se lo desideri, se imposti 'APP_CFLAGS: = -g0' in ** Application.mk ** –

Problemi correlati