Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few changes to build as dynamic lib and support 64bit better #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
/lib
/obj
33 changes: 16 additions & 17 deletions Alc/alcandroid.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ JavaVM *alcGetJavaVM(void) {
return javaVM;
}

void alcandroid_OnLoad( JavaVM *vm ) {
BackendFuncs func_list;
if (apportableOpenALFuncs.alc_android_set_java_vm) {
apportableOpenALFuncs.alc_android_set_java_vm(vm);
}
javaVM = vm;
}

void alcandroid_OnUnload( JavaVM *vm ) {
if (apportableOpenALFuncs.alc_android_set_java_vm) {
apportableOpenALFuncs.alc_android_set_java_vm(NULL);
}
}

//when called as a shared lib, this is automatic
//but when embedding it that will be an error
#ifdef NATIVE_TOOLKIT_OPENAL_ANDROID_SHARED
Expand All @@ -27,29 +41,14 @@ JavaVM *alcGetJavaVM(void) {

#endif //NATIVE_TOOLKIT_OPENAL_ANDROID_SHARED


void alcandroid_OnLoad( JavaVM *vm ) {
BackendFuncs func_list;
if (apportableOpenALFuncs.alc_android_set_java_vm) {
apportableOpenALFuncs.alc_android_set_java_vm(vm);
}
javaVM = vm;
}

void alcandroid_OnUnload( JavaVM *vm ) {
if (apportableOpenALFuncs.alc_android_set_java_vm) {
apportableOpenALFuncs.alc_android_set_java_vm(NULL);
}
}

void alcandroid_Suspend() {
__attribute__((visibility("protected"))) void alcandroid_Suspend() {
LOGV("openal suspend");
if (apportableOpenALFuncs.alc_android_suspend) {
apportableOpenALFuncs.alc_android_suspend();
}
}

void alcandroid_Resume() {
__attribute__((visibility("protected"))) void alcandroid_Resume() {
LOGV("openal resume");
if (apportableOpenALFuncs.alc_android_resume) {
apportableOpenALFuncs.alc_android_resume();
Expand Down
5 changes: 5 additions & 0 deletions build-shared.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rm -rf obj
haxelib run hxcpp library.xml -Dandroid
haxelib run hxcpp library.xml -Dandroid -DHXCPP_ARMV7
haxelib run hxcpp library.xml -Dandroid -DHXCPP_ARM64
haxelib run hxcpp library.xml -Dandroid -DHXCPP_X86
1 change: 1 addition & 0 deletions files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/openal-android/OpenAL32/include/"/>
<compilerflag value="-DAL_LIBTYPE_STATIC" if="native_toolkit_openal_static" />
<compilerflag value="-DAL_ALEXT_PROTOTYPES" />
<compilerflag value="-DNATIVE_TOOLKIT_OPENAL_ANDROID_SHARED" unless="native_toolkit_openal_static"/>

<file name="${NATIVE_TOOLKIT_PATH}/openal-android/Alc/ALc.c"/>
<file name="${NATIVE_TOOLKIT_PATH}/openal-android/Alc/ALu.c"/>
Expand Down
25 changes: 22 additions & 3 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define ALSOFT_VERSION "1.12.854"

#define AL_BUILD_LIBRARY
#define HAVE_GCC_VISIBILITY

/* Define if we have the Android backend */
#if defined(ANDROID)
Expand Down Expand Up @@ -89,6 +90,27 @@
/* Define if we have the __int64 type */
/* #cmakedefine HAVE___INT64 */

#ifdef HXCPP_ARM64

/* Define to the size of a void pointer type */
#define SIZEOF_VOIDP 8

#else

#ifdef HXCPP_X86_64

/* Define to the size of a void pointer type */
#define SIZEOF_VOIDP 8

#else

/* Define to the size of a void pointer type */
#define SIZEOF_VOIDP 4

#endif

#endif

/* Define to the size of a long int type */
#define SIZEOF_LONG 4

Expand All @@ -98,9 +120,6 @@
/* Define to the size of an unsigned int type */
#define SIZEOF_UINT 4

/* Define to the size of a void pointer type */
#define SIZEOF_VOIDP 4

/* Define if we have GCC's destructor attribute */
#define HAVE_GCC_DESTRUCTOR 1

Expand Down
1 change: 1 addition & 0 deletions library.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

<!-- linker flags -->
<lib name="-lOpenSLES" unless="native_toolkit_openal_static"/>
<flag value="-Wl,-soname,libopenal.so" />

</target>

Expand Down