Update make dmg for Qt 6

This commit is contained in:
Jonas Kvinge 2020-12-24 15:24:48 +01:00
parent fa0fd6b7d0
commit b58a7c32c2
2 changed files with 36 additions and 16 deletions

View File

@ -26,9 +26,6 @@ if(LINUX)
include(cmake/Rpm.cmake) include(cmake/Rpm.cmake)
include(cmake/Deb.cmake) include(cmake/Deb.cmake)
endif() endif()
if(APPLE)
include(cmake/Dmg.cmake)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
@ -417,6 +414,12 @@ if(NOT CMAKE_CROSSCOMPILING)
) )
endif() endif()
# make dmg
# This needs to be included after the major Qt version is set.
if(APPLE)
include(cmake/Dmg.cmake)
endif()
# Set up definitions # Set up definitions
add_definitions(-DBOOST_BIND_NO_PLACEHOLDERS) add_definitions(-DBOOST_BIND_NO_PLACEHOLDERS)

View File

@ -1,15 +1,32 @@
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macversion.sh OUTPUT_VARIABLE MACOS_VERSION_PACKAGE OUTPUT_STRIP_TRAILING_WHITESPACE) if(BUILD_WITH_QT6)
set(MACDEPLOYQT_PATHS "/usr/local/opt/qt6/bin")
elseif(BUILD_WITH_QT5)
set(MACDEPLOYQT_PATHS "/usr/local/opt/qt5/bin")
else()
message(FATAL_ERROR "BUILD_WITH_QT6 or BUILD_WITH_QT5 must be set.")
endif()
add_custom_target(dmg find_program(MACDEPLOYQT_EXECUTABLE NAMES macdeployqt PATHS ${MACDEPLOYQT_PATHS} NO_DEFAULT_PATH)
COMMAND /usr/local/opt/qt5/bin/macdeployqt strawberry.app if(NOT MACDEPLOYQT_EXECUTABLE)
message(WARNING "Missing macdeployqt executable.")
endif()
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macversion.sh OUTPUT_VARIABLE MACOS_VERSION_PACKAGE OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT MACOS_VERSION_PACKAGE)
message(WARNING "Could not set macOS version.")
endif()
if(MACDEPLOYQT_EXECUTABLE AND MACOS_VERSION_PACKAGE)
add_custom_target(dmg
COMMAND ${MACDEPLOYQT_EXECUTABLE} strawberry.app
COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macdeploy.py strawberry.app COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macdeploy.py strawberry.app
COMMAND create-dmg --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 strawberry-${STRAWBERRY_VERSION_PACKAGE}-${MACOS_VERSION_PACKAGE}.dmg strawberry.app COMMAND create-dmg --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 strawberry-${STRAWBERRY_VERSION_PACKAGE}-${MACOS_VERSION_PACKAGE}.dmg strawberry.app
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
add_custom_target(dmg2
add_custom_target(dmg2 COMMAND ${MACDEPLOYQT_EXECUTABLE} strawberry.app
COMMAND /usr/local/opt/qt5/bin/macdeployqt strawberry.app
COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macdeploy.py strawberry.app COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macdeploy.py strawberry.app
COMMAND create-dmg --skip-jenkins --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 strawberry-${STRAWBERRY_VERSION_PACKAGE}-${MACOS_VERSION_PACKAGE}.dmg strawberry.app COMMAND create-dmg --skip-jenkins --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 strawberry-${STRAWBERRY_VERSION_PACKAGE}-${MACOS_VERSION_PACKAGE}.dmg strawberry.app
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
endif()