From f0dfa5edd2cd1b568c9f2baf2a0dd5b80788c4cc Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Mon, 14 Jan 2019 12:30:58 -0800 Subject: [PATCH] Integrating Stephen's hints. --- cmake/macros/FixupNitpick.cmake | 37 +++++++++++++++++++++++ cmake/macros/SetPackagingParameters.cmake | 2 ++ tools/nitpick/CMakeLists.txt | 11 +++++++ 3 files changed, 50 insertions(+) create mode 100644 cmake/macros/FixupNitpick.cmake diff --git a/cmake/macros/FixupNitpick.cmake b/cmake/macros/FixupNitpick.cmake new file mode 100644 index 0000000000..9962494a9a --- /dev/null +++ b/cmake/macros/FixupNitpick.cmake @@ -0,0 +1,37 @@ +# +# FixupNitpick.cmake +# cmake/macros +# +# Copyright 2019 High Fidelity, Inc. +# Created by Nissim Hadar on January 14th, 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_nitpick) + if (APPLE) + + string(REPLACE " " "\\ " ESCAPED_BUNDLE_NAME ${NITPICK_BUNDLE_NAME}) + string(REPLACE " " "\\ " ESCAPED_INSTALL_PATH ${NITPICK_INSTALL_DIR}) + set(_NITPICK_INSTALL_PATH "${ESCAPED_INSTALL_PATH}/${ESCAPED_BUNDLE_NAME}.app") + + 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}/${_NITPICK_INSTALL_PATH}/\ + -verbose=2 -qmldir=${CMAKE_SOURCE_DIR}/interface/resources/qml/\ + )" + COMPONENT ${CLIENT_COMPONENT} + ) + + endif () +endmacro() diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 345fdda4a4..310954bbad 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -41,6 +41,8 @@ macro(SET_PACKAGING_PARAMETERS) set(INTERFACE_BUNDLE_NAME "Interface") set(INTERFACE_ICON_PREFIX "interface") + set(NITPICK_BUNDLE_NAME "nitpick") + # add definition for this release type add_definitions(-DPRODUCTION_BUILD) diff --git a/tools/nitpick/CMakeLists.txt b/tools/nitpick/CMakeLists.txt index f3de8f0fa5..072806cfad 100644 --- a/tools/nitpick/CMakeLists.txt +++ b/tools/nitpick/CMakeLists.txt @@ -33,6 +33,17 @@ target_link_libraries(${TARGET_NAME} ${QUAZIP_LIBRARIES}) package_libraries_for_deployment() +if (APPLE) + add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM}) + + # make sure the output name for the .app bundle is correct + # Fix up the rpath so macdeployqt works + set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@executable_path/../Frameworks") + + # call the fixup_nitpick macro to add required bundling commands for installation + fixup_nitpick() +endif () + if (WIN32) add_paths_to_fixup_libs (${QUAZIP_DLL_PATH})