Cmake: bring back the QtXml hack and other Mac changes

The hack in commit c8be04edad ("Mac build: move the QtXml hack into Cmake")
had been lost in the latest cmake rewrite.

Similarly, the modified BUNDLE info and the manual QML deployment.

Strangely this still doesn't correctly create a Subsurface-mobile.app on Mac.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-12-16 14:34:33 -08:00
parent 5672d3f567
commit d4184f852d

View file

@ -152,10 +152,17 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${HID_LIB})
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
set(MACOSX_BUNDLE_INFO_STRING "Subsurface")
set(MACOSX_BUNDLE_ICON_FILE Subsurface.icns)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.subsurface-divelog")
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface")
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
set(MACOSX_BUNDLE_INFO_STRING "Subsurface-mobile")
set(MACOSX_BUNDLE_ICON_FILE Subsurface.icns)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.subsurface-divelog")
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface-mobile")
else()
set(MACOSX_BUNDLE_INFO_STRING "Subsurface")
set(MACOSX_BUNDLE_ICON_FILE Subsurface.icns)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.subsurface-divelog")
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface")
endif()
set(MACOSX_BUNDLE_BUNDLE_VERSION "${SSRF_VERSION_STRING}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${SSRF_VERSION_STRING}")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${SSRF_VERSION_STRING}")
@ -319,8 +326,14 @@ if(ANDROID)
PACKAGE_SOURCES ${CMAKE_CURRENT_LIST_DIR}/android-mobile
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(RESOURCEDIR ${CMAKE_BINARY_DIR}/Subsurface.app/Contents/Resources)
set(PLUGINDIR ${CMAKE_BINARY_DIR}/Subsurface.app/Contents/PlugIns)
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
set(APP_BUNDLE_DIR Subsurface-mobile.app)
set(MACDEPLOY_ARGS "-qmldir=${APP_BUNDLE_DIR}/Contents/Frameworks/qml")
else()
set(APP_BUNDLE_DIR Subsurface.app)
endif()
set(RESOURCEDIR ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources)
set(PLUGINDIR ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns)
install(DIRECTORY marbledata/maps DESTINATION ${RESOURCEDIR}/data)
install(DIRECTORY marbledata/bitmaps DESTINATION ${RESOURCEDIR}/data)
install(DIRECTORY Documentation/images DESTINATION ${RESOURCEDIR}/share/Documentation)
@ -334,7 +347,23 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
install(DIRECTORY ${Grantlee5_DIR}/../../grantlee DESTINATION ${PLUGINDIR})
# this is a hack - but I don't know how else to find the macdeployqt program if it's not in the PATH
string(REPLACE moc macdeployqt MACDEPLOYQT ${QT_MOC_EXECUTABLE})
install(CODE "execute_process(COMMAND ${MACDEPLOYQT} Subsurface.app)")
install(CODE "execute_process(COMMAND ${MACDEPLOYQT} ${APP_BUNDLE_DIR} ${MACDEPLOY_ARGS})")
# and another hack to get the QML Components in the right place
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
install(CODE "execute_process(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/qml)")
endif()
if(NOT NO_MARBLE)
# more hackery - this time for QtXml which is needed by libssrfmarblewidget
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/lib/QtXml.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtXml.framework/Versions/5/Headers)")
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtXml.framework/Headers)")
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtXml.framework/QtXml.prl)")
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtXml.framework/Versions/5/*_debug)")
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtXml.framework//*_debug)")
install(CODE "execute_process(COMMAND install_name_tool -id @executable_path/../Frameworks/QtXml ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtXml.framework/QtXml)")
install(CODE "execute_process(COMMAND install_name_tool -change @rpath/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/QtCore ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtXml.framework/QtXml)")
endif()
install(CODE "message(STATUS \"two ERRORS here about libmysqlclient and libpq not found are harmless\")")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Windows bundling rules