[Android] Enable the usage of debug version of SFML libraries (#643)
This commit is contained in:
parent
214c9b0662
commit
a4846db016
@ -55,4 +55,60 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := sfml-system-d
|
||||
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libsfml-system-d.so
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := sfml-window-d
|
||||
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libsfml-window-d.so
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_EXPORT_LDLIBS := -lEGL -llog -landroid
|
||||
LOCAL_SHARED_LIBRARIES := sfml-system-d
|
||||
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := sfml-graphics-d
|
||||
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libsfml-graphics-d.so
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_SHARED_LIBRARIES += sfml-system-d sfml-window-d
|
||||
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := sfml-audio-d
|
||||
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libsfml-audio-d.so
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_SHARED_LIBRARIES := sfml-window-d sfml-system-d openal sndfile
|
||||
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := sfml-network-d
|
||||
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libsfml-network-d.so
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_SHARED_LIBRARIES := sfml-system-d
|
||||
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := sfml-main-d
|
||||
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libsfml-main-d.a
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_SHARED_LIBRARIES := sfml-window-d sfml-system-d
|
||||
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := sfml-activity-d
|
||||
LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/libsfml-activity-d.so
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,sfml/extlibs)
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/Config.hpp>
|
||||
#include <string>
|
||||
#include <android/native_activity.h>
|
||||
#include <android/log.h>
|
||||
@ -38,12 +39,12 @@ namespace {
|
||||
|
||||
std::string getLibraryName(JNIEnv* lJNIEnv, jobject& objectActivityInfo)
|
||||
{
|
||||
// This function reads the value of meta-data "sfml.app.lib_name"
|
||||
// found in the Android Manifest file and returns it. It performs the
|
||||
// This function reads the value of meta-data "sfml.app.lib_name"
|
||||
// found in the Android Manifest file and returns it. It performs the
|
||||
// following java code using the JNI interface:
|
||||
//
|
||||
// ai.metaData.getString("sfml.app.lib_name");
|
||||
|
||||
|
||||
// Get metaData instance from the ActivityInfo object
|
||||
jclass classActivityInfo = lJNIEnv->FindClass("android/content/pm/ActivityInfo");
|
||||
jfieldID fieldMetaData = lJNIEnv->GetFieldID(classActivityInfo, "metaData", "Landroid/os/Bundle;");
|
||||
@ -51,25 +52,25 @@ std::string getLibraryName(JNIEnv* lJNIEnv, jobject& objectActivityInfo)
|
||||
|
||||
// Create a java string object containing "sfml.app.lib_name"
|
||||
jobject objectName = lJNIEnv->NewStringUTF("sfml.app.lib_name");
|
||||
|
||||
|
||||
// Get the value of meta-data named "sfml.app.lib_name"
|
||||
jclass classBundle = lJNIEnv->FindClass("android/os/Bundle");
|
||||
jmethodID methodGetString = lJNIEnv->GetMethodID(classBundle, "getString", "(Ljava/lang/String;)Ljava/lang/String;");
|
||||
jstring valueString = (jstring)lJNIEnv->CallObjectMethod(objectMetaData, methodGetString, objectName);
|
||||
|
||||
|
||||
// No meta-data "sfml.app.lib_name" was found so we abord and inform the user
|
||||
if (valueString == NULL)
|
||||
{
|
||||
LOGE("No meta-data 'sfml.app.lib_name' found in AndroidManifest.xml file");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
// Convert the application name to a C++ string and return it
|
||||
const jsize applicationNameLength = lJNIEnv->GetStringUTFLength(valueString);
|
||||
const char* applicationName = lJNIEnv->GetStringUTFChars(valueString, NULL);
|
||||
std::string ret(applicationName, applicationNameLength);
|
||||
lJNIEnv->ReleaseStringUTFChars(valueString, applicationName);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -161,14 +162,23 @@ void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_
|
||||
|
||||
// Load our libraries in reverse order
|
||||
loadLibrary("c++_shared", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sndfile", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("openal", lJNIEnv, ObjectActivityInfo);
|
||||
|
||||
#if !defined(SFML_DEBUG)
|
||||
loadLibrary("sfml-system", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sfml-window", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sfml-graphics", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sndfile", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("openal", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sfml-audio", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sfml-network", lJNIEnv, ObjectActivityInfo);
|
||||
|
||||
#else
|
||||
loadLibrary("sfml-system-d", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sfml-window-d", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sfml-graphics-d", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sfml-audio-d", lJNIEnv, ObjectActivityInfo);
|
||||
loadLibrary("sfml-network-d", lJNIEnv, ObjectActivityInfo);
|
||||
#endif
|
||||
|
||||
std::string libName = getLibraryName(lJNIEnv, ObjectActivityInfo);
|
||||
void* handle = loadLibrary(libName.c_str(), lJNIEnv, ObjectActivityInfo);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user