2020-10-07 10:36:04 +00:00
|
|
|
if(APPLE OR (WIN32 AND NOT STATIC))
|
|
|
|
add_custom_target(deploy)
|
|
|
|
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
|
|
|
|
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
|
|
|
|
|
|
|
|
if(APPLE AND NOT IOS)
|
|
|
|
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
|
|
|
|
add_custom_command(TARGET deploy
|
|
|
|
POST_BUILD
|
2021-02-22 06:51:09 +00:00
|
|
|
COMMAND "${MACDEPLOYQT_EXECUTABLE}" "$<TARGET_FILE_DIR:wowlet>/../.." -always-overwrite
|
2020-10-07 10:36:04 +00:00
|
|
|
COMMENT "Running macdeployqt..."
|
|
|
|
)
|
|
|
|
|
|
|
|
# workaround for a Qt bug that requires manually adding libqsvg.dylib to bundle
|
|
|
|
find_file(_qt_svg_dylib "libqsvg.dylib" PATHS "${CMAKE_PREFIX_PATH}/plugins/imageformats" NO_DEFAULT_PATH)
|
|
|
|
if(_qt_svg_dylib)
|
|
|
|
add_custom_command(TARGET deploy
|
|
|
|
POST_BUILD
|
2021-02-22 06:51:09 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${_qt_svg_dylib} $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/
|
|
|
|
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/libqsvg.dylib
|
|
|
|
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/libqsvg.dylib
|
|
|
|
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/libqsvg.dylib
|
|
|
|
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/libqsvg.dylib
|
2020-10-07 10:36:04 +00:00
|
|
|
COMMENT "Copying libqsvg.dylib, running install_name_tool"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|