Commit 0d3288ca authored by Halla Rempt's avatar Halla Rempt

Set rpaths for OSX

To quote the cmake manual:

"Policy CMP0042 was introduced to change the default value of
MACOSX_RPATH to ON. This is because use of @rpath is a more flexible
and powerful alternative to @executable_path and @loader_path."

And whenever something is flexible and powerful, you can bet there
are too many ways of doing things and that it'll take days or weeks
to get things working again.

This change explicitly sets the rpaths both for running krita on OSX
after doing a make install and for running krita from a bundle. There
may be some redundancy here and it is still not enough. Macdeployqt
doesn't pick up the location of the libraries and start looking in
/Libraries/Frameworks for the Qt frameworks. So either we can add
a #{CMAKE_INSTALL_PREFIX}/lib to the properties here, or fix that in
the deploy script. For now, I'm doing the latter and running
macdeployqt like this:

rm -rf ~/kf5/krita.app/
rm -rf ~/kf5/krita.dmg
cp -r ~/kf5/i/bin/krita.app ~/kf5
cp -r ~/kf5/i/share ~/kf5/krita.app/Contents/
mkdir -p ~/kf5/krita.app/Contents/PlugIns/krita
install_name_tool -add_rpath /Users/boudewijnrempt/kf5/i/lib ~/kf5/krita.app/Contents/MacOS/krita
macdeployqt ~/kf5/krita.app \
    -verbose=0 \
    -executable=/Users/boudewijnrempt/kf5/krita.app/Contents/MacOS/krita \
    -extra-plugins=/Users/boudewijnrempt/kf5/i/lib/krita/ \
    -extra-plugins=/Users/boudewijnrempt/kf5/i/lib/plugins/ \
    -extra-plugins=/Users/boudewijnrempt/kf5/i/plugins/
mv ~/kf5/krita.app/Contents/PlugIns/*so ~/kf5/krita.app/Contents/PlugIns/krita
install_name_tool -delete_rpath  @loader_path/../../../../lib ~/kf5/krita.app/Contents/MacOS/krita
install_name_tool -delete_rpath  /Users/boudewijnrempt/kf5/i/lib ~/kf5/krita.app/Contents/MacOS/krita
parent 4ada36c8
......@@ -186,6 +186,7 @@ if (APPLE)
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set_target_properties(krita PROPERTIES INSTALL_RPATH "@loader_path/../../../../lib;@loader_path/../lib;@loader_path/../Frameworks;@executable_path/../lib;@executable_path/../Frameworks")
set_target_properties(krita PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.template)
set_target_properties(krita PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.krita")
set_target_properties(krita PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Krita")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment