Android Studio cannot find my header files when they are in a location different to the main source folder of my module. This is noticeable by #include "SDL_config.h" statements being highlighted in red (other #include statements are fine).
I have tried modifying the cppFlags values below but I am starting to doubt that these cppFlags are even being passed to the compiler at all.
Has anyone managed to include files from folders other than their main source folder in this way?
Is there a problem with the way I have specified the cppFlags, or perhaps the moduleName or even sources?
I could go through the SDL2 source and modify all of the #include statements to relative #include paths but I don't really want to modify the SDL2 source. I should simply be able to specify a list of include paths somehow.
apply plugin: 'com.android.model.application'
model {
...
android.ndk {
moduleName = 'main'
//W:\hello-sdl-android\android-project\app\src\main\jni\SDL2\include
cppFlags += "-I${file("src/main/jni/SDL2/include")}".toString()
cppFlags += "-I${file("src/main/jni/SDL2/src")}".toString()
}
android.sources {
main.jni {
source {
srcDirs += ['src/main/jni/src']
srcDirs += ['src/main/jni/SDL2/src']
}
}
}
...
}
UPDATE: Here's more information on my current project layout:
app/src/main/jni app/src/main/jni/src/Main.cpp <- This is compiling app/src/main/jni/SDL2 <- All SDL2 source is under here app/src/main/jni/GLM <- All GLM source is under here
This layout is a direct result of using the example project which I was provided here: https://gitlab.com/scannerdarkly/hello-sdl-android
That project will build using ndk-build from the command line - I wanted to take things a step further by building within Android Studio. My project will attempt to draw a triangle on a GLES2 device.
Here is a link to my current project so far:
http://www.mediafire.com/download/92577p7vf123l72/hello-sdl-android.zip