04-16-2015, 10:06 AM
I've a question about Android builds.
As you can see from the android branch, there's been an attempt to set up non-interactive builds with CMake to integrate nicely with the rest of the project. However, I'm encountering difficulty linking an Android library (Java <-> C++ interface code) with the other libraries (OSSupport, Blocks, etc.) into a single shared library containing all symbols.
I have a CMakeLists.txt in the Android folder, doing
where the jni folder contains the interface code and 'log dl' are some additional dependencies (android logging framework and such).
I also have changed, in the src folder, the CMakeList to do
where AndroidNative was the previous created library and 'atomic' is a dependency.
However, it doesn't work. Examination of the final .so file using Cygwin and the Linux nm program tells me none of the definitions in the jni folder got through, and consequently the Java VM crashes since it can't find them. Yet, if I add the cpp files directly to, say, the SRCS and HDRS variable in an already existing library, say, Main (for the root src folder), it works, and all the symbols are added (verified by nm and successful APK execution).
Please see the android branch if I am being unclear. I also attach some positive news, built with commandline only.
Question: I suppose I am trying to link the AndroidNative library wrongly, or am missing a step. Halp pl0x?
As you can see from the android branch, there's been an attempt to set up non-interactive builds with CMake to integrate nicely with the rest of the project. However, I'm encountering difficulty linking an Android library (Java <-> C++ interface code) with the other libraries (OSSupport, Blocks, etc.) into a single shared library containing all symbols.
I have a CMakeLists.txt in the Android folder, doing
Code:
add_library(AndroidNative jni/app-android.cpp jni/ToJava.cpp jni/ToJava.h)
target_link_libraries(AndroidNative log dl)
I also have changed, in the src folder, the CMakeList to do
Code:
add_library(MCServer SHARED ${src cpp files variable})
...
target_link_libraries(OSSupport Blocks BlockEntities ...etc...)
if (ANDROID)
target_link_libraries(AndroidNative atomic)
endif()
However, it doesn't work. Examination of the final .so file using Cygwin and the Linux nm program tells me none of the definitions in the jni folder got through, and consequently the Java VM crashes since it can't find them. Yet, if I add the cpp files directly to, say, the SRCS and HDRS variable in an already existing library, say, Main (for the root src folder), it works, and all the symbols are added (verified by nm and successful APK execution).
Please see the android branch if I am being unclear. I also attach some positive news, built with commandline only.
Question: I suppose I am trying to link the AndroidNative library wrongly, or am missing a step. Halp pl0x?