diff --git a/cmake/macros/FixupNitpick.cmake b/cmake/macros/FixupNitpick.cmake index 97ad313000..6fcb9b3c7c 100644 --- a/cmake/macros/FixupNitpick.cmake +++ b/cmake/macros/FixupNitpick.cmake @@ -10,27 +10,22 @@ # 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") + 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) + find_program(MACDEPLOYQT_COMMAND macdeployqt PATHS "${QT_DIR}/bin" NO_DEFAULT_PATH) - if (NOT MACDEPLOYQT_COMMAND) - message(FATAL_ERROR "Could not find macdeployqt at ${QT_DIR}/bin.\ - It is required to produce a relocatable nitpick application.\ - Check that the variable QT_DIR points to your Qt installation.\ - ") + if (NOT MACDEPLOYQT_COMMAND) + message(FATAL_ERROR "Could not find macdeployqt at ${QT_DIR}/bin.\ + It is required to produce a relocatable nitpick application.\ + Check that the variable QT_DIR points to your Qt installation.\ + ") + endif () + + add_custom_command(TARGET ${TARGET_NAME} POST_BUILD + (COMMAND ${MACDEPLOYQT_COMMAND}\${CMAKE_INSTALL_PREFIX}/${_INTERFACE_INSTALL_PATH}/ -verbose=2 -qmldir=${CMAKE_SOURCE_DIR}/interface/resources/qml/ + ) 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/PackageLibrariesForDeployment.cmake b/cmake/macros/PackageLibrariesForDeployment.cmake index f6963f9d82..b3f725b2b0 100644 --- a/cmake/macros/PackageLibrariesForDeployment.cmake +++ b/cmake/macros/PackageLibrariesForDeployment.cmake @@ -10,77 +10,59 @@ # macro(PACKAGE_LIBRARIES_FOR_DEPLOYMENT) - if (WIN32) - configure_file( - ${HF_CMAKE_DIR}/templates/FixupBundlePostBuild.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake - @ONLY - ) + if (WIN32) + configure_file( + ${HF_CMAKE_DIR}/templates/FixupBundlePostBuild.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake + @ONLY + ) - set(PLUGIN_PATH "plugins") + set(PLUGIN_PATH "plugins") - # add a post-build command to copy DLLs beside the executable - add_custom_command( - TARGET ${TARGET_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - -DBUNDLE_EXECUTABLE="$" - -DBUNDLE_PLUGIN_DIR="$/${PLUGIN_PATH}" - -P "${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake" - ) + # add a post-build command to copy DLLs beside the executable + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + -DBUNDLE_EXECUTABLE="$" + -DBUNDLE_PLUGIN_DIR="$/${PLUGIN_PATH}" + -P "${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake" + ) - find_program(WINDEPLOYQT_COMMAND windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) + find_program(WINDEPLOYQT_COMMAND windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) - if (NOT WINDEPLOYQT_COMMAND) - message(FATAL_ERROR "Could not find windeployqt at ${QT_DIR}/bin. windeployqt is required.") - endif () - - # add a post-build command to call windeployqt to copy Qt plugins - add_custom_command( - TARGET ${TARGET_NAME} - POST_BUILD - COMMAND CMD /C "SET PATH=${QT_DIR}/bin;%PATH% && ${WINDEPLOYQT_COMMAND}\ - ${EXTRA_DEPLOY_OPTIONS} $<$,$,$>:--release>\ - --no-compiler-runtime --no-opengl-sw --no-angle -no-system-d3d-compiler \"$\"" - ) - - set(QTAUDIO_PATH "$/audio") - set(QTAUDIO_WIN7_PATH "$/audioWin7/audio") - set(QTAUDIO_WIN8_PATH "$/audioWin8/audio") - - # copy qtaudio_wasapi.dll and qtaudio_windows.dll in the correct directories for runtime selection - add_custom_command( - TARGET ${TARGET_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory "${QTAUDIO_WIN7_PATH}" - COMMAND ${CMAKE_COMMAND} -E make_directory "${QTAUDIO_WIN8_PATH}" - # copy release DLLs - COMMAND if exist "${QTAUDIO_PATH}/qtaudio_windows.dll" ( ${CMAKE_COMMAND} -E copy "${QTAUDIO_PATH}/qtaudio_windows.dll" "${QTAUDIO_WIN7_PATH}" ) - COMMAND if exist "${QTAUDIO_PATH}/qtaudio_windows.dll" ( ${CMAKE_COMMAND} -E copy "${WASAPI_DLL_PATH}/qtaudio_wasapi.dll" "${QTAUDIO_WIN8_PATH}" ) - # copy debug DLLs - COMMAND if exist "${QTAUDIO_PATH}/qtaudio_windowsd.dll" ( ${CMAKE_COMMAND} -E copy "${QTAUDIO_PATH}/qtaudio_windowsd.dll" "${QTAUDIO_WIN7_PATH}" ) - COMMAND if exist "${QTAUDIO_PATH}/qtaudio_windowsd.dll" ( ${CMAKE_COMMAND} -E copy "${WASAPI_DLL_PATH}/qtaudio_wasapid.dll" "${QTAUDIO_WIN8_PATH}" ) - # remove directory - COMMAND ${CMAKE_COMMAND} -E remove_directory "${QTAUDIO_PATH}" - ) - elseif (APPLE) - find_program(MACDEPLOYQT_COMMAND macdeployqt PATHS "${QT_DIR}/bin" NO_DEFAULT_PATH) - - if (NOT MACDEPLOYQT_COMMAND) - message(FATAL_ERROR "Could not find macdeployqt at ${QT_DIR}/bin. macdeployqt is required.") - endif () - - # add a post-build command to call macdeployqt to copy Qt plugins - add_custom_command(TARGET ${TARGET_NAME} POST_BUILD - (COMMAND ${MACDEPLOYQT_COMMAND}\${CMAKE_INSTALL_PREFIX}/${_INTERFACE_INSTALL_PATH}/ -verbose=2 -qmldir=${CMAKE_SOURCE_DIR}/interface/resources/qml/ - ) - - add_custom_command( - TARGET ${TARGET_NAME} - POST_BUILD - COMMAND CMD /C "SET PATH=${QT_DIR}/bin;%PATH% && ${WINDEPLOYQT_COMMAND}\ - ${EXTRA_DEPLOY_OPTIONS} $<$,$,$>:--release>\ - --no-compiler-runtime --no-opengl-sw --no-angle -no-system-d3d-compiler \"$\"" - ) + if (NOT WINDEPLOYQT_COMMAND) + message(FATAL_ERROR "Could not find windeployqt at ${QT_DIR}/bin. windeployqt is required.") endif () + + # add a post-build command to call windeployqt to copy Qt plugins + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND CMD /C "SET PATH=${QT_DIR}/bin;%PATH% && ${WINDEPLOYQT_COMMAND}\ + ${EXTRA_DEPLOY_OPTIONS} $<$,$,$>:--release>\ + --no-compiler-runtime --no-opengl-sw --no-angle -no-system-d3d-compiler \"$\"" + ) + + set(QTAUDIO_PATH "$/audio") + set(QTAUDIO_WIN7_PATH "$/audioWin7/audio") + set(QTAUDIO_WIN8_PATH "$/audioWin8/audio") + + # copy qtaudio_wasapi.dll and qtaudio_windows.dll in the correct directories for runtime selection + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "${QTAUDIO_WIN7_PATH}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${QTAUDIO_WIN8_PATH}" + # copy release DLLs + COMMAND if exist "${QTAUDIO_PATH}/qtaudio_windows.dll" ( ${CMAKE_COMMAND} -E copy "${QTAUDIO_PATH}/qtaudio_windows.dll" "${QTAUDIO_WIN7_PATH}" ) + COMMAND if exist "${QTAUDIO_PATH}/qtaudio_windows.dll" ( ${CMAKE_COMMAND} -E copy "${WASAPI_DLL_PATH}/qtaudio_wasapi.dll" "${QTAUDIO_WIN8_PATH}" ) + # copy debug DLLs + COMMAND if exist "${QTAUDIO_PATH}/qtaudio_windowsd.dll" ( ${CMAKE_COMMAND} -E copy "${QTAUDIO_PATH}/qtaudio_windowsd.dll" "${QTAUDIO_WIN7_PATH}" ) + COMMAND if exist "${QTAUDIO_PATH}/qtaudio_windowsd.dll" ( ${CMAKE_COMMAND} -E copy "${WASAPI_DLL_PATH}/qtaudio_wasapid.dll" "${QTAUDIO_WIN8_PATH}" ) + # remove directory + COMMAND ${CMAKE_COMMAND} -E remove_directory "${QTAUDIO_PATH}" + ) + + endif () endmacro()