diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/cmake/deploy.cmake | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/utils/cmake/deploy.cmake b/utils/cmake/deploy.cmake index 8b1c837bcd..8ef82e71ca 100644 --- a/utils/cmake/deploy.cmake +++ b/utils/cmake/deploy.cmake | |||
@@ -25,27 +25,30 @@ endif() | |||
25 | 25 | ||
26 | # Linux: Build AppImage | 26 | # Linux: Build AppImage |
27 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | 27 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
28 | set(LINUXDEPLOY ${CMAKE_CURRENT_BINARY_DIR}/linuxdeploy-x86_64.AppImage) | ||
29 | add_custom_command( | ||
30 | OUTPUT ${LINUXDEPLOY} | ||
31 | COMMAND ${CMAKE_COMMAND} | ||
32 | -DOUTDIR=${CMAKE_CURRENT_BINARY_DIR} | ||
33 | -DURL=https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | ||
34 | -P ${CMAKE_CURRENT_LIST_DIR}/download.cmake | ||
35 | COMMAND ${CMAKE_COMMAND} | ||
36 | -DOUTDIR=${CMAKE_CURRENT_BINARY_DIR} | ||
37 | -DURL=https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage | ||
38 | -P ${CMAKE_CURRENT_LIST_DIR}/download.cmake | ||
39 | ) | ||
40 | |||
41 | function(deploy_qt target qtbindir iconfile desktopfile dmgbuildcfg) | 28 | function(deploy_qt target qtbindir iconfile desktopfile dmgbuildcfg) |
42 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | 29 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") |
43 | message(WARNING "Deploying a Debug build.") | 30 | message(WARNING "Deploying a Debug build.") |
44 | endif() | 31 | endif() |
32 | |||
33 | set(LINUXDEPLOY ${CMAKE_BINARY_DIR}/linuxdeploy-x86_64.AppImage) | ||
34 | set(LINUXDEPLOYQT ${CMAKE_BINARY_DIR}/linuxdeploy-plugin-qt-x86_64.AppImage) | ||
35 | add_custom_command( | ||
36 | COMMENT "Downloading linuxdeploy" | ||
37 | OUTPUT ${LINUXDEPLOY} | ||
38 | OUTPUT ${LINUXDEPLOYQT} | ||
39 | COMMAND ${CMAKE_COMMAND} | ||
40 | -DOUTDIR=${CMAKE_BINARY_DIR} | ||
41 | -DURL=https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | ||
42 | -P ${CMAKE_SOURCE_DIR}/cmake/download.cmake | ||
43 | COMMAND ${CMAKE_COMMAND} | ||
44 | -DOUTDIR=${CMAKE_BINARY_DIR} | ||
45 | -DURL=https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage | ||
46 | -P ${CMAKE_SOURCE_DIR}/cmake/download.cmake | ||
47 | ) | ||
45 | add_custom_command( | 48 | add_custom_command( |
46 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.AppImage | 49 | OUTPUT ${CMAKE_BINARY_DIR}/${target}.AppImage |
47 | COMMENT "Creating AppImage ${target}" | 50 | COMMENT "Creating AppImage ${target}" |
48 | COMMAND OUTPUT=${CMAKE_CURRENT_BINARY_DIR}/${target}.AppImage | 51 | COMMAND OUTPUT=${CMAKE_BINARY_DIR}/${target}.AppImage |
49 | ${LINUXDEPLOY} | 52 | ${LINUXDEPLOY} |
50 | --icon-file=${iconfile} | 53 | --icon-file=${iconfile} |
51 | --desktop-file=${desktopfile} | 54 | --desktop-file=${desktopfile} |
@@ -57,7 +60,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
57 | ${LINUXDEPLOY} | 60 | ${LINUXDEPLOY} |
58 | ) | 61 | ) |
59 | add_custom_target(deploy_${target} | 62 | add_custom_target(deploy_${target} |
60 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}.AppImage) | 63 | DEPENDS ${CMAKE_BINARY_DIR}/${target}.AppImage) |
61 | add_dependencies(deploy deploy_${target}) | 64 | add_dependencies(deploy deploy_${target}) |
62 | endfunction() | 65 | endfunction() |
63 | endif() | 66 | endif() |
@@ -68,29 +71,29 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") | |||
68 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | 71 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") |
69 | message(WARNING "Deploying a Debug build.") | 72 | message(WARNING "Deploying a Debug build.") |
70 | endif() | 73 | endif() |
71 | set(DMGBUILD ${CMAKE_CURRENT_BINARY_DIR}/venv/bin/dmgbuild) | 74 | set(DMGBUILD ${CMAKE_BINARY_DIR}/venv/bin/dmgbuild) |
72 | find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${qtbindir}") | 75 | find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${qtbindir}") |
73 | 76 | ||
74 | add_custom_command( | 77 | add_custom_command( |
75 | COMMENT "Setting up dmgbuild virtualenv" | 78 | COMMENT "Setting up dmgbuild virtualenv" |
76 | OUTPUT ${DMGBUILD} | 79 | OUTPUT ${DMGBUILD} |
77 | COMMAND python3 -m venv ${CMAKE_CURRENT_BINARY_DIR}/venv | 80 | COMMAND python3 -m venv ${CMAKE_BINARY_DIR}/venv |
78 | COMMAND ${CMAKE_CURRENT_BINARY_DIR}/venv/bin/python -m pip install -q dmgbuild biplist | 81 | COMMAND ${CMAKE_BINARY_DIR}/venv/bin/python -m pip install -q dmgbuild biplist |
79 | ) | 82 | ) |
80 | 83 | ||
81 | add_custom_command( | 84 | add_custom_command( |
82 | # TODO: find a better way to figure the app bundle name. | 85 | # TODO: find a better way to figure the app bundle name. |
83 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.dmg | 86 | OUTPUT ${CMAKE_BINARY_DIR}/${target}.dmg |
84 | COMMENT "Running macdeployqt and creating dmg ${target}" | 87 | COMMENT "Running macdeployqt and creating dmg ${target}" |
85 | COMMAND ${MACDEPLOYQT_EXECUTABLE} ${target}.app | 88 | COMMAND ${MACDEPLOYQT_EXECUTABLE} ${target}.app |
86 | COMMAND ${DMGBUILD} -s ${dmgbuildcfg} | 89 | COMMAND ${DMGBUILD} -s ${dmgbuildcfg} |
87 | -Dappbundle=${target}.app | 90 | -Dappbundle=${target}.app |
88 | ${target} ${CMAKE_CURRENT_BINARY_DIR}/${target}.dmg | 91 | ${target} ${CMAKE_BINARY_DIR}/${target}.dmg |
89 | DEPENDS ${target} | 92 | DEPENDS ${target} |
90 | ${DMGBUILD} | 93 | ${DMGBUILD} |
91 | ) | 94 | ) |
92 | add_custom_target(deploy_${target} | 95 | add_custom_target(deploy_${target} |
93 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}.dmg) | 96 | DEPENDS ${CMAKE_BINARY_DIR}/${target}.dmg) |
94 | add_dependencies(deploy deploy_${target}) | 97 | add_dependencies(deploy deploy_${target}) |
95 | endfunction() | 98 | endfunction() |
96 | endif() | 99 | endif() |
@@ -103,7 +106,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") | |||
103 | endif() | 106 | endif() |
104 | set(_targetfile ${target}.exe) # TODO: Use property. OUTPUT_NAME seems to fail. | 107 | set(_targetfile ${target}.exe) # TODO: Use property. OUTPUT_NAME seems to fail. |
105 | find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${qtbindir}") | 108 | find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${qtbindir}") |
106 | set(deploydir ${CMAKE_CURRENT_BINARY_DIR}/deploy-${target}) | 109 | set(deploydir ${CMAKE_BINARY_DIR}/deploy-${target}) |
107 | if(WINDEPLOYQT_EXECUTABLE) | 110 | if(WINDEPLOYQT_EXECUTABLE) |
108 | add_custom_command( | 111 | add_custom_command( |
109 | COMMENT "Creating deploy folder and running windeployqt" | 112 | COMMENT "Creating deploy folder and running windeployqt" |
@@ -126,15 +129,15 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") | |||
126 | endif() | 129 | endif() |
127 | add_custom_command( | 130 | add_custom_command( |
128 | COMMENT "Compressing to zip" | 131 | COMMENT "Compressing to zip" |
129 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.zip | 132 | OUTPUT ${CMAKE_BINARY_DIR}/${target}.zip |
130 | WORKING_DIRECTORY ${deploydir} | 133 | WORKING_DIRECTORY ${deploydir} |
131 | COMMAND ${CMAKE_COMMAND} -E tar c ${CMAKE_CURRENT_BINARY_DIR}/${target}.zip | 134 | COMMAND ${CMAKE_COMMAND} -E tar c ${CMAKE_BINARY_DIR}/${target}.zip |
132 | --format=zip . | 135 | --format=zip . |
133 | DEPENDS ${deploydir}/${_targetfile} | 136 | DEPENDS ${deploydir}/${_targetfile} |
134 | ) | 137 | ) |
135 | 138 | ||
136 | add_custom_target(deploy_${target} | 139 | add_custom_target(deploy_${target} |
137 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}.zip) | 140 | DEPENDS ${CMAKE_BINARY_DIR}/${target}.zip) |
138 | add_dependencies(deploy deploy_${target}) | 141 | add_dependencies(deploy deploy_${target}) |
139 | endfunction() | 142 | endfunction() |
140 | endif() | 143 | endif() |