From 5260b71abe3e35ea227897ec5ecc1d1d98dc64a2 Mon Sep 17 00:00:00 2001 From: coco875 Date: Wed, 11 Dec 2024 15:45:53 +0100 Subject: [PATCH] fix macos --- CMakeLists.txt | 20 ++++++++++++++++ Info.plist | 42 +++++++++++++++++++++++++++++++++ cmake/configure-packaging.cmake | 2 +- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 Info.plist diff --git a/CMakeLists.txt b/CMakeLists.txt index b922be65..494f8b4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -557,6 +557,26 @@ add_custom_target( COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/starship.otr" "${CMAKE_BINARY_DIR}/starship.otr" ) +if(CMAKE_SYSTEM_NAME MATCHES "Darwin") +add_custom_target(CreateOSXIcons + COMMAND mkdir -p ${CMAKE_BINARY_DIR}/macosx/starship.iconset + COMMAND sips -z 16 16 logo.png --out ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_16x16.png + COMMAND sips -z 32 32 logo.png --out ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_16x16@2x.png + COMMAND sips -z 32 32 logo.png --out ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_32x32.png + COMMAND sips -z 64 64 logo.png --out ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_32x32@2x.png + COMMAND sips -z 128 128 logo.png --out ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_128x128.png + COMMAND sips -z 256 256 logo.png --out ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_128x128@2x.png + COMMAND sips -z 256 256 logo.png --out ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_256x256.png + COMMAND sips -z 512 512 logo.png --out ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_256x256@2x.png + COMMAND sips -z 512 512 logo.png --out ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_512x512.png + COMMAND cp logo.png ${CMAKE_BINARY_DIR}/macosx/starship.iconset/icon_512x512@2x.png + COMMAND iconutil -c icns -o ${CMAKE_BINARY_DIR}/macosx/starship.icns ${CMAKE_BINARY_DIR}/macosx/starship.iconset + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Creating OSX icons ..." + ) + add_dependencies(${PROJECT_NAME} CreateOSXIcons) +endif() + set_property(TARGET ${PROJECT_NAME} PROPERTY APPIMAGE_DESKTOP_FILE_TERMINAL YES) set_property(TARGET ${PROJECT_NAME} PROPERTY APPIMAGE_DESKTOP_FILE "${CMAKE_SOURCE_DIR}/Starship.desktop") set_property(TARGET ${PROJECT_NAME} PROPERTY APPIMAGE_ICON_FILE "${CMAKE_SOURCE_DIR}/logo.png") diff --git a/Info.plist b/Info.plist new file mode 100644 index 00000000..39fb6bc1 --- /dev/null +++ b/Info.plist @@ -0,0 +1,42 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleName + Starship + CFBundleExecutable + Starship + CFBundleGetInfoString + 0.1.0 + CFBundleIconFile + Starship.icns + CFBundleIdentifier + com.Starship.Starship + CFBundleDocumentTypes + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + 0.1.0 + CFBundleSignature + ZMM + CFBundleVersion + 0.1.0 + NSHumanReadableCopyright + Copyright 2024 HarbourMasters. + LSApplicationCategoryType + public.app-category.games + LSMinimumSystemVersion + 10.15 + LSArchitecturePriority + + arm64 + x86_64 + + + \ No newline at end of file diff --git a/cmake/configure-packaging.cmake b/cmake/configure-packaging.cmake index 8d6869bd..f3d2c115 100644 --- a/cmake/configure-packaging.cmake +++ b/cmake/configure-packaging.cmake @@ -24,6 +24,6 @@ if (CPACK_GENERATOR MATCHES "Bundle") set(CPACK_BUNDLE_NAME "Starship") set(CPACK_BUNDLE_PLIST "macosx/Info.plist") set(CPACK_BUNDLE_ICON "macosx/Starship.icns") - set(CPACK_BUNDLE_STARTUP_COMMAND "macosx/Starship-macos.sh") + # set(CPACK_BUNDLE_STARTUP_COMMAND "macosx/Starship-macos.sh") set(CPACK_BUNDLE_APPLE_CERT_APP "-") endif() \ No newline at end of file