Pass cppFlag values to the C++ code using Android Studio and Experimental Gradle Plugin

182 Views Asked by At
void DoSomething()
{   ...     
    m_a = new SomeContext<SOMETHING>(m_data);   
    ... 
}

Using Android Studio's Experimental Gradle Plugin, how do I pass the value of SOMETHING as "somevalue"? I think I should be using cppFlags.add('-DSOMETHING=somevalue') but this is not working.

1

There are 1 best solutions below

0
micha On

Inside your model, android, ndk block, you can add

#set cppFlag
cppFlags.add("-DSOMETHING=awesome".toString())

And it will be used during compilation.