Conversation
|
Thanks, the change makes sense I think. I'll check locally and do the same for Magnum as well.
It's because -- as far as I know -- one would have to load the shared libraries one by one from the APK virtual filesystem with JNI, which is a lot of extra work as you can't have the app with native-only code anymore. And it doesn't really make sense as you don't gain anything from using them, every app is sandboxed so sharing the libraries for lower memory use isn't possible anyway. A related topic would be dynamic plugins on Android, which I also didn't look into implementing yet because of similar issues, the apps having no actual filesystem they could detect and load the libraries from. |
|
The CMakeLists.txt forces to use My library tree: For your information, I tried to disable I understand the disinterest in shared library. I maintains an app in shared/static mode. But sometimes, I wonder what the benefit about maintaining them both. |
|
I see, okay, so you punched through the problems already :) Yes then having a static library in this setting is not good due to the symbol duplication. It gives so many problems that it's not worth it, and even with In any case -- good to know if(CMAKE_SYSTEM_NAME STREQUAL Android)
set(OFF_EXCEPT_ANDROID ON)
else()
set(OFF_EXCEPT_ANDROID OFF)
endif()
option(CORRADE_BUILD_STATIC "Build static libraries (default are shared)" ${OFF_EXCEPT_ANDROID})should make your use case work, hopefully? It just won't be a well-supported / tested configuration from my side, for now at least.
This is interesting -- can you investigate? What is responsible for adding the dependencies to the Android package? Thanks a lot 🙏 |
So cmake_dependent_option which depend on CORRADE_BUILD_STATIC must be defined after. Revert "CORRADE_BUILD_STATIC is set for Android / shared" This reverts commit aa360f6.
I update my commit. I didn't force option for emscripten because it looks to support dynamic linking. I will now take a look at DebugTool and TestSuite. |
Shared libraries, yes, sorry.
Yes, good idea. It's annoying but possible, so no reason to force it there either.
Thanks! |
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #170 +/- ##
=======================================
Coverage 98.13% 98.13%
=======================================
Files 139 139
Lines 11775 11775
=======================================
Hits 11555 11555
Misses 220 220 ☔ View full report in Codecov by Sentry. |
|
To fix the problem that Android studio / gradle / cmake doesn't embedded It's strange I had to add By the way, to be able to to It's odd because I thought that |
|
I think I know what's the problem with DebugTools and TestSuite. Could you try applying this patch to the diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake
index 3e17e0a68..022602673 100644
--- a/modules/FindMagnum.cmake
+++ b/modules/FindMagnum.cmake
@@ -231,10 +231,20 @@ set(_MAGNUM_CORRADE_DEPENDENCIES )
foreach(_component ${Magnum_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT)
+ set(_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES )
+
# Unrolling the transitive dependencies here so this doesn't need to be
# after resolving inter-component dependencies. Listing also all plugins.
if(_component MATCHES "^(Audio|DebugTools|MeshTools|Primitives|SceneTools|ShaderTools|Text|TextureTools|Trade|.+Importer|.+ImageConverter|.+Font|.+ShaderConverter)$")
- set(_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES PluginManager)
+ list(APPEND _MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES PluginManager)
+ endif()
+ if(_component STREQUAL DebugTools)
+ # DebugTools depends on TestSuite optionally, so if it's not there
+ # assume it wasn't compiled against it.
+ find_package(Corrade QUIET COMPONENTS TestSuite)
+ if(Corrade_TestSuite_FOUND)
+ list(APPEND _MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES TestSuite)
+ endif()
endif()
list(APPEND _MAGNUM_CORRADE_DEPENDENCIES ${_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES})Let me know if that's enough to fix it. Nevertheless, for trimming down the Android package size it's I think better to have TestSuite disabled :)
Exactly 🤔 I suppose you're using NDK's Android toolchain and not the builtin CMake Android support, right? In the latter this worked for me, but maybe it only worked because I supplied this path via |
|
It's a bit better with this patch. If I previously had this problem (
But in your case, it's none of this two cases. |
|
But there is a problem with your patch. You call
|
|
Finally merged this as 45e604a, sorry for the extreme delay. I also managed to figure out and fix the issue with DebugTools and TestSuite:
Though I still recommend building without TestSuite, as it's a functionality you don't need in the context of an Android app. |
|
Thanks for the fix. I no longer need my fork for this project. |
So
cmake_dependent_optionwhich depend onCORRADE_BUILD_STATICmust be defined after.I think there is the same problem for magnum.
BTW I don't understand why you don't want shared build for Android. If user thinks it's too boring to use corrade/magnum with shared library, he may set
BUILD_STATIC=ON.