diff --git a/SPD-classes/build.gradle b/SPD-classes/build.gradle index 08c97f396..71d490021 100644 --- a/SPD-classes/build.gradle +++ b/SPD-classes/build.gradle @@ -3,4 +3,25 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 buildToolsVersion "24.0.2" + + task ndkBuild(type: Exec){ + description "builds JNI libs from source. " + + "This requires the Android NDK and is optional as precompiled libs are provided." + + workingDir = "./src/main" + def ndkDir = android.ndkDirectory + + //Need to start cmd first on windows systems, otherwise these are the same + if (System.properties["os.name"].toLowerCase().contains("windows")){ + commandLine "cmd", "/c" , "$ndkDir${File.separator}ndk-build " + + "NDK_APPLICATION_MK=./jniSources/Application.mk " + + "NDK_LIBS_OUT=./jniLibs" + } else { + commandLine "$ndkDir${File.separator}ndk-build " + + "NDK_APPLICATION_MK=./jniSources/Application.mk " + + "NDK_LIBS_OUT=./jniLibs" + } + + } + } \ No newline at end of file diff --git a/SPD-classes/src/main/jniSources/Application.mk b/SPD-classes/src/main/jniSources/Application.mk new file mode 100644 index 000000000..e2b8a6ef6 --- /dev/null +++ b/SPD-classes/src/main/jniSources/Application.mk @@ -0,0 +1,3 @@ +APP_ABI := armeabi x86 +APP_BUILD_SCRIPT := ./jniSources/Android.mk +APP_OPTIM := release \ No newline at end of file diff --git a/SPD-classes/src/main/jniSources/README.txt b/SPD-classes/src/main/jniSources/README.txt index d3bc9d782..4f94706b0 100644 --- a/SPD-classes/src/main/jniSources/README.txt +++ b/SPD-classes/src/main/jniSources/README.txt @@ -7,6 +7,5 @@ building from source can still do so. There is no functional difference between using the provided .so files, and compiling your own. -In order to compile these files you will need the Android NDK. - -TODO: provide build instructions, or a build script, or make a gradle task. \ No newline at end of file +These sources can be compiled through the gradle task SPD-classes:ndkBuild on a system with the +Android NDK installed and configured. \ No newline at end of file