Implement Mac App Store build support by introducing the BUILD_FOR_MAC_APP_STORE option. This change disables Sparkle and localhost OAuth redirect server for MAS builds, updates CMake configuration, and modifies build scripts accordingly. Additionally, the macOS bundle identifier is now configurable via CMake.

This commit is contained in:
2026-01-22 19:28:00 +09:00
parent 6a1d8bbc87
commit bd59c19301
11 changed files with 479 additions and 29 deletions

View File

@@ -6,6 +6,14 @@ if(APPLE)
enable_language(OBJC OBJCXX)
endif()
if(APPLE)
option(BUILD_FOR_MAC_APP_STORE "Build for Mac App Store (MAS): disables Sparkle + any localhost port-listener OAuth redirect server, and uses MAS-focused defaults." OFF)
else()
set(BUILD_FOR_MAC_APP_STORE OFF)
endif()
set(MACOS_BUNDLE_ID "com.dryark.strawberry" CACHE STRING "macOS bundle identifier (CFBundleIdentifier)")
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
@@ -32,18 +40,24 @@ if(LINUX)
endif()
if(APPLE)
# Find Sparkle early so cmake/Dmg.cmake (deploy target) can bundle it into the app.
# Sparkle is optional; if not found, update functionality is disabled.
find_library(SPARKLE Sparkle
PATHS
/Library/Frameworks
/System/Library/Frameworks
/opt/homebrew/Frameworks
/opt/homebrew/opt/sparkle-framework/Frameworks
/usr/local/Frameworks
/usr/local/opt/sparkle-framework/Frameworks
PATH_SUFFIXES Frameworks
)
if(BUILD_FOR_MAC_APP_STORE)
# MAS builds: Sparkle (and QtSparkle) must be disabled.
set(ENABLE_SPARKLE OFF CACHE BOOL "Sparkle integration" FORCE)
set(ENABLE_QTSPARKLE OFF CACHE BOOL "QtSparkle integration" FORCE)
else()
# Find Sparkle early so cmake/Dmg.cmake (deploy target) can bundle it into the app.
# Sparkle is optional; if not found, update functionality is disabled.
find_library(SPARKLE Sparkle
PATHS
/Library/Frameworks
/System/Library/Frameworks
/opt/homebrew/Frameworks
/opt/homebrew/opt/sparkle-framework/Frameworks
/usr/local/Frameworks
/usr/local/opt/sparkle-framework/Frameworks
PATH_SUFFIXES Frameworks
)
endif()
include(cmake/Dmg.cmake)
endif()