Is there a way to define C language macro in Android.bp file?

940 Views Asked by At

I want to know if I can define C language macro in Android.bp file ? I am wrapping unit tests of some modules (which are written in C++) into VTS framework. There are certain changes which needs to be protected under macro.

1

There are 1 best solutions below

0
On

You could add a define to the cflags in your Android.bp to be checked in your test code.

cc_binary {
    [...]
    cflags: [ "-DMYUNITTEST" ]
}
#ifndef MYUNITTEST
// not to be used in this unittest.
#endif