mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
macOS: turn Sparkle off by default (#327)
This commit is contained in:
committed by
ArseniyShestakov
parent
fab6f409f6
commit
34058f1396
@ -24,6 +24,8 @@ option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF)
|
|||||||
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
|
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
|
||||||
option(ENABLE_TEST "Enable compilation of unit tests" ON)
|
option(ENABLE_TEST "Enable compilation of unit tests" ON)
|
||||||
option(ENABLE_PCH "Enable compilation using precompiled headers" 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 #
|
# Documentation section #
|
||||||
@ -53,9 +55,14 @@ if (APPLE)
|
|||||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||||
|
|
||||||
# On OS X we use Sparkle framework for updates
|
if(ENABLE_SPARKLE)
|
||||||
find_path(SPARKLE_INCLUDE_DIR Sparkle.h)
|
# so that OSX_checkForUpdates knows whether to be a noop
|
||||||
find_library(SPARKLE_FRAMEWORK NAMES Sparkle)
|
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
|
# Xcode 5.0 fix
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=256")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=256")
|
||||||
@ -70,7 +77,7 @@ if (WIN32)
|
|||||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} ole32 oleaut32 ws2_32 mswsock dbghelp)
|
set(SYSTEM_LIBS ${SYSTEM_LIBS} ole32 oleaut32 ws2_32 mswsock dbghelp)
|
||||||
|
|
||||||
#delete lib prefix for dlls (libvcmi -> vcmi)
|
#delete lib prefix for dlls (libvcmi -> vcmi)
|
||||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||||
|
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
#MinGW: check for iconv (may be needed for boost.locale)
|
#MinGW: check for iconv (may be needed for boost.locale)
|
||||||
@ -82,8 +89,8 @@ if (WIN32)
|
|||||||
|
|
||||||
#MinGW: copy runtime to VCMI location
|
#MinGW: copy runtime to VCMI location
|
||||||
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH )
|
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH )
|
||||||
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libwinpthread-*.dll")
|
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libwinpthread-*.dll")
|
||||||
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libgcc_s_*.dll")
|
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libgcc_s_*.dll")
|
||||||
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libstdc++-*.dll")
|
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libstdc++-*.dll")
|
||||||
|
|
||||||
#MinGW: use O1 to prevent compiler crash in some cases
|
#MinGW: use O1 to prevent compiler crash in some cases
|
||||||
@ -209,7 +216,7 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|||||||
# precompiled header configuration
|
# precompiled header configuration
|
||||||
SET(PCH_PROPERTIES
|
SET(PCH_PROPERTIES
|
||||||
COTIRE_ENABLE_PRECOMPILED_HEADER ${ENABLE_PCH}
|
COTIRE_ENABLE_PRECOMPILED_HEADER ${ENABLE_PCH}
|
||||||
COTIRE_ADD_UNITY_BUILD FALSE
|
COTIRE_ADD_UNITY_BUILD FALSE
|
||||||
COTIRE_CXX_PREFIX_HEADER_INIT "StdInc.h"
|
COTIRE_CXX_PREFIX_HEADER_INIT "StdInc.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -247,24 +254,24 @@ if (NOT APPLE)
|
|||||||
install(FILES vcmibuilder DESTINATION ${BIN_DIR} PERMISSIONS
|
install(FILES vcmibuilder DESTINATION ${BIN_DIR} PERMISSIONS
|
||||||
OWNER_WRITE OWNER_READ OWNER_EXECUTE
|
OWNER_WRITE OWNER_READ OWNER_EXECUTE
|
||||||
GROUP_READ GROUP_EXECUTE
|
GROUP_READ GROUP_EXECUTE
|
||||||
WORLD_READ WORLD_EXECUTE)
|
WORLD_READ WORLD_EXECUTE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
file(GLOB dep_files
|
file(GLOB dep_files
|
||||||
${dep_files}
|
${dep_files}
|
||||||
"${CMAKE_FIND_ROOT_PATH}/bin/*.dll")
|
"${CMAKE_FIND_ROOT_PATH}/bin/*.dll")
|
||||||
|
|
||||||
#Copy debug versions of libraries if build type is debug. Doesn't work in MSVC!
|
#Copy debug versions of libraries if build type is debug. Doesn't work in MSVC!
|
||||||
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||||
set(debug_postfix d)
|
set(debug_postfix d)
|
||||||
endif(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
endif(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||||
|
|
||||||
if(ENABLE_LAUNCHER)
|
if(ENABLE_LAUNCHER)
|
||||||
get_target_property(QtCore_location Qt5::Core LOCATION)
|
get_target_property(QtCore_location Qt5::Core LOCATION)
|
||||||
get_filename_component(Qtbin_folder ${QtCore_location} PATH)
|
get_filename_component(Qtbin_folder ${QtCore_location} PATH)
|
||||||
file(GLOB dep_files
|
file(GLOB dep_files
|
||||||
${dep_files}
|
${dep_files}
|
||||||
${Qtbin_folder}/Qt5Core${debug_postfix}.dll
|
${Qtbin_folder}/Qt5Core${debug_postfix}.dll
|
||||||
${Qtbin_folder}/Qt5Gui${debug_postfix}.dll
|
${Qtbin_folder}/Qt5Gui${debug_postfix}.dll
|
||||||
@ -273,7 +280,7 @@ if(WIN32)
|
|||||||
file(GLOB dep_qwindows
|
file(GLOB dep_qwindows
|
||||||
${Qtbin_folder}/../plugins/platforms/qwindows${debug_postfix}.dll)
|
${Qtbin_folder}/../plugins/platforms/qwindows${debug_postfix}.dll)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
file(GLOB dep_files
|
file(GLOB dep_files
|
||||||
${dep_files}
|
${dep_files}
|
||||||
${Qtbin_folder}/libEGL.dll
|
${Qtbin_folder}/libEGL.dll
|
||||||
${Qtbin_folder}/libGLESv2.dll)
|
${Qtbin_folder}/libGLESv2.dll)
|
||||||
@ -281,8 +288,8 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_LAUNCHER)
|
if (ENABLE_LAUNCHER)
|
||||||
file(GLOB dep_files
|
file(GLOB dep_files
|
||||||
${dep_files}
|
${dep_files}
|
||||||
${Qtbin_folder}/Qt5Network${debug_postfix}.dll)
|
${Qtbin_folder}/Qt5Network${debug_postfix}.dll)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -345,7 +352,7 @@ if(WIN32)
|
|||||||
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
|
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
|
||||||
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_launcher.exe\\\"")
|
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_launcher.exe\\\"")
|
||||||
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " Delete \\\"$DESKTOP\\\\VCMI.lnk\\\" ")
|
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " Delete \\\"$DESKTOP\\\\VCMI.lnk\\\" ")
|
||||||
|
|
||||||
configure_file("${CMAKE_SOURCE_DIR}/cmake_modules/CMakeCPackOptions.cmake.in" "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
|
configure_file("${CMAKE_SOURCE_DIR}/cmake_modules/CMakeCPackOptions.cmake.in" "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
|
||||||
set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake")
|
set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake")
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
|
#ifdef SPARKLE
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import "Sparkle.h"
|
#import "Sparkle.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void OSX_checkForUpdates() {
|
void OSX_checkForUpdates() {
|
||||||
|
#ifdef SPARKLE
|
||||||
SUUpdater* updater = [[SUUpdater alloc] init];
|
SUUpdater* updater = [[SUUpdater alloc] init];
|
||||||
[[SUUpdater sharedUpdater] checkForUpdatesInBackground];
|
[[SUUpdater sharedUpdater] checkForUpdatesInBackground];
|
||||||
|
#endif
|
||||||
}
|
}
|
@ -128,15 +128,18 @@ if(MSVC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
# OS X specific includes
|
|
||||||
include_directories(${SPARKLE_INCLUDE_DIR})
|
|
||||||
|
|
||||||
# OS X specific source files
|
# OS X specific source files
|
||||||
set(client_SRCS ${client_SRCS} SDLMain.m OSX.mm Info.plist vcmi.icns ../osx/vcmi_dsa_public.pem)
|
set(client_SRCS ${client_SRCS} SDLMain.m Autoupdate.mm Info.plist vcmi.icns ../osx/vcmi_dsa_public.pem)
|
||||||
add_executable(vcmiclient MACOSX_BUNDLE ${client_SRCS} ${client_HEADERS})
|
|
||||||
|
|
||||||
# OS X specific libraries
|
if(ENABLE_SPARKLE)
|
||||||
target_link_libraries(vcmiclient ${SPARKLE_FRAMEWORK})
|
# OS X specific includes
|
||||||
|
include_directories(${SPARKLE_INCLUDE_DIR})
|
||||||
|
|
||||||
|
# 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
|
# 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)
|
add_dependencies(vcmiclient vcmiserver VCAI EmptyAI StupidAI BattleAI minizip)
|
||||||
|
Reference in New Issue
Block a user