openal-1.13 静态编译(mingw32)

Posted 1CM

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openal-1.13 静态编译(mingw32)相关的知识,希望对你有一定的参考价值。

1.CMakeLists.txt           SET(LIBTYPE SHARED) 改成 SET(LIBTYPE STATIC)
2.include/al/al.h          删除 dllexport 
3.include/al/alc.h         删除 dllexport 
4.alc/bs2b.c               bs2b_set_level 改成 bs2b_set_level2 ...
5.OpenAL32/Include/bs2b.h  bs2b_set_level 改成 bs2b_set_level2 ...

修改 openal/bs2b 是为了避免静态编译时与原来的 bs2b 发生冲突

--- CMakeLists.txt.orig	2011-02-16 04:05:40 +0800
+++ CMakeLists.txt	2016-03-23 08:23:05 +0800
@@ -51,7 +51,7 @@
 ENDIF()
 
 IF(NOT LIBTYPE)
-    SET(LIBTYPE SHARED)
+    SET(LIBTYPE STATIC)
 ENDIF()
 
 SET(LIB_MAJOR_VERSION "1")
 
--- include/al/al.h.orig	2010-11-29 07:09:04 +0800
+++ include/al/al.h	2016-03-23 10:09:22 +0800
@@ -5,20 +5,12 @@
 extern "C" {
 #endif
 
-#if defined(AL_LIBTYPE_STATIC)
- #define AL_API
-#elif defined(_WIN32) && !defined(_XBOX)
- #if defined(AL_BUILD_LIBRARY)
-  #define AL_API __declspec(dllexport)
- #else
-  #define AL_API __declspec(dllimport)
- #endif
-#else
- #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
-  #define AL_API __attribute__((visibility("protected")))
- #else
-  #define AL_API extern
- #endif
+#ifndef AL_API
+    #if defined (AL_BUILD_LIBRARY)
+        #define AL_API __attribute__((visibility ("default")))
+    #else
+        #define AL_API
+    #endif
 #endif
 
 #if defined(_WIN32)

--- include/al/alc.h.orig	2010-11-29 06:51:15 +0800
+++ include/al/alc.h	2016-03-23 10:09:51 +0800
@@ -5,20 +5,12 @@
 extern "C" {
 #endif
 
-#if defined(AL_LIBTYPE_STATIC)
- #define ALC_API
-#elif defined(_WIN32) && !defined(_XBOX)
- #if defined(AL_BUILD_LIBRARY)
-  #define ALC_API __declspec(dllexport)
- #else
-  #define ALC_API __declspec(dllimport)
- #endif
-#else
- #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
-  #define ALC_API __attribute__((visibility("protected")))
- #else
-  #define ALC_API extern
- #endif
+#ifndef ALC_API
+    #if defined (AL_BUILD_LIBRARY)
+        #define ALC_API __attribute__((visibility ("default")))
+    #else
+        #define ALC_API
+    #endif
 #endif
 
 #if defined(_WIN32)

 
--- alc/bs2b.c.orig	2010-03-19 05:22:27 +0800
+++ alc/bs2b.c	2016-03-23 10:04:14 +0800
@@ -122 +122 @@
-void bs2b_set_level(struct bs2b *bs2b, int level)
+void bs2b_set_level2(struct bs2b *bs2b, int level)
@@ -130 +130 @@
-int bs2b_get_level(struct bs2b *bs2b)
+int bs2b_get_level2(struct bs2b *bs2b)
@@ -135 +135 @@
-void bs2b_set_srate(struct bs2b *bs2b, int srate)
+void bs2b_set_srate2(struct bs2b *bs2b, int srate)
@@ -143 +143 @@
-int bs2b_get_srate(struct bs2b *bs2b)
+int bs2b_get_srate2(struct bs2b *bs2b)
@@ -148 +148 @@
-void bs2b_clear(struct bs2b *bs2b)
+void bs2b_clear2(struct bs2b *bs2b)
@@ -158 +158 @@
-int bs2b_is_clear(struct bs2b *bs2b)
+int bs2b_is_clear2(struct bs2b *bs2b)
@@ -170 +170 @@
-void bs2b_cross_feed(struct bs2b *bs2b, float *sample)
+void bs2b_cross_feed2(struct bs2b *bs2b, float *sample)

--- OpenAL32/Include/bs2b.h.orig	2010-03-19 05:22:40 +0800
+++ OpenAL32/Include/bs2b.h	2016-03-23 07:21:38 +0800
@@ -78 +78 @@
-void bs2b_set_level(struct bs2b *bs2b, int level);
+void bs2b_set_level2(struct bs2b *bs2b, int level);
@@ -81 +81 @@
-int bs2b_get_level(struct bs2b *bs2b);
+int bs2b_get_level2(struct bs2b *bs2b);
@@ -86 +86 @@
-void bs2b_set_srate(struct bs2b *bs2b, int srate);
+void bs2b_set_srate2(struct bs2b *bs2b, int srate);
@@ -89 +89 @@
-int bs2b_get_srate(struct bs2b *bs2b);
+int bs2b_get_srate2(struct bs2b *bs2b);
@@ -92 +92 @@
-void bs2b_clear(struct bs2b *bs2b);
+void bs2b_clear2(struct bs2b *bs2b);
@@ -95 +95 @@
-int bs2b_is_clear(struct bs2b *bs2b);
+int bs2b_is_clear2(struct bs2b *bs2b);
@@ -103 +103 @@
-void bs2b_cross_feed(struct bs2b *bs2b, float *sample);
+void bs2b_cross_feed2(struct bs2b *bs2b, float *sample);

以上是关于openal-1.13 静态编译(mingw32)的主要内容,如果未能解决你的问题,请参考以下文章

在Linux下使用MinGW静态交叉编译带有zlib的libcurl(包括交叉编译openssl,即--cross-compile-prefix=i686-w64-mingw32- mingw)(代码

使用 MinGW C++ 编译 64 位静态库以在 Java (JNI) 中使用

qt5.6.3静态编译运用程序

minGW package备注介绍

Msys2+mingw-w64 编译VS2013使用的ffmpeg静态库注意事项

Mingw+MSYS 中的 libevent 静态编译错误