1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

macOS: turn Sparkle off by default (#327)

This commit is contained in:
Alex Dunn 2017-07-05 23:09:30 -07:00 committed by ArseniyShestakov
parent fab6f409f6
commit 34058f1396
3 changed files with 37 additions and 23 deletions

View File

@ -24,6 +24,8 @@ option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF)
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
option(ENABLE_TEST "Enable compilation of unit tests" ON)
option(ENABLE_PCH "Enable compilation using precompiled headers" ON)
# TODO: default to ON when we start distributing macOS binaries
option(ENABLE_SPARKLE "Enable auto-updating with Sparkle on macOS" OFF)
############################################
# Documentation section #
@ -53,9 +55,14 @@ if (APPLE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
if(ENABLE_SPARKLE)
# so that OSX_checkForUpdates knows whether to be a noop
add_definitions(-DSPARKLE)
# On OS X we use Sparkle framework for updates
find_path(SPARKLE_INCLUDE_DIR Sparkle.h)
find_library(SPARKLE_FRAMEWORK NAMES Sparkle)
endif()
# Xcode 5.0 fix
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=256")

View File

@ -1,7 +1,11 @@
#ifdef SPARKLE
#import <Cocoa/Cocoa.h>
#import "Sparkle.h"
#endif
void OSX_checkForUpdates() {
#ifdef SPARKLE
SUUpdater* updater = [[SUUpdater alloc] init];
[[SUUpdater sharedUpdater] checkForUpdatesInBackground];
#endif
}

View File

@ -128,15 +128,18 @@ if(MSVC)
endif()
if(APPLE)
# OS X specific source files
set(client_SRCS ${client_SRCS} SDLMain.m Autoupdate.mm Info.plist vcmi.icns ../osx/vcmi_dsa_public.pem)
if(ENABLE_SPARKLE)
# OS X specific includes
include_directories(${SPARKLE_INCLUDE_DIR})
# OS X specific source files
set(client_SRCS ${client_SRCS} SDLMain.m OSX.mm Info.plist vcmi.icns ../osx/vcmi_dsa_public.pem)
add_executable(vcmiclient MACOSX_BUNDLE ${client_SRCS} ${client_HEADERS})
# OS X specific libraries
target_link_libraries(vcmiclient ${SPARKLE_FRAMEWORK})
endif()
add_executable(vcmiclient MACOSX_BUNDLE ${client_SRCS} ${client_HEADERS})
# Because server and AI libs would be copies to bundle they need to be built before client
add_dependencies(vcmiclient vcmiserver VCAI EmptyAI StupidAI BattleAI minizip)