build: use CPack for macOS to create dmg
This commit is contained in:
4
.github/workflows/continuous-integration.yml
vendored
4
.github/workflows/continuous-integration.yml
vendored
@ -218,7 +218,7 @@ jobs:
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "$RUNNER_OS" == "Linux" && "${{matrix.target.like}}" != "arch" ]]; then
|
||||
if [[ "$RUNNER_OS" != "Windows" && "${{matrix.target.like}}" != "arch" ]]; then
|
||||
cmake --build build -j8 --target package
|
||||
else
|
||||
cmake --build build -j8
|
||||
@ -243,7 +243,7 @@ jobs:
|
||||
|
||||
|
||||
- name: Package
|
||||
if: ${{ runner.os != 'Linux' }}
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
shell: bash
|
||||
run: |
|
||||
python ./scripts/package.py --package-version ${{env.DESKFLOW_PACKAGE_VERSION}}
|
||||
|
||||
@ -85,10 +85,12 @@ include(GNUInstallDirs)
|
||||
configure_definitions()
|
||||
configure_build()
|
||||
configure_libs()
|
||||
configure_packaging()
|
||||
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(deploy)
|
||||
|
||||
option(BUILD_INSTALLER "Build installer" ON)
|
||||
if(BUILD_INSTALLER)
|
||||
add_subdirectory(deploy)
|
||||
endif()
|
||||
post_config_all()
|
||||
|
||||
@ -66,7 +66,6 @@ endmacro()
|
||||
macro(configure_options)
|
||||
|
||||
set(DEFAULT_BUILD_GUI ON)
|
||||
set(DEFAULT_BUILD_INSTALLER ON)
|
||||
set(DEFAULT_BUILD_TESTS ON)
|
||||
|
||||
# unified binary is off by default for now, for backwards compatibility.
|
||||
@ -93,7 +92,6 @@ macro(configure_options)
|
||||
endif()
|
||||
|
||||
option(BUILD_GUI "Build GUI" ${DEFAULT_BUILD_GUI})
|
||||
option(BUILD_INSTALLER "Build installer" ${DEFAULT_BUILD_INSTALLER})
|
||||
option(BUILD_TESTS "Build tests" ${DEFAULT_BUILD_TESTS})
|
||||
option(BUILD_UNIFIED "Build unified binary" ${DEFAULT_BUILD_UNIFIED})
|
||||
option(ENABLE_COVERAGE "Enable test coverage" ${DEFAULT_ENABLE_COVERAGE})
|
||||
|
||||
@ -3,50 +3,6 @@
|
||||
# SPDX-FileCopyrightText: (C) 2009 - 2012 Nick Bolton
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
|
||||
#
|
||||
# If enabled, configure packaging based on OS.
|
||||
#
|
||||
macro(configure_packaging)
|
||||
|
||||
message(VERBOSE "Configuring Packaging")
|
||||
set(DESKFLOW_PROJECT_RES_DIR ${PROJECT_SOURCE_DIR}/res)
|
||||
|
||||
if(${BUILD_INSTALLER})
|
||||
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(CPACK_PACKAGE_CONTACT "Deskflow <maintainers@deskflow.org>")
|
||||
set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
|
||||
set(CPACK_PACKAGE_VENDOR "Deskflow")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE)
|
||||
|
||||
set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
|
||||
|
||||
#Prevent this override from being written in the package
|
||||
if(NOT PACKAGE_VERSION_LABEL)
|
||||
set (PACKAGE_VERSION_LABEL "${CPACK_PACKAGE_VERSION}")
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
configure_windows_packaging()
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(OS_STRING "macos-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
configure_linux_packaging()
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "|.*BSD")
|
||||
message(STATUS "BSD packaging not yet supported")
|
||||
set(OS_STRING ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PACKAGE_VERSION_LABEL}-${OS_STRING}")
|
||||
message(STATUS "Package Basename: ${CPACK_PACKAGE_FILE_NAME}")
|
||||
|
||||
include(CPack)
|
||||
else()
|
||||
message(STATUS "Not configuring installer")
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# Windows installer
|
||||
#
|
||||
|
||||
@ -37,5 +37,41 @@ elseif(NOT APPLE)
|
||||
${CMAKE_BINARY_DIR}/PKGBUILD
|
||||
@ONLY
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
# Generic Package Items
|
||||
set(CPACK_STRIP_FILES TRUE)
|
||||
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(CPACK_PACKAGE_CONTACT "Deskflow <maintainers@deskflow.org>")
|
||||
set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
|
||||
set(CPACK_PACKAGE_VENDOR "Deskflow")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE)
|
||||
|
||||
set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
|
||||
|
||||
#Prevent this override from being written in the package
|
||||
if(NOT PACKAGE_VERSION_LABEL)
|
||||
set (PACKAGE_VERSION_LABEL "${CPACK_PACKAGE_VERSION}")
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
configure_windows_packaging()
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(OS_STRING "macos-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CMAKE_INSTALL_RPATH "@loader_path/../Libraries;@loader_path/../Frameworks")
|
||||
set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/deploy/dmg-volume.icns")
|
||||
set(CPACK_DMG_BACKGROUND_IMAGE "${PROJECT_SOURCE_DIR}/deploy/dmg-background.tiff")
|
||||
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${PROJECT_SOURCE_DIR}/deploy/generate_ds_store.applescript")
|
||||
set(CPACK_DMG_VOLUME_NAME "Deskflow")
|
||||
set(CPACK_GENERATOR "DragNDrop")
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
configure_linux_packaging()
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "|.*BSD")
|
||||
message(STATUS "BSD packaging not yet supported")
|
||||
set(OS_STRING ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PACKAGE_VERSION_LABEL}-${OS_STRING}")
|
||||
message(STATUS "Package Basename: ${CPACK_PACKAGE_FILE_NAME}")
|
||||
|
||||
include(CPack)
|
||||
|
||||
69
deploy/dist/mac/dmgbuild/settings.py
vendored
69
deploy/dist/mac/dmgbuild/settings.py
vendored
@ -1,69 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Example: https://dmgbuild.readthedocs.io/en/latest/example.html
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os.path
|
||||
|
||||
app = defines.get("app")
|
||||
app_basename = os.path.basename(app)
|
||||
format = defines.get("format", "UDBZ")
|
||||
size = defines.get("size", None)
|
||||
files = [app]
|
||||
symlinks = {"Applications": "/Applications"}
|
||||
icon = os.path.join(app, "Contents/Resources/dmg-volume.icns")
|
||||
icon_locations = {
|
||||
app_basename: (144, 190),
|
||||
"Applications": (455, 190),
|
||||
}
|
||||
background = os.path.join(app, "Contents/Resources/dmg-background.tiff")
|
||||
show_status_bar = False
|
||||
show_tab_view = False
|
||||
show_toolbar = False
|
||||
show_pathbar = False
|
||||
show_sidebar = False
|
||||
sidebar_width = 180
|
||||
window_rect = ((200, 120), (620, 420))
|
||||
default_view = "icon-view"
|
||||
show_icon_preview = False
|
||||
include_icon_view_settings = "auto"
|
||||
include_list_view_settings = "auto"
|
||||
arrange_by = None
|
||||
grid_offset = (0, 0)
|
||||
grid_spacing = 100
|
||||
scroll_position = (0, 0)
|
||||
label_pos = "bottom"
|
||||
text_size = 16
|
||||
icon_size = 100
|
||||
list_icon_size = 16
|
||||
list_text_size = 12
|
||||
list_scroll_position = (0, 0)
|
||||
list_sort_by = "name"
|
||||
list_use_relative_dates = True
|
||||
list_calculate_all_sizes = (False,)
|
||||
list_columns = ("name", "date-modified", "size", "kind", "date-added")
|
||||
list_column_widths = {
|
||||
"name": 300,
|
||||
"date-modified": 181,
|
||||
"date-created": 181,
|
||||
"date-added": 181,
|
||||
"date-last-opened": 181,
|
||||
"size": 97,
|
||||
"kind": 115,
|
||||
"label": 100,
|
||||
"version": 75,
|
||||
"comments": 300,
|
||||
}
|
||||
list_column_sort_directions = {
|
||||
"name": "ascending",
|
||||
"date-modified": "descending",
|
||||
"date-created": "descending",
|
||||
"date-added": "descending",
|
||||
"date-last-opened": "descending",
|
||||
"size": "descending",
|
||||
"kind": "ascending",
|
||||
"label": "ascending",
|
||||
"version": "ascending",
|
||||
"comments": "ascending",
|
||||
}
|
||||
45
deploy/generate_ds_store.applescript
Normal file
45
deploy/generate_ds_store.applescript
Normal file
@ -0,0 +1,45 @@
|
||||
on run argv
|
||||
set image_name to item 1 of argv
|
||||
|
||||
tell application "Finder"
|
||||
tell disk image_name
|
||||
|
||||
-- wait for the image to finish mounting
|
||||
set open_attempts to 0
|
||||
repeat while open_attempts < 5
|
||||
try
|
||||
open
|
||||
delay 1
|
||||
set open_attempts to 5
|
||||
close
|
||||
on error errStr number errorNumber
|
||||
set open_attempts to open_attempts + 1
|
||||
delay 10
|
||||
end try
|
||||
end repeat
|
||||
|
||||
-- open the image the first time and save a DS_Store with just
|
||||
-- background and icon setup
|
||||
open
|
||||
set current view of container window to icon view
|
||||
set theViewOptions to the icon view options of container window
|
||||
set background picture of theViewOptions to file ".background:background.tiff"
|
||||
set arrangement of theViewOptions to not arranged
|
||||
set icon size of theViewOptions to 100
|
||||
set text size of theViewOptions to 16
|
||||
close
|
||||
|
||||
open
|
||||
tell container window
|
||||
set sidebar width to 0
|
||||
set statusbar visible to false
|
||||
set toolbar visible to false
|
||||
set pathbar visible to false
|
||||
set the bounds to { 200, 120, 800, 520 }
|
||||
set position of item "Deskflow.app" to { 144, 190 }
|
||||
set position of item "Applications" to { 455, 190 }
|
||||
end tell
|
||||
close
|
||||
end tell
|
||||
end tell
|
||||
end run
|
||||
@ -39,8 +39,7 @@ file(GLOB ui_files src/*.ui src/dialogs/*.ui)
|
||||
if(WIN32)
|
||||
set(platform_extra src/deskflow.rc ${PROJECT_BINARY_DIR}/src/version.rc)
|
||||
elseif(APPLE)
|
||||
set(platform_extra src/Deskflow.icns
|
||||
${PROJECT_SOURCE_DIR}/deploy/dmg-volume.icns ${PROJECT_SOURCE_DIR}/deploy/dmg-background.tiff)
|
||||
set(platform_extra src/Deskflow.icns)
|
||||
set_source_files_properties(${platform_extra} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user