Browse Source

Add more information about transitive dependency issue in Android CMake.

Miku AuahDark 2 years ago
parent
commit
874a0b12a9
2 changed files with 14 additions and 4 deletions
  1. 5 4
      app/build.gradle
  2. 9 0
      app/src/main/cpp/lua-modules/lua-modules-readme.txt

+ 5 - 4
app/build.gradle

@@ -16,10 +16,11 @@ android {
         externalNativeBuild {
             cmake {
                 arguments "-DANDROID_STL=c++_shared"
-                // For unknown reason, transitive shared library is not taken into account, this
-                // result in liboboe.so and libluajit.so not get included into the final APK. "love"
-                // target depends on LuaJIT, and OpenAL that depends on oboe::oboe. So, add "OpenAL"
-                // and "love" target.
+				// https://issuetracker.google.com/issues/274493986
+                // Transitive shared library that's added through `add_dependencies` is not taken into
+				// account. This result in liboboe.so and libluajit.so not get included into the final
+				// APK. "love" target depends on LuaJIT, and OpenAL that depends on oboe::oboe. So,
+				// add "OpenAL" and "love" target.
                 targets "love_android", "OpenAL", "love"
             }
         }

+ 9 - 0
app/src/main/cpp/lua-modules/lua-modules-readme.txt

@@ -19,3 +19,12 @@ Each folder must contains:
 * If your module interacts with Java-side, a file java.txt must contain where it should look Java source files.
   Example, if you have src/java/your/package/name/MyFile.java, then you need to write "src/java" in java.txt.
   If this file is absent, then your Java-side code will not be compiled along.
+
+Note: There's bug in Android CMake support which prevents inclusion of imported *.so.
+      More information about it here: https://issuetracker.google.com/issues/274493986
+      In short:
+      * If your library is simply an imported target (or prebuilt in ndk-build terms), convert it to standard target.
+        Otherwise the associated *.so won't be bundled into the APK!
+      * If your library depends on imported/prebuilt target, you must add your CMake target to the `app/build.gradle`
+        as part of the targets that need to be compiled. Add your CMake target at
+        `android.defaultConfig.externalNativeBuild.cmake.targets` property.