Skip to content

Commit

Permalink
Merge pull request #2861 from tresf/master
Browse files Browse the repository at this point in the history
Fix building on older Apple versions
  • Loading branch information
tresf authored Jun 23, 2016
2 parents 36bb163 + 092f1c6 commit 7ce2694
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .travis/osx..install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PACKAGES="cmake pkgconfig fftw libogg libvorbis libsndfile libsamplerate jack sdl stk fluid-synth portaudio node"

if [ $QT5 ]; then
PACKAGES="$PACKAGES qt5"
PACKAGES="$PACKAGES qt55"
else
PACKAGES="$PACKAGES qt"
fi
Expand Down
2 changes: 1 addition & 1 deletion .travis/osx..script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

if [ $QT5 ]; then
# Workaround; No FindQt5.cmake module exists
export CMAKE_PREFIX_PATH="$(brew --prefix qt5)"
export CMAKE_PREFIX_PATH="$(brew --prefix qt55)"
fi

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWANT_QT5=$QT5 -DUSE_WERROR=OFF ..
38 changes: 23 additions & 15 deletions cmake/apple/install_apple.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ LIBREADLINE="libreadline.6.2.dylib"
MSG_COLOR='\x1B[1;36m'
COLOR_RESET='\x1B[0m'
echo -e "$MSG_COLOR\n\nCreating App Bundle \"$APP\"...$COLOR_RESET"

# Locate macdeployqt, assume homebrew & Qt5
which macdeployqt > /dev/null 2>&1
if [ $? -ne 0 ]; then
brew --prefix qt55 > /dev/null 2>&1
if [ $? -eq 0 ]; then
# Prefer Qt 5.5 (QTBUG-53533)
export PATH=$PATH:$(brew --prefix qt55)/bin
else
# Fallback Qt 5.6+
export PATH=$PATH:$(brew --prefix qt5)/bin
fi
fi

# MacPorts only - check for u+w permissions on libreadline
if [ -f "@APPLE_PREFIX@/lib/$LIBREADLINE" ]; then
Expand All @@ -49,7 +62,7 @@ cp -R * "$APP/Contents"

# Manually copy STK rawwaves
mkdir -p "$APP/Contents/share/stk/rawwaves"
cp $STK_RAWWAVE/*.raw "$APP/Contents/share/stk/rawwaves"
cp $STK_RAWWAVE/*.raw "$APP/Contents/share/stk/rawwaves" > /dev/null 2>&1

# Make all libraries writable for macdeployqt
cd "$APP"
Expand All @@ -62,20 +75,15 @@ rm -rf "$APP/Contents/bin"

# Move libraries to proper locations
mkdir -p "$APP/Contents/Frameworks"
mv "$APP/Contents/lib/lmms/libZynAddSubFxCore.dylib" \
"$APP/Contents/Frameworks/libZynAddSubFxCore.dylib"

mv "$APP/Contents/lib/lmms/RemoteZynAddSubFx" \
"$APP/Contents/MacOS/RemoteZynAddSubFx"

# Fix more Zyn Linking issues

rm "$APP/Contents/Frameworks/libZynAddSubFxCore.dylib" > /dev/null 2>&1

# Fix zyn linking
install_name_tool -change @rpath/libZynAddSubFxCore.dylib \
@loader_path/../../Frameworks/libZynAddSubFxCore.dylib \
"$APP/Contents/lib/lmms/libzynaddsubfx.so"

install_name_tool -change @CMAKE_BINARY_DIR@/plugins/zynaddsubfx/libZynAddSubFxCore.dylib \
@loader_path/../../Frameworks/libZynAddSubFxCore.dylib \
"$APP/Contents/MacOS/RemoteZynAddSubFx"
@loader_path/../lib/lmms/libZynAddSubFxCore.dylib \
"$APP/Contents/MacOS/RemoteZynAddSubFx"

# Build a list of shared objects in target/lib/lmms
for file in "$APP/Contents/lib/lmms/"*.so; do
Expand All @@ -91,13 +99,13 @@ done

# Additional binaries that require linking
_executables="${_executables} -executable=$APP/Contents/MacOS/RemoteZynAddSubFx"
_executables="${_executables} -executable=$APP/Contents/Frameworks/libZynAddSubFxCore.dylib"
_executables="${_executables} -executable=$APP/Contents/lib/lmms/libZynAddSubFxCore.dylib"

# Build our App Package using "macdeployqt"
macdeployqt "$APP" $_executables

# OS X Specific Artwork
mkdir -p "$APP/Contents/Resources"
cp "@CMAKE_SOURCE_DIR@/cmake/apple/"*.icns "$APP/Contents/Resources/"

echo -e "\nFinished.\n\n"
4 changes: 4 additions & 0 deletions plugins/GigPlayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ if(LMMS_HAVE_GIG)

# Enable C++11
ADD_DEFINITIONS(-std=c++0x)

IF(LMMS_BUILD_APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()

LINK_DIRECTORIES(${GIG_LIBRARY_DIRS} ${SAMPLERATE_LIBRARY_DIRS})
LINK_LIBRARIES(${GIG_LIBRARIES} ${SAMPLERATE_LIBRARIES})
Expand Down
4 changes: 4 additions & 0 deletions plugins/MidiExport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ INCLUDE(BuildPlugin)
# Enable C++11
ADD_DEFINITIONS(-std=c++0x)

IF(LMMS_BUILD_APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()

BUILD_PLUGIN(midiexport MidiExport.cpp MidiExport.h MidiFile.hpp
MOCFILES MidiExport.h)
4 changes: 4 additions & 0 deletions plugins/VstEffect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ ENDIF()
# Enable C++11
ADD_DEFINITIONS(-std=c++0x)

IF(LMMS_BUILD_APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()

BUILD_PLUGIN(vsteffect VstEffect.cpp VstEffectControls.cpp VstEffectControlDialog.cpp VstSubPluginFeatures.cpp VstEffect.h VstEffectControls.h VstEffectControlDialog.h VstSubPluginFeatures.h MOCFILES VstEffectControlDialog.h VstEffectControls.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
SET_TARGET_PROPERTIES(vsteffect PROPERTIES COMPILE_FLAGS "-Wno-attributes")
TARGET_LINK_LIBRARIES(vsteffect -lvstbase)
Expand Down
4 changes: 4 additions & 0 deletions plugins/lb302/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ INCLUDE(BuildPlugin)
# Enable C++11
ADD_DEFINITIONS(-std=c++0x)

IF(LMMS_BUILD_APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()

BUILD_PLUGIN(lb302 lb302.cpp lb302.h MOCFILES lb302.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
4 changes: 4 additions & 0 deletions plugins/opl2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ INCLUDE(BuildPlugin)
# Enable C++11
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")

IF(LMMS_BUILD_APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()

BUILD_PLUGIN(OPL2 opl2instrument.cpp opl2instrument.h opl.h fmopl.c fmopl.h temuopl.cpp temuopl.h MOCFILES opl2instrument.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
4 changes: 4 additions & 0 deletions plugins/vestige/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
IF(LMMS_SUPPORT_VST)
# Enable C++11
ADD_DEFINITIONS(-std=c++0x)

IF(LMMS_BUILD_APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()

INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../vst_base")
Expand Down
4 changes: 4 additions & 0 deletions plugins/zynaddsubfx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wno-write-strings -Wno-deprecated-d

# Enable C++11, but only for ZynAddSubFx.cpp
set_property(SOURCE ZynAddSubFx.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -std=c++0x ")

IF(LMMS_BUILD_APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()

# link system-libraries when on win32
IF(LMMS_BUILD_WIN32)
Expand Down
3 changes: 0 additions & 3 deletions plugins/zynaddsubfx/ZynAddSubFx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,6 @@ ZynAddSubFxView::ZynAddSubFxView( Instrument * _instrument, QWidget * _parent )

m_toggleUIButton = new QPushButton( tr( "Show GUI" ), this );
m_toggleUIButton->setCheckable( true );
#ifdef LMMS_BUILD_APPLE
m_toggleUIButton->setEnabled( false );
#endif
m_toggleUIButton->setChecked( false );
m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) );
m_toggleUIButton->setFont( pointSize<8>( m_toggleUIButton->font() ) );
Expand Down
8 changes: 8 additions & 0 deletions src/core/RemotePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ bool RemotePlugin::init( const QString &pluginExecutable,
m_failed = false;
}
QString exec = QFileInfo(QDir("plugins:"), pluginExecutable).absoluteFilePath();
#ifdef LMMS_BUILD_APPLE
// search current directory first
QString curDir = QCoreApplication::applicationDirPath() + "/" + pluginExecutable;
if( QFile( curDir ).exists() )
{
exec = curDir;
}
#endif
#ifdef LMMS_BUILD_WIN32
if( ! exec.endsWith( ".exe", Qt::CaseInsensitive ) )
{
Expand Down

0 comments on commit 7ce2694

Please sign in to comment.