From 30b017d112120a45dec0340878c50ed4470f7040 Mon Sep 17 00:00:00 2001 From: oparviai Date: Thu, 30 Nov 2017 18:07:41 +0000 Subject: [PATCH] SoundTouchDLL: adapt gcc compilation settings for x86/x64/arm platforms --- source/SoundTouchDLL/make-gnu-dll.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/source/SoundTouchDLL/make-gnu-dll.sh b/source/SoundTouchDLL/make-gnu-dll.sh index 4e622f1..b38c643 100755 --- a/source/SoundTouchDLL/make-gnu-dll.sh +++ b/source/SoundTouchDLL/make-gnu-dll.sh @@ -1,8 +1,22 @@ -#!/bin/sh +#!/bin/bash # # This script compiles SoundTouch dynamic-link library for GNU environment # with wrapper functions that are easier to import to Java / Mono / etc # -g++ -fPIC -shared -DDLL_EXPORTS -fvisibility=hidden -I../../include -o SoundTouchDll.so \ - SoundTouchDLL.cpp ../SoundTouch/*.cpp -I../SoundTouch -O3 -msse +arch=$(uname -m) +flags="" + +if [[ $arch == *"86"* ]]; then + # Intel x86/x64 architecture + flags="$flags -mstackrealign -msse" + + if [[ $arch == *"_64" ]]; then + flags="$flags -fPIC" + fi +fi + +echo "Building SoundTouchDLL for $arch with flags:$flags" + +g++ -O3 -shared $flags -DDLL_EXPORTS -fvisibility=hidden -I../../include \ + -I../SoundTouch -o SoundTouchDll.so SoundTouchDLL.cpp ../SoundTouch/*.cpp