| repositories { | |
| google() | |
| jcenter() | |
| } | |
| buildscript { | |
| repositories { | |
| google() | |
| jcenter() | |
| } | |
| dependencies { | |
| classpath 'com.android.tools.build:gradle:4.0.0' | |
| } | |
| } | |
| apply plugin: 'com.android.library' | |
| def cmakeListDir = "${rootDir}/../../../" | |
| def hostBuildDir = "${cmakeListDir}/../iree-build-host" | |
| def hostInstallDir = "${hostBuildDir}/install" | |
| android { | |
| compileSdkVersion 29 | |
| defaultConfig { | |
| minSdkVersion 28 | |
| targetSdkVersion 29 | |
| externalNativeBuild { | |
| cmake { | |
| arguments "-DIREE_BUILD_EXPERIMENTAL_JAVA_BINDINGS=ON", | |
| "-DIREE_HAL_DRIVERS_TO_BUILD=VMLA", | |
| // Disable all but the runtime components needed for the | |
| // java bindings. | |
| "-DIREE_BUILD_COMPILER=OFF", | |
| "-DIREE_ENABLE_MLIR=OFF", | |
| "-DIREE_BUILD_TESTS=OFF", | |
| "-DIREE_BUILD_SAMPLES=OFF", | |
| "-DIREE_BUILD_PYTHON_BINDINGS=OFF", | |
| "-DIREE_HOST_BINARY_ROOT=${hostInstallDir}" | |
| } | |
| } | |
| } | |
| sourceSets { | |
| main { | |
| java.srcDirs = ['java/com/google/iree'] | |
| jni.srcDirs = ['java/com/google/iree/native'] | |
| manifest.srcFile 'com/google/iree/tests/TestManifest.xml' | |
| } | |
| } | |
| externalNativeBuild { | |
| cmake { | |
| version "3.13.4.0+" | |
| path "../../../CMakeLists.txt" | |
| } | |
| } | |
| } | |
| // Task to cmake configure the host | |
| task cmakeConfigureHost(type: Exec) { | |
| doFirst { | |
| println "Configuring host tools with cmake..." | |
| } | |
| workingDir cmakeListDir | |
| commandLine "cmake", | |
| "-G" , "Ninja", | |
| "-B", hostBuildDir , | |
| "-DIREE_TARGET_BACKENDS_TO_BUILD=vmla", | |
| "-DIREE_HAL_DRIVERS_TO_BUILD=vmla", | |
| "-DIREE_BUILD_COMPILER=ON", | |
| "-DIREE_BUILD_TESTS=OFF ", | |
| "-DIREE_BUILD_SAMPLES=OFF", | |
| "-DCMAKE_INSTALL_PREFIX=${hostInstallDir}", | |
| "." | |
| } | |
| // Task to cmake build the host | |
| task cmakeBuildHost(type: Exec) { | |
| doFirst { | |
| println "Building host tools with cmake..." | |
| } | |
| workingDir cmakeListDir | |
| commandLine "cmake", "--build", hostBuildDir, "--target", "install" | |
| } | |
| // Build host tools before building the app | |
| preBuild.dependsOn cmakeBuildHost | |
| cmakeBuildHost.dependsOn cmakeConfigureHost |