build: use cmake to make the macOS bundle
This commit is contained in:
@ -29,7 +29,7 @@ macro(configure_packaging)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
configure_windows_packaging()
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
configure_mac_packaging()
|
||||
set(OS_STRING "macos-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
configure_linux_packaging()
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "|.*BSD")
|
||||
@ -75,25 +75,6 @@ macro(configure_windows_packaging)
|
||||
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# macOS app bundle
|
||||
#
|
||||
macro(configure_mac_packaging)
|
||||
|
||||
set(CMAKE_INSTALL_RPATH
|
||||
"@loader_path/../Libraries;@loader_path/../Frameworks")
|
||||
set(DESKFLOW_BUNDLE_SOURCE_DIR
|
||||
${PROJECT_SOURCE_DIR}/deploy/dist/mac/bundle
|
||||
CACHE PATH "Path to the macOS app bundle")
|
||||
set(DESKFLOW_BUNDLE_DIR ${PROJECT_BINARY_DIR}/bundle/Deskflow.app)
|
||||
set(DESKFLOW_BUNDLE_BINARY_DIR ${DESKFLOW_BUNDLE_DIR}/Contents/MacOS)
|
||||
|
||||
configure_files(${DESKFLOW_BUNDLE_SOURCE_DIR} ${DESKFLOW_BUNDLE_DIR})
|
||||
|
||||
set(OS_STRING "macos-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# Linux packages
|
||||
#
|
||||
|
||||
31
deploy/dist/mac/bundle/Contents/Info.plist.in
vendored
31
deploy/dist/mac/bundle/Contents/Info.plist.in
vendored
@ -1,31 +0,0 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Deskflow</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>deskflow</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>Deskflow.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.deskflow.deskflow</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Deskflow</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>DFLW</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@DESKFLOW_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@DESKFLOW_VERSION@</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>© 2024 Deskflow Developers</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.9.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
1
deploy/dist/mac/bundle/Contents/PkgInfo.in
vendored
1
deploy/dist/mac/bundle/Contents/PkgInfo.in
vendored
@ -1 +0,0 @@
|
||||
APPLDFLW
|
||||
4
deploy/dist/mac/dmgbuild/settings.py
vendored
4
deploy/dist/mac/dmgbuild/settings.py
vendored
@ -12,12 +12,12 @@ format = defines.get("format", "UDBZ")
|
||||
size = defines.get("size", None)
|
||||
files = [app]
|
||||
symlinks = {"Applications": "/Applications"}
|
||||
icon = os.path.join(app, "Contents/Resources/Volume.icns")
|
||||
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/Background.tiff")
|
||||
background = os.path.join(app, "Contents/Resources/dmg-background.tiff")
|
||||
show_status_bar = False
|
||||
show_tab_view = False
|
||||
show_toolbar = False
|
||||
|
||||
@ -78,7 +78,7 @@ def package(filename_base, source_dir, build_dir, dist_dir, product_name):
|
||||
)
|
||||
|
||||
bundle_source_dir = os.path.join(
|
||||
build_dir, os.path.join("bundle", product_name + ".app")
|
||||
build_dir, os.path.join("bin", product_name + ".app")
|
||||
)
|
||||
build_bundle(bundle_source_dir)
|
||||
|
||||
@ -139,8 +139,8 @@ def build_bundle(bundle_source_dir):
|
||||
|
||||
print("Building bundle...")
|
||||
|
||||
# cmake build install target should run macdeployqt
|
||||
cmd_utils.run("cmake --build build --target install", shell=True, print_cmd=True)
|
||||
# cmake build target should run macdeployqt
|
||||
cmd_utils.run("cmake --build build ", shell=True, print_cmd=True)
|
||||
|
||||
|
||||
def sign_bundle(bundle_source_dir, codesign_id):
|
||||
|
||||
@ -60,7 +60,7 @@ target_link_libraries(
|
||||
${libs})
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
install(TARGETS ${target} DESTINATION ${DESKFLOW_BUNDLE_BINARY_DIR})
|
||||
set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY $<TARGET_BUNDLE_CONTENT_DIR:Deskflow>/MacOS)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
install(TARGETS ${target} DESTINATION bin)
|
||||
endif()
|
||||
|
||||
@ -60,7 +60,7 @@ target_link_libraries(
|
||||
${libs})
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
install(TARGETS ${target} DESTINATION ${DESKFLOW_BUNDLE_BINARY_DIR})
|
||||
set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY $<TARGET_BUNDLE_CONTENT_DIR:Deskflow>/MacOS)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
install(TARGETS ${target} DESTINATION bin)
|
||||
endif()
|
||||
|
||||
@ -13,7 +13,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(target deskflow)
|
||||
if(APPLE)
|
||||
set(target Deskflow)
|
||||
else()
|
||||
set(target deskflow)
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
@ -33,7 +37,11 @@ file(
|
||||
file(GLOB ui_files src/*.ui src/dialogs/*.ui)
|
||||
|
||||
if(WIN32)
|
||||
set(rc_files src/deskflow.rc ${PROJECT_BINARY_DIR}/src/version.rc)
|
||||
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_source_files_properties(${platform_extra} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
endif()
|
||||
|
||||
# regular exe headers
|
||||
@ -46,7 +54,7 @@ include_directories(${PROJECT_BINARY_DIR}/src/lib/gui/gui_autogen/include)
|
||||
# generated includes
|
||||
include_directories(${PROJECT_BINARY_DIR}/config)
|
||||
|
||||
add_executable(${target} WIN32 ${sources} ${ui_files} ${rc_files})
|
||||
add_executable(${target} WIN32 MACOSX_BUNDLE ${sources} ${ui_files} ${platform_extra})
|
||||
|
||||
target_link_libraries(
|
||||
${target}
|
||||
@ -63,21 +71,27 @@ target_compile_definitions(${target}
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT")
|
||||
elseif(APPLE)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "Deskflow"
|
||||
MACOSX_BUNDLE_DISPLAY_NAME "Deskflow"
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "org.deskflow.deskflow"
|
||||
MACOSX_BUNDLE_ICON_FILE Deskflow.icns
|
||||
MACOSX_BUNDLE_INFO_STRING "${CMAKE_PROJECT_DESCRIPTION}"
|
||||
MACOSX_BUNDLE_COPYRIGHT "© 2024 Deskflow Developers"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${DESKFLOW_VERSION}
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING ${DESKFLOW_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${DESKFLOW_VERSION}
|
||||
)
|
||||
find_program(MACDEPLOYQT_BIN macdeployqt6)
|
||||
add_custom_command(
|
||||
TARGET ${target} POST_BUILD
|
||||
COMMAND ${MACDEPLOYQT_BIN} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target}.app"
|
||||
)
|
||||
install(TARGETS ${target} BUNDLE DESTINATION .)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
||||
find_program(MACDEPLOYQT_BIN macdeployqt6)
|
||||
message(STATUS "Found macdeployqt6: ${MACDEPLOYQT_BIN}")
|
||||
|
||||
set(MACDEPLOYQT_CMD
|
||||
"${MACDEPLOYQT_BIN} ${DESKFLOW_BUNDLE_DIR} -always-overwrite")
|
||||
|
||||
install(TARGETS ${target} DESTINATION ${DESKFLOW_BUNDLE_BINARY_DIR})
|
||||
install(CODE "MESSAGE (\"Running: ${MACDEPLOYQT_CMD}\")")
|
||||
install(CODE "execute_process(COMMAND ${MACDEPLOYQT_CMD})")
|
||||
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
install(TARGETS ${target} DESTINATION bin)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user