|
1 | 1 | apply plugin: 'com.android.application' |
2 | 2 |
|
3 | | -project.ext.ASSET_DIR = projectDir.toString() + '/assets' |
4 | | -def bazelLocation = '/usr/local/bin/bazel' |
5 | | -def tensorflow_root = '/home/irina/tensorflow' |
6 | 3 | def cpuType = 'arm64-v8a' |
7 | 4 |
|
8 | 5 | // Output directory in the local directory for packaging into the APK. |
9 | | -def nativeOutDir = 'libs/' + cpuType |
10 | 6 |
|
11 | | -// Default to building with Bazel and override with make if requested. |
12 | | -def nativeBuildRule = 'buildNativeBazel' |
13 | | -def inferenceLibPath = tensorflow_root + '/bazel-bin/tensorflow/contrib/android/libtensorflow_inference.so' |
14 | 7 | android { |
15 | 8 | signingConfigs { |
16 | 9 | config { |
@@ -82,38 +75,6 @@ android { |
82 | 75 | } |
83 | 76 | } |
84 | 77 |
|
85 | | -task buildNativeBazel(type: Exec) { |
86 | | - workingDir tensorflow_root |
87 | | - commandLine bazelLocation, 'build', '-c', 'opt', \ |
88 | | - 'tensorflow/examples/android:tensorflow_native_libs', \ |
89 | | - '--crosstool_top=//external:android/crosstool', \ |
90 | | - '--cpu=' + cpuType, \ |
91 | | - '--host_crosstool_top=@bazel_tools//tools/cpp:toolchain' |
92 | | -} |
93 | | - |
94 | | -task buildNativeMake(type: Exec) { |
95 | | - environment "NDK_ROOT", android.ndkDirectory |
96 | | - // Tip: install ccache and uncomment the following to speed up |
97 | | - // builds significantly. |
98 | | - // environment "CC_PREFIX", 'ccache' |
99 | | - workingDir tensorflow_root |
100 | | - commandLine 'tensorflow/contrib/makefile/build_all_android.sh', \ |
101 | | - '-s', \ |
102 | | - 'tensorflow/contrib/makefile/sub_makefiles/android/Makefile.in', \ |
103 | | - '-t', \ |
104 | | - 'libtensorflow_inference.so libtensorflow_demo.so' \ |
105 | | - //, '-T' // Uncomment to skip protobuf and speed up subsequent builds. |
106 | | -} |
107 | | - |
108 | | -task copyNativeLibs(type: Copy) { |
109 | | - from inferenceLibPath |
110 | | - into nativeOutDir |
111 | | - duplicatesStrategy = 'include' |
112 | | - dependsOn nativeBuildRule |
113 | | - fileMode 0644 |
114 | | -} |
115 | | - |
116 | | - |
117 | 78 | dependencies { |
118 | 79 | implementation fileTree(include: ['*.jar'], dir: 'libs') |
119 | 80 | androidTestImplementation 'junit:junit:4.12' |
|
0 commit comments