1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

Attempt to apply patch from stopiccot.

This commit is contained in:
Michał W. Urbańczyk 2013-03-01 21:32:26 +00:00
parent 01d1029b1f
commit 8c7c4789ca
8 changed files with 74 additions and 6 deletions

View File

@ -38,6 +38,10 @@ if (APPLE)
# Build with clang ang libc++
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
# On OS X we use Sparkle framework for updates
find_path(SPARKLE_INCLUDE_DIR Sparkle.h)
find_library(SPARKLE_FRAMEWORK NAMES Sparkle)
endif()
find_package(Boost 1.46.0 COMPONENTS program_options filesystem system thread REQUIRED)

View File

@ -173,6 +173,9 @@ static void prog_help(const po::options_description &opts)
// printf(" -v, --version display version information and exit\n");
}
#ifdef __APPLE__
void OSX_checkForUpdates();
#endif
#ifdef _WIN32
int _tmain(int argc, _TCHAR* argv[])
@ -188,6 +191,9 @@ int main(int argc, char** argv)
std::string workDir = executablePath.substr(0, executablePath.rfind('/'));
chdir(workDir.c_str());
// Check for updates
OSX_checkForUpdates();
// Check that game data is prepared. Otherwise run vcmibuilder helper application
FILE* check = fopen((GVCMIDirs.UserPath + "/game_data_prepared").c_str(), "r");
if (check == NULL) {

View File

@ -46,8 +46,15 @@ set(client_SRCS
if(WIN32)
add_executable(vcmiclient WIN32 ${client_SRCS})
elseif(APPLE)
# When building for OS X we need add SDLMain.m to source files
add_executable(vcmiclient MACOSX_BUNDLE ${client_SRCS} SDLMain.m vcmi.icns Info.plist)
# 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})
# OS X specific libraries
target_link_libraries(vcmiclient ${SPARKLE_FRAMEWORK})
# 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)
@ -55,8 +62,9 @@ elseif(APPLE)
# Custom Info.plist
set_target_properties(vcmiclient PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
# Copy icon file
# Copy icon file and public key for Sparkle
set_source_files_properties(vcmi.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(../osx/vcmi_dsa_public.pem PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# Copy server executable, libs and game data to bundle
set(BUNDLE_PATH ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/vcmiclient.app/Contents)

View File

@ -2,9 +2,15 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIconFile</key>
<string>vcmi.icns</string>
<key>CFBundleVersion</key>
<key>CFBundleIconFile</key>
<string>vcmi.icns</string>
<key>CFBundleVersion</key>
<string>${VCMI_VERSION_MAJOR}.${VCMI_VERSION_MINOR}</string>
<key>CFBundleIdentifier</key>
<string>com.vcmi.vcmiclient</string>
<key>SUFeedURL</key>
<string>http://vcmi.eu/sparkle_appcast.xml</string>
<key>SUPublicDSAKeyFile</key>
<string>vcmi_dsa_public.pem</string>
</dict>
</plist>

7
client/OSX.mm Normal file
View File

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

16
osx/sparkle_appcast.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://vcmi.eu/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>VCMI App Changelog</title>
<link>http://vcmi.eu/sparkle_appcast.xml</link>
<description>Most recent changes with links to updates.</description>
<language>en</language>
<item>
<title>Version 0.92</title>
<description>Version 0.92 description</description>
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
<sparkle:releaseNotesLink>http://vcmi.com/sparkle_release_notes.html</sparkle:releaseNotesLink>
<enclosure url="http://download.vcmi.eu/vcmi-0.92.dmg" sparkle:version="0.92" length="34906250" type="application/octet-stream" sparkle:dsaSignature="MC0CFF75UKfXunY2GNSW4hs1O6MaWycLAhUA3YiRM9uUrnoS/PhWHgjRjwWcHo4=" />
</item>
</channel>
</rss>

View File

@ -0,0 +1,9 @@
<html>
<body>
<ul>
<li>0.92 Feature 1</li>
<li>0.92 Feature 2</li>
</ul>
</body>
</html>

12
osx/vcmi_dsa_public.pem Normal file
View File

@ -0,0 +1,12 @@
-----BEGIN PUBLIC KEY-----
MIIBuDCCASwGByqGSM44BAEwggEfAoGBAPBRGeziJsHw0F7CM9JmSOiIOBmJ4hYl
dbmdU1iJR7XHX5lZIUOl323cCANhzOogVAzkvEVhFedA6H4iO6VRt7nTJSgLA4hO
gMqMJGKp4bDQIwupUK5xQUUcaXumT03Aj8jzzibW9YjNB8NeuSSMfMi5KGZw5pkf
nSvZM0TUVVX/AhUA74nJWqRFwUPc6aPGCOgfsRzPYMsCgYEApYMP5/tIr4yrqHVM
xHLj1s+Y/Zgs3+kRqudTLgYE20Br3Tmmi2ejM9phrEHn5mv6Ss/FYyWqKxdtzCEN
PjRA/JkKMpoX+sy/S3OE/NrrnikVjCRvgOJcM6FPt9iaENRqjz20dZMIq42vqeE9
K5u1XJ/YtiwU2b1fX0nNtREhjUwDgYUAAoGBAJT2cMQ2qTGecdNIjEByCFMZpWg0
nV+jKgpthNUahwxbUN3ru9nrWMUNv1pBiS3pxqFV6ec7qozKnedwyTx+IRJXTN4T
IrxYsgPJDHhkBeoVVAkacihkLUtwPSphorZWF4OMFmrlc5WsmYt2lEahR2TZGQrW
5GBNP18/S/nDBe7j
-----END PUBLIC KEY-----