I need to resize PDF graphics on Android (which in iOS could be done by Core Graphics library easily) and therefore I’ve decided to use MuPDF library.
-
I’ve created a HelloWorld cocs2d-x project
-
I’ve added a very simple MuPDF code into HelloWorldScene.cpp:
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) #include <mupdf/fitz.h> #endif ... #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) fz_context *ctx = fz_new_context(NULL, NULL, FZ_STORE_UNLIMITED); fz_drop_context(ctx); #endif ...
-
I’ve compiled MuPDF library as described in How to build MuPDF for Android and got a shared library “mupdf/platform/android/libs/armeabi-v7a/libmupdf.so”
-
I’ve added the library into Android project as a library module as described in Integration of MuPDF Project as a Library into an Android Studio Project
-
I had issues with compiling of cocos2d-x and MuPDF by calling
cd HelloWorld
cocos compile -p android --android-studio
and therefore I’ve copied MuPDF header files into HelloWorld/cocos2d/external/mupdf
Now I have a linking problem:
cocos compile -p android --android-studio
brings:
jni/../../../Classes/HelloWorldScene.cpp:80: error: undefined reference to 'fz_new_context_imp(fz_alloc_context_s const*, fz_locks_context_s const*, unsigned int, char const*)'
jni/../../../Classes/HelloWorldScene.cpp:81: error: undefined reference to 'fz_drop_context(fz_context_s*)'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi/libcocos2dcpp.so] Error 1
make: Leaving directory `/Users/bsi/Development/HelloWorld/proj.android-studio/app'
Could someone point me to an example how can I add already compiled external C/C++ library into cocos2d-x proj.android-studio, so that it will work if I call cocos compile -p android --android-studio
brings?
I found some “elder references” to LOCAL_SHARED_LIBRARIES and Android.mk but both do not exist in proj.android-studio.
Thanks for your help
siarsky