diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2024-02-08 11:29:29 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2024-02-09 21:01:26 +0530 |
commit | 95a691824daa57260f43f9db1fee41cd00a6fd00 (patch) | |
tree | 0a737ee1101446cc58f2d2566f803efa44e35fb6 | |
parent | 9edf7272e13c46469203423f711eaf3cb2a122cb (diff) |
sountouch.recipe: Fix symbol export on MSVC
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1355>
-rw-r--r-- | recipes/soundtouch.recipe | 4 | ||||
-rw-r--r-- | recipes/soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch | 57 |
2 files changed, 58 insertions, 3 deletions
diff --git a/recipes/soundtouch.recipe b/recipes/soundtouch.recipe index aafdd744..73eba44d 100644 --- a/recipes/soundtouch.recipe +++ b/recipes/soundtouch.recipe @@ -15,14 +15,12 @@ class Recipe(recipe.Recipe): 'soundtouch/0008-Fix-compilation-with-clang.patch', 'soundtouch/0001-Add-minimal-meson-build-system.patch', 'soundtouch/0002-add-support-for-linking-with-gnustl-on-android.patch', + 'soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch', ] files_libs = ['libSoundTouch'] files_devel = ['include/soundtouch', 'lib/pkgconfig/soundtouch.pc'] - # FIXME: Meson port does not export symbols correctly for use with MSVC - can_msvc = False - def prepare (self): if self.config.target_platform == Platform.ANDROID: self.append_env('CXXFLAGS', '-fexceptions -DST_NO_EXCEPTION_HANDLING') diff --git a/recipes/soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch b/recipes/soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch new file mode 100644 index 00000000..69d6d8c5 --- /dev/null +++ b/recipes/soundtouch/0001-Export-symbols-for-a-DLL-correctly.patch @@ -0,0 +1,57 @@ +From 0f852e729589851edf75d31100ea8cdff19986e4 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan <nirbheek@centricular.com> +Date: Thu, 8 Feb 2024 08:48:19 +0530 +Subject: [PATCH] Export symbols for a DLL correctly + +Fixes the MSVC build, which requires this. GCC (MinGW/Autotools) +simply exports everything. +--- + include/SoundTouch.h | 11 +++++++++++ + source/SoundTouch/meson.build | 6 ++++++ + 2 files changed, 17 insertions(+) + +diff --git a/include/SoundTouch.h b/include/SoundTouch.h +index f2addc1..e02f559 100644 +--- a/include/SoundTouch.h ++++ b/include/SoundTouch.h +@@ -164,7 +164,18 @@ namespace soundtouch + /// tempo/pitch/rate/samplerate settings.
+ #define SETTING_INITIAL_LATENCY 8
+
++#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(SOUNDTOUCH_STATIC_COMPILATION)
++ #ifdef DLL_EXPORTS
++ #define SOUNDTOUCH_API __declspec(dllexport)
++ #else
++ #define SOUNDTOUCH_API __declspec(dllimport)
++ #endif
++#else
++ #define SOUNDTOUCH_API
++#endif
++
+
++SOUNDTOUCH_API
+ class SoundTouch : public FIFOProcessor
+ {
+ private:
+diff --git a/source/SoundTouch/meson.build b/source/SoundTouch/meson.build +index 9bfcf96..2826165 100644 +--- a/source/SoundTouch/meson.build ++++ b/source/SoundTouch/meson.build +@@ -52,8 +52,14 @@ extra_libs += [ + ) + ] + ++exports_arg = [] ++if host_machine.system() == 'windows' and get_option('default_library') != 'static' ++ exports_args = ['-DDLL_EXPORTS'] ++endif ++ + libsoundtouch = library('SoundTouch', + soundtouch_sources, ++ cpp_args: exports_arg, + link_with: extra_libs, + version: libversion, + soversion: soversion, +-- +2.41.0 + |