Skip to content

Commit

Permalink
qmake|OS X: Upgraded to SDL 2 and used @rpath for dynamic linking
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 21, 2014
1 parent 1a2739c commit 47c3f86
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 46 deletions.
6 changes: 3 additions & 3 deletions doomsday/client/client.pro
Expand Up @@ -830,13 +830,13 @@ macx {
doPostLink("rm -rf $$FW_DIR")
doPostLink("mkdir $$FW_DIR")
!deng_nosdl {
doPostLink("cp -fRp $${SDL_FRAMEWORK_DIR}/SDL.framework $$FW_DIR")
!deng_nosdlmixer: doPostLink("cp -fRp $${SDL_FRAMEWORK_DIR}/SDL_mixer.framework $$FW_DIR")
doPostLink("cp -fRp $${SDL_FRAMEWORK_DIR}/SDL2.framework $$FW_DIR")
!deng_nosdlmixer: doPostLink("cp -fRp $${SDL_FRAMEWORK_DIR}/SDL2_mixer.framework $$FW_DIR")
}
deng_fmod {
# Bundle the FMOD shared library under Frameworks.
doPostLink("cp -f \"$$FMOD_DIR/api/lib/libfmodex.dylib\" $$FW_DIR")
doPostLink("install_name_tool -id @executable_path/../Frameworks/libfmodex.dylib $${FW_DIR}libfmodex.dylib")
doPostLink("install_name_tool -id @rpath/libfmodex.dylib $${FW_DIR}libfmodex.dylib")
}

# Fix the dynamic linker paths so they point to ../Frameworks/ inside the bundle.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/unix/joystick.cpp
Expand Up @@ -89,7 +89,7 @@ static void initialize(void)
if(joy)
{
// Show some info.
LOG_INPUT_MSG("Joystick name: %s" ) << SDL_JoystickName(SDL_JoystickIndex(joy));
LOG_INPUT_MSG("Joystick name: %s" ) << SDL_JoystickName(joy);

// We'll handle joystick events manually
SDL_JoystickEventState(SDL_ENABLE);
Expand Down
3 changes: 3 additions & 0 deletions doomsday/config_macx.pri
Expand Up @@ -95,6 +95,9 @@ deng_c++11 {
QMAKE_LFLAGS += -stdlib=libc++
}

# Add the bundled Frameworks to the rpath.
QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../Frameworks

# Macros ---------------------------------------------------------------------

defineTest(useFramework) {
Expand Down
2 changes: 1 addition & 1 deletion doomsday/dep_assimp.pri
Expand Up @@ -71,6 +71,6 @@ macx {
# 1: binary
# 2: relative path to Frameworks
doPostLink(install_name_tool -change "$$ASSIMP_DIR/lib/libassimp.3.dylib" \
"@executable_path/$${2}/Frameworks/libassimp.3.dylib" "$$1")
"@rpath/libassimp.3.dylib" "$$1")
}
}
37 changes: 20 additions & 17 deletions doomsday/dep_sdl.pri
@@ -1,19 +1,20 @@
# Build configuration for using SDL 2

!deng_nosdl {

# Build configuration for SDL (core library).
win32 {
isEmpty(SDL_DIR) {
error("dep_sdl: SDL path not defined, check your config_user.pri")
error("dep_sdl: SDL path not defined, check your config_user.pri (SDL_DIR)")
}
sdlLibDir = $$SDL_DIR/lib
exists($$SDL_DIR/lib/x86): sdlLibDir = $$SDL_DIR/lib/x86

INCLUDEPATH += $$SDL_DIR/include
LIBS += -L$$sdlLibDir -lsdl
LIBS += -L$$sdlLibDir -lsdl2

# Libraries to copy to the products directory.
INSTALLS += sdllibs
sdllibs.files = $$sdlLibDir/SDL.dll
sdllibs.files = $$sdlLibDir/SDL2.dll
sdllibs.path = $$DENG_LIB_DIR
}
else:macx {
Expand All @@ -22,17 +23,17 @@ else:macx {
error("dep_sdl: SDL framework path not defined, check your config_user.pri")
}

INCLUDEPATH += $${SDL_FRAMEWORK_DIR}/SDL.framework/Headers
INCLUDEPATH += $${SDL_FRAMEWORK_DIR}/SDL2.framework/Headers
QMAKE_LFLAGS += -F$${SDL_FRAMEWORK_DIR}

LIBS += -framework SDL
LIBS += -framework SDL2
}
else {
# Generic Unix.
sdlflags = $$system(pkg-config sdl --cflags)
sdlflags = $$system(pkg-config sdl2 --cflags)
QMAKE_CFLAGS += $$sdlflags
QMAKE_CXXFLAGS += $$sdlflags
LIBS += $$system(pkg-config sdl --libs)
LIBS += $$system(pkg-config sdl2 --libs)
}

# Should we include SDL_mixer in the build, too?
Expand All @@ -45,27 +46,29 @@ else {
exists($$SDL_MIXER_DIR/lib/x86): sdlMixerLibDir = $$SDL_MIXER_DIR/lib/x86

INCLUDEPATH += $$SDL_MIXER_DIR/include
LIBS += -L$$sdlMixerLibDir -lsdl_mixer
LIBS += -L$$sdlMixerLibDir -lsdl2_mixer

# Libraries to copy to the products directory.
INSTALLS += sdlmixerlibs
sdlmixerlibs.files = \
$$sdlMixerLibDir/libFLAC-8.dll \
$$sdlMixerLibDir/libmikmod-2.dll \
$$sdlMixerLibDir/libmodplug-1.dll \
$$sdlMixerLibDir/libogg-0.dll \
$$sdlMixerLibDir/libvorbis-0.dll \
$$sdlMixerLibDir/libvorbisfile-3.dll \
$$sdlMixerLibDir/mikmod.dll \
$$sdlMixerLibDir/SDL_mixer.dll \
$$sdlMixerLibDir/smpeg.dll
$$sdlMixerLibDir/SDL2_mixer.dll \
$$sdlMixerLibDir/smpeg2.dll
sdlmixerlibs.path = $$DENG_LIB_DIR
}
else:macx {
INCLUDEPATH += $${SDL_FRAMEWORK_DIR}/SDL_mixer.framework/Headers
QMAKE_LFLAGS += -F$${SDL_FRAMEWORK_DIR}/SDL_mixer.framework/Frameworks
LIBS += -framework SDL_mixer
INCLUDEPATH += $${SDL_FRAMEWORK_DIR}/SDL2_mixer.framework/Headers
QMAKE_LFLAGS += -F$${SDL_FRAMEWORK_DIR}/SDL2_mixer.framework/Frameworks
LIBS += -framework SDL2_mixer
}
else {
LIBS += -lSDL_mixer
LIBS += -lSDL2_mixer
}
}

} # !deng_nosdl
} # !deng_nosdl
2 changes: 1 addition & 1 deletion doomsday/libappfw/libappfw.pro
Expand Up @@ -250,7 +250,7 @@ SOURCES += \
macx {
linkDylibToBundledLibcore(libdeng_appfw)

doPostLink("install_name_tool -id @executable_path/../Frameworks/libdeng_appfw.1.dylib libdeng_appfw.1.dylib")
doPostLink("install_name_tool -id @rpath/libdeng_appfw.1.dylib libdeng_appfw.1.dylib")

# Update the library included in the main app bundle.
doPostLink("mkdir -p ../client/Doomsday.app/Contents/Frameworks")
Expand Down
8 changes: 4 additions & 4 deletions doomsday/libcore/libcore.pro
Expand Up @@ -185,11 +185,11 @@ OTHER_FILES += \

macx {
defineTest(fixInstallName) {
doPostLink("install_name_tool -change $$1 @executable_path/../Frameworks/$$1 libdeng_core.2.dylib")
doPostLink("install_name_tool -change $$(QTDIR)lib/$$1 @executable_path/../Frameworks/$$1 libdeng_core.2.dylib")
doPostLink("install_name_tool -change $$(QTDIR)/lib/$$1 @executable_path/../Frameworks/$$1 libdeng_core.2.dylib")
doPostLink("install_name_tool -change $$1 @rpath/$$1 libdeng_core.2.dylib")
doPostLink("install_name_tool -change $$(QTDIR)lib/$$1 @rpath/$$1 libdeng_core.2.dylib")
doPostLink("install_name_tool -change $$(QTDIR)/lib/$$1 @rpath/$$1 libdeng_core.2.dylib")
}
doPostLink("install_name_tool -id @executable_path/../Frameworks/libdeng_core.2.dylib libdeng_core.2.dylib")
doPostLink("install_name_tool -id @rpath/libdeng_core.2.dylib libdeng_core.2.dylib")
fixInstallName("QtCore.framework/Versions/$$QT_MAJOR_VERSION/QtCore")
fixInstallName("QtNetwork.framework/Versions/$$QT_MAJOR_VERSION/QtNetwork")

Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdoomsday/libdoomsday.pro
Expand Up @@ -130,7 +130,7 @@ macx {
linkDylibToBundledLiblegacy(libdeng_doomsday)
linkDylibToBundledLibshell (libdeng_doomsday)

doPostLink("install_name_tool -id @executable_path/../Frameworks/libdeng_doomsday.1.dylib libdeng_doomsday.1.dylib")
doPostLink("install_name_tool -id @rpath/libdeng_doomsday.1.dylib libdeng_doomsday.1.dylib")

# Update the library included in the main app bundle.
doPostLink("mkdir -p ../client/Doomsday.app/Contents/Frameworks")
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libgui/libgui.pro
Expand Up @@ -218,11 +218,11 @@ OTHER_FILES += \
macx {
linkDylibToBundledLibcore(libdeng_gui)

doPostLink("install_name_tool -id @executable_path/../Frameworks/libdeng_gui.1.dylib libdeng_gui.1.dylib")
doPostLink("install_name_tool -id @rpath/libdeng_gui.1.dylib libdeng_gui.1.dylib")

# Prepare Assimp for deployment.
doPostLink("cp -fRp $$ASSIMP_DIR/lib/libassimp*dylib .")
doPostLink("install_name_tool -id @executable_path/../Frameworks/libassimp.3.dylib libassimp.3.dylib")
doPostLink("install_name_tool -id @rpath/libassimp.3.dylib libassimp.3.dylib")
linkBinaryToBundledAssimp(libdeng_gui.1.dylib, ..)
}
else {
Expand Down
2 changes: 1 addition & 1 deletion doomsday/liblegacy/liblegacy.pro
Expand Up @@ -128,7 +128,7 @@ else:unix {
macx {
linkDylibToBundledLibcore(libdeng_legacy)

doPostLink("install_name_tool -id @executable_path/../Frameworks/libdeng_legacy.1.dylib libdeng_legacy.1.dylib")
doPostLink("install_name_tool -id @rpath/libdeng_legacy.1.dylib libdeng_legacy.1.dylib")

# Update the library included in the main app bundle.
doPostLink("mkdir -p ../client/Doomsday.app/Contents/Frameworks")
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libshell/libshell.pro
Expand Up @@ -109,7 +109,7 @@ SOURCES += \
macx {
linkDylibToBundledLibcore(libdeng_shell)

doPostLink("install_name_tool -id @executable_path/../Frameworks/libdeng_shell.1.dylib libdeng_shell.1.dylib")
doPostLink("install_name_tool -id @rpath/libdeng_shell.1.dylib libdeng_shell.1.dylib")

# Update the library included in the main app bundle.
doPostLink("mkdir -p ../client/Doomsday.app/Contents/Frameworks")
Expand Down
2 changes: 1 addition & 1 deletion doomsday/macros.pri
Expand Up @@ -79,7 +79,7 @@ macx {
# 2: library name
# 3: path to Frameworks/
removeQtLibPrefix($$1, $$2)
doPostLink("install_name_tool -change $$2 @executable_path/$$3/Frameworks/$$2 $$1")
doPostLink("install_name_tool -change $$2 @rpath/$$2 $$1")
}
defineTest(fixPluginInstallId) {
# 1: target name
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/fmod/fmod.pro
Expand Up @@ -44,7 +44,7 @@ win32 {
}
else:macx {
fixPluginInstallId($$TARGET, 1)
doPostLink("install_name_tool -change ./libfmodex.dylib @executable_path/../Frameworks/libfmodex.dylib audio_fmod.bundle/audio_fmod")
doPostLink("install_name_tool -change ./libfmodex.dylib @rpath/libfmodex.dylib audio_fmod.bundle/audio_fmod")
}
else {
INSTALLS += target
Expand Down
24 changes: 12 additions & 12 deletions doomsday/postbuild/bundleapp.sh
Expand Up @@ -82,34 +82,34 @@ if [ -e plugins/fluidsynth/audio_fluidsynth.bundle ]; then
chmod u+w $FWDIR/libglib-2.0.0.dylib $FWDIR/libgthread-2.0.0.dylib $FWDIR/libintl.8.dylib

# IDs
install_name_tool -id @executable_path/../Frameworks/libglib-2.0.0.dylib $FWDIR/libglib-2.0.0.dylib
install_name_tool -id @executable_path/../Frameworks/libgthread-2.0.0.dylib $FWDIR/libgthread-2.0.0.dylib
install_name_tool -id @executable_path/../Frameworks/libintl.8.dylib $FWDIR/libintl.8.dylib
install_name_tool -id @rpath/libglib-2.0.0.dylib $FWDIR/libglib-2.0.0.dylib
install_name_tool -id @rpath/libgthread-2.0.0.dylib $FWDIR/libgthread-2.0.0.dylib
install_name_tool -id @rpath/libintl.8.dylib $FWDIR/libintl.8.dylib

# glib-2.0.0
install_name_tool -change /usr/local/Cellar/gettext/$GETTEXT_VER/lib/libintl.8.dylib \
@executable_path/../Frameworks/libintl.8.dylib $FWDIR/libglib-2.0.0.dylib
@rpath/libintl.8.dylib $FWDIR/libglib-2.0.0.dylib
install_name_tool -change /usr/local/opt/gettext/lib/libintl.8.dylib \
@executable_path/../Frameworks/libintl.8.dylib $FWDIR/libglib-2.0.0.dylib
@rpath/libintl.8.dylib $FWDIR/libglib-2.0.0.dylib

# gthread-2.0.0
install_name_tool -change /usr/local/Cellar/glib/$GLIB_VER/lib/libglib-2.0.0.dylib \
@executable_path/../Frameworks/libglib-2.0.0.dylib $FWDIR/libgthread-2.0.0.dylib
@rpath/libglib-2.0.0.dylib $FWDIR/libgthread-2.0.0.dylib
install_name_tool -change /usr/local/Cellar/gettext/$GETTEXT_VER/lib/libintl.8.dylib \
@executable_path/../Frameworks/libintl.8.dylib $FWDIR/libgthread-2.0.0.dylib
@rpath/libintl.8.dylib $FWDIR/libgthread-2.0.0.dylib
install_name_tool -change /usr/local/opt/gettext/lib/libintl.8.dylib \
@executable_path/../Frameworks/libintl.8.dylib $FWDIR/libgthread-2.0.0.dylib
@rpath/libintl.8.dylib $FWDIR/libgthread-2.0.0.dylib

# audio_fluidsynth
DSFS=$PLUGDIR/audio_fluidsynth.bundle/audio_fluidsynth
install_name_tool -change /usr/local/lib/libglib-2.0.0.dylib \
@executable_path/../Frameworks/libglib-2.0.0.dylib $DSFS
@rpath/libglib-2.0.0.dylib $DSFS
install_name_tool -change /usr/local/lib/libgthread-2.0.0.dylib \
@executable_path/../Frameworks/libgthread-2.0.0.dylib $DSFS
@rpath/libgthread-2.0.0.dylib $DSFS
install_name_tool -change /usr/local/Cellar/gettext/$GETTEXT_VER/lib/libintl.8.dylib \
@executable_path/../Frameworks/libintl.8.dylib $DSFS
@rpath/libintl.8.dylib $DSFS
install_name_tool -change /usr/local/opt/gettext/lib/libintl.8.dylib \
@executable_path/../Frameworks/libintl.8.dylib $DSFS
@rpath/libintl.8.dylib $DSFS
fi

qtVer=`qmake -query QT_VERSION`
Expand Down

0 comments on commit 47c3f86

Please sign in to comment.