Skip to content

Commit

Permalink
Allow macdeployqt from 5.5 to deploy 5.6+
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Jan 7, 2017
1 parent 400be17 commit f24f3d9
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions cmake/apple/install_apple.sh.in
Expand Up @@ -24,17 +24,28 @@ 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
# Explicitly use qt55 macdeployqt if available
brew --prefix qt5 > /dev/null 2>&1 && brew --prefix qt55 > /dev/null 2>&1
if [ $? -eq 0 ]; then
# Capture exact library locations for qt5, qt55
prefix5=$(brew --prefix qt5)
prefix55=$(brew --prefix qt55)
# Force english locale for reliable parsing
export LANG=C
# Get exact Qt versions installed, e.g. "5.5.1", "5.7.0", etc.
ver5=$prefix5$($prefix5/bin/qmake --version |awk -F' ' 'NR==2{print $4}')
ver55=$prefix55$($prefix55/bin/qmake --version |awk -F' ' 'NR==2{print $4}')
# Copy and re-link qt55 macdeployqt tool
echo "Copying $prefix55/bin/macdeployqt to @CMAKE_BINARY_DIR@..."
\cp "$prefix55/bin/macdeployqt" "@CMAKE_BINARY_DIR@"
chmod u+w "@CMAKE_BINARY_DIR@/macdeployqt"
install_name_tool -change "$ver55/lib/QtGui.framework/Versions/5/QtGui" "$ver5/lib/QtGui.framework/Versions/5/QtGui" "@CMAKE_BINARY_DIR@/macdeployqt"
install_name_tool -change "$ver55/lib/QtCore.framework/Versions/5/QtCore" "$ver5/lib/QtCore.framework/Versions/5/QtCore" "@CMAKE_BINARY_DIR@/macdeployqt"
echo "Adding @CMAKE_BINARY_DIR@ to PATH for macdeployqt workaround"
export PATH=@CMAKE_BINARY_DIR@:$PATH
else
# Fallback qt5
brew --prefix qt5 && export PATH=$(brew --prefix qt5)/bin:$PATH > /dev/null 2>&1
fi

# MacPorts only - check for u+w permissions on libreadline
Expand Down

0 comments on commit f24f3d9

Please sign in to comment.