From 817d651c47251fb97155391f5ee5497f8efa6428 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 6 Jan 2016 17:10:57 -0800 Subject: [PATCH] add initial fixup install commands for interface --- CMakeLists.txt | 2 ++ cmake/macros/FixupInterface.cmake | 57 +++++++++++++++++++++++++++++++ interface/CMakeLists.txt | 4 +++ 3 files changed, 63 insertions(+) create mode 100644 cmake/macros/FixupInterface.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a763cb064..73626323dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,6 +115,8 @@ else () endif () endif () +set(QT_DIR $ENV{QT_DIR}) + if (WIN32) if (NOT EXISTS ${QT_CMAKE_PREFIX_PATH}) message(FATAL_ERROR "Could not determine QT_CMAKE_PREFIX_PATH.") diff --git a/cmake/macros/FixupInterface.cmake b/cmake/macros/FixupInterface.cmake new file mode 100644 index 0000000000..d3873a55f5 --- /dev/null +++ b/cmake/macros/FixupInterface.cmake @@ -0,0 +1,57 @@ +# +# FixupInterface.cmake +# cmake/macros +# +# Copyright 2016 High Fidelity, Inc. +# Created by Stephen Birarda on January 6th, 2016 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +macro(fixup_interface) + if (APPLE) + + string(REPLACE " " "\\" ESCAPED_BUNDLE_NAME ${_INTERFACE_BUNDLE_NAME}) + set(INTERFACE_INSTALL_PATH "Applications/High\\ Fidelity/${ESCAPED_BUNDLE_NAME}.app") + + # install QtWebProcess from Qt to the application bundle + # since it is missed by macdeployqt + # https://bugreports.qt.io/browse/QTBUG-35211 + set(LIBEXEC_PATH "${INTERFACE_INSTALL_PATH}/Contents/libexec") + install( + PROGRAMS "${QT_DIR}/libexec/QtWebProcess" + DESTINATION ${LIBEXEC_PATH} + COMPONENT ${CLIENT_COMPONENT} + ) + + set(QTWEBPROCESS_PATH "\${CMAKE_INSTALL_PREFIX}/${LIBEXEC_PATH}") + + # we also need a qt.conf in the directory of QtWebProcess + install(CODE " + file(WRITE ${QTWEBPROCESS_PATH}/qt.conf + \"[Paths]\nPlugins = ../PlugIns\nImports = ../Resources/qml\nQml2Imports = ../Resources/qml\" + )" + COMPONENT ${CLIENT_COMPONENT} + ) + + find_program(MACDEPLOYQT_COMMAND macdeployqt PATHS "${QT_DIR}/bin" NO_DEFAULT_PATH) + + if (NOT MACDEPLOYQT_COMMAND AND (PRODUCTION_BUILD OR PR_BUILD)) + message(FATAL_ERROR "Could not find macdeployqt at ${QT_DIR}/bin.\ + It is required to produce an relocatable interface application.\ + Check that the environment variable QT_DIR points to your Qt installation.\ + ") + endif () + + install(CODE " + execute_process(COMMAND ${MACDEPLOYQT_COMMAND}\ + \${CMAKE_INSTALL_PREFIX}/${INTERFACE_INSTALL_PATH}/\ + -verbose=2 -qmldir=${CMAKE_SOURCE_DIR}/interface/resources/qml/\ + -executable=\${CMAKE_INSTALL_PREFIX}/${INTERFACE_INSTALL_PATH}/Contents/libexec/QtWebProcess\ + )" + COMPONENT ${CLIENT_COMPONENT} + ) + + endif () +endmacro() diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index c0fb3c95a2..2fb5d8c33c 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -228,6 +228,7 @@ if (APPLE) BUNDLE DESTINATION "Applications/High Fidelity" COMPONENT ${CLIENT_COMPONENT} ) + else (APPLE) # copy the resources files beside the executable add_custom_command(TARGET ${TARGET_NAME} POST_BUILD @@ -248,6 +249,9 @@ else (APPLE) endif() endif (APPLE) +# call the fixup_interface macro to add required bundling commands for installation +fixup_interface() + if (WIN32) set(EXTRA_DEPLOY_OPTIONS "--qmldir ${PROJECT_SOURCE_DIR}/resources/qml") endif()