107 lines
4.1 KiB
Groovy
107 lines
4.1 KiB
Groovy
|
apply plugin: 'com.android.application'
|
||
|
|
||
|
// Add a new entry to local.properties:
|
||
|
// prebuilt_external_libs.dir=/Users/ewing/Source/Blurrr/Release/BlurrrSDKApple/Libraries/SDK/Android/Lua_f32_i32
|
||
|
// This should contain a lua directory with a layout like the old Android NDK "module" system, which contains include/ and libs/<arch>/lib*.so
|
||
|
// This path will be passed to CMake as -DPREBUILT_LIBRARY_PATH because the Android cross-compile chain disables the FIND_ system with CMAKE_PREFIX_PATH and friends.
|
||
|
// This custom flag works in conjunction with our InitialCacheAndroid.cmake file which effectively restores the FIND_ behavior.
|
||
|
Properties local_properties = new Properties()
|
||
|
local_properties.load(project.rootProject.file('local.properties').newDataInputStream())
|
||
|
def prebuilt_library_path = local_properties.getProperty('prebuilt_external_libs.dir')
|
||
|
|
||
|
android {
|
||
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
||
|
|
||
|
defaultConfig {
|
||
|
applicationId "br.pucrio.tecgraf.iuptestapplua"
|
||
|
minSdkVersion rootProject.ext.minSdkVersion
|
||
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||
|
versionCode rootProject.ext.versionCode
|
||
|
versionName rootProject.ext.versionName
|
||
|
|
||
|
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||
|
|
||
|
|
||
|
sourceSets {
|
||
|
main {
|
||
|
// We instruct CMake to copy liblua.so to Android/iuptestapplua/build/jniLibs
|
||
|
jniLibs.srcDirs = ['build/jniLibs']
|
||
|
// Our CMake process will copy asset files from other directories to this temporary/staging directory. (Do not check in files in this directory.)
|
||
|
assets.srcDirs = ['build/tmp/assets']
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
externalNativeBuild {
|
||
|
cmake {
|
||
|
arguments "-DIUP_USE_LUA:BOOL=1",
|
||
|
"-DIUP_ANDROID_BUILD_IUPWEB=1",
|
||
|
"-DIUPLUA_ANDROID_BUILD_TEST_LIBRARY=1",
|
||
|
// "-DPREBUILT_LIBRARY_PATH=/Users/ewing/Source/Blurrr/Release/BlurrrSDKApple/Libraries/SDK/Android/Lua_f32_i32",
|
||
|
"-DPREBUILT_LIBRARY_PATH=" + prebuilt_library_path,
|
||
|
"-C../../CMakeModules/InitialCacheAndroid.cmake"
|
||
|
cFlags ""
|
||
|
cppFlags ""
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ndk {
|
||
|
// Specifies the ABI configurations of your native
|
||
|
// libraries Gradle should build and package with your APK.
|
||
|
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||
|
// abiFilters 'arm64-v8a', 'x86_64'
|
||
|
// abiFilters 'armeabi-v7a', 'x86'
|
||
|
// abiFilters 'armeabi-v7a'
|
||
|
// abiFilters 'x86'
|
||
|
// abiFilters 'arm64-v8a'
|
||
|
abiFilters rootProject.ext.abiFilters
|
||
|
}
|
||
|
}
|
||
|
buildTypes {
|
||
|
release {
|
||
|
minifyEnabled false
|
||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||
|
}
|
||
|
}
|
||
|
externalNativeBuild {
|
||
|
cmake {
|
||
|
path "../../CMakeLists.txt"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
dependencies {
|
||
|
|
||
|
implementation project(':iup')
|
||
|
implementation project(':iupweb')
|
||
|
implementation project(':iuplua')
|
||
|
|
||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||
|
|
||
|
implementation rootProject.ext.appCompat
|
||
|
implementation rootProject.ext.designSupport
|
||
|
// implementation rootProject.ext.constraintSupport
|
||
|
|
||
|
// androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||
|
// exclude group: 'com.android.support', module: 'support-annotations'
|
||
|
// })
|
||
|
// testCompile 'junit:junit:4.12'
|
||
|
}
|
||
|
// needed to find local .aar's
|
||
|
repositories {
|
||
|
flatDir{
|
||
|
dirs 'libs'
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// We are using CMake to specify what files are assets. But Gradle normally runs CMake too late in the entire build process to pick up the assets that CMake copies to the target directory.
|
||
|
// So this will force Android Studio to run CMake earlier in its build process.
|
||
|
project.afterEvaluate {
|
||
|
// Drat: The direct approach doesn't work because only one task variant (Debug or Release) is defined at any time. So the other (e.g. Release) triggers an error of not existing and breaking the build.
|
||
|
// checkDebugManifest.dependsOn externalNativeBuildDebug
|
||
|
// checkReleaseManifest.dependsOn externalNativeBuildRelease
|
||
|
// This findByName with the optional ? seems to work around the problem. try/catch might also work if this is a problem.
|
||
|
tasks.findByName('checkDebugManifest')?.dependsOn tasks.findByName('externalNativeBuildDebug')
|
||
|
tasks.findByName('checkReleaseManifest')?.dependsOn tasks.findByName('externalNativeBuildRelease')
|
||
|
}
|