Moved version information to Version.txt, including the HG revision. From there it gets inserted into all relevant files by CMake. Used it to for properly setting up the Mac application bundles.

stable-5.1
Peter Wortmann 2010-08-01 14:49:51 +01:00
parent 8a7898cb06
commit 904138bae2
13 changed files with 240 additions and 70 deletions

View File

@ -1,6 +1,9 @@
cmake_minimum_required (VERSION 2.6.0)
project (clonk CXX C)
include(Version.txt)
set(CMAKE_ADDITIONAL_DEPS_PATH deps CACHE PATH "Additional directory to search for libraries and headers")
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_ADDITIONAL_DEPS_PATH})
set(OC_CXX_FLAGS ${CMAKE_CXX_FLAGS})
@ -95,20 +98,6 @@ if(MSVC_VERSION)
list(APPEND OC_CXX_FLAGS "/wd4244")
endif()
############################################################################
# Generate hgrevision.h
############################################################################
if(CMAKE_HOST_WIN32 AND NOT CMAKE_HOST_UNIX)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/.hg/dirstate
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/get_hg_revision.bat" > "${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h"
VERBATIM)
else()
# Assume all non-windows system to have /bin/sh.
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/.hg/dirstate
COMMAND /bin/sh "${CMAKE_CURRENT_SOURCE_DIR}/tools/get_hg_revision.sh" > "${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h"
VERBATIM)
endif()
############################################################################
# List target source files. Don't directly create a target since we condi-
# tionally add more sources depending on configuration options later.
@ -507,7 +496,6 @@ set(OC_CLONK_SOURCES
src/tinyxml/tinyxmlparser.cpp
src/zlib/gzio.c
src/zlib/zutil.h
${CMAKE_CURRENT_BINARY_DIR}/hgrevision.h
)
mark_as_advanced(OC_CLONK_SOURCES)
mark_as_advanced(OC_SYSTEM_SOURCES)
@ -727,6 +715,27 @@ if(HAVE_PRECOMPILED_HEADERS)
endif()
endif()
############################################################################
# Mac OS bundle setup
############################################################################
if(APPLE)
list(APPEND OC_BUNDLE_RESOURCES
src/res/Clonk.icns
src/res/C4D.icns src/res/C4F.icns src/res/C4G.icns src/res/C4K.icns
src/res/C4P.icns src/res/C4S.icns src/res/C4U.icns
)
# Add icon resources
set_source_files_properties(
${OC_BUNDLE_RESOURCES}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)
list(APPEND OC_SYSTEM_SOURCES ${OC_BUNDLE_RESOURCES})
endif()
############################################################################
# Generate output files
############################################################################
@ -768,6 +777,10 @@ target_link_libraries(c4group
set_property(TARGET clonk APPEND PROPERTY COMPILE_DEFINITIONS GLEW_STATIC)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG _DEBUG)
# This expands some variables in Info.plist as a side-effect. XCode might then
# expand a second time, using the same syntax. Try not to get confused by this!
set_target_properties(clonk PROPERTIES MACOSX_BUNDLE_INFO_PLIST "src/res/Info.plist")
############################################################################
# build to planet
############################################################################

View File

@ -43,7 +43,6 @@
#include <C4GamePadCon.h>
#include <C4GameLobby.h>
#include <C4Fonts.h>
#include "hgrevision.h"
#include <StdRegistry.h> // For DDraw emulation warning
@ -120,7 +119,7 @@ bool C4Application::DoInit()
// Open log
OpenLog();
Revision.Ref(OC_HG_REVISION);
Revision.Ref(C4REVISION);
// init system group
if (!SystemGroup.Open(C4CFN_System))

View File

@ -21,31 +21,31 @@
#define C4VERSION_H
#define C4ENGINENAME "OpenClonk"
#define C4ENGINENICK "openclonk"
// These are filled in automatically by CMake. When in doubt, edit
// Version.txt instead!
#define C4ENGINECAPTION C4ENGINENAME
#define C4CFG_Company "OpenClonk Project"
#define C4COPYRIGHT_YEAR "2010"
#define C4COPYRIGHT_COMPANY "OpenClonk Project"
#define C4ENGINENAME "OpenClonk Reborn"
#define C4ENGINENICK "reborn"
#define C4ENGINECAPTION "OpenClonk Reborn"
#define C4EDITORCAPTION "Clonk Editor"
#define C4ENGINEID "org.openclonk.reborn"
#define C4CFG_Company "Redwolf Design"
#define C4COPYRIGHT_YEAR "2010" // might make this dynamic some time...
#define C4COPYRIGHT_COMPANY "OpenClonk Project"
#define C4XVER1 4
#define C4XVER2 10
#define C4XVER3 0
#define C4XVER4 0
#define C4XVERBUILD 2
#define C4VERSIONBUILDNAME "Cerulean"
#define C4VERSIONEXTRA "Beta"
#define C4REVISION "25a791c06fff+"
#define C4VERSIONBUILDNAME "Cerulean"
#define C4XVER1 4
#define C4XVER2 10
#define C4XVER3 0
#define C4XVER4 0
#define C4XVERBUILD 2
#define C4VERSIONEXTRA "Beta"
// Prepend space to version extra
#ifdef C4VERSIONEXTRA
#define C4VERSIONEX " " C4VERSIONEXTRA
#else
#define C4VERSIONEX
#endif
#define C4ENGINEINFO "OpenClonk Reborn Beta"
#define C4ENGINEINFOLONG "OpenClonk Reborn Beta (Cerulean)"
// Build Options
#ifdef _DEBUG
@ -53,37 +53,7 @@
#else
#define C4BUILDDEBUG
#endif
#define C4BUILDOPT C4BUILDDEBUG
#define C4ENGINEINFO C4ENGINENAME C4VERSIONEX
#ifdef C4VERSIONBUILDNAME
#define C4ENGINEINFOLONG C4ENGINENAME C4VERSIONEX " (" C4VERSIONBUILDNAME ")"
#else
#define C4ENGINEINFOLONG C4ENGINEINFO
#endif
#define C4XVERTOC4XVERS(s) C4XVERTOC4XVERS2(s)
#define C4XVERTOC4XVERS2(s) #s
#if C4XVERBUILD <= 9
#define C4VERSION C4XVERTOC4XVERS(C4XVER1) "." C4XVERTOC4XVERS(C4XVER2) "." C4XVERTOC4XVERS(C4XVER3) "." C4XVERTOC4XVERS(C4XVER4) " [00" C4XVERTOC4XVERS(C4XVERBUILD) "]" C4VERSIONEX C4BUILDOPT
#elif C4XVERBUILD <= 99
#define C4VERSION C4XVERTOC4XVERS(C4XVER1) "." C4XVERTOC4XVERS(C4XVER2) "." C4XVERTOC4XVERS(C4XVER3) "." C4XVERTOC4XVERS(C4XVER4) " [0" C4XVERTOC4XVERS(C4XVERBUILD) "]" C4VERSIONEX C4BUILDOPT
#else
#define C4VERSION C4XVERTOC4XVERS(C4XVER1) "." C4XVERTOC4XVERS(C4XVER2) "." C4XVERTOC4XVERS(C4XVER3) "." C4XVERTOC4XVERS(C4XVER4) " [" C4XVERTOC4XVERS(C4XVERBUILD) "]" C4VERSIONEX C4BUILDOPT
#endif
/* entries for engine.rc (VC++ will overwrite them)
#include "..\inc\C4Version.h"
[...]
FILEVERSION C4XVER1,C4XVER2,C4XVER3,C4XVER4
PRODUCTVERSION C4XVER1,C4XVER2,C4XVER3,C4XVER4
[...]
VALUE "FileDescription", C4ENGINECAPTION "\0"
VALUE "FileVersion", C4VERSION "\0"
VALUE "SpecialBuild", C4BUILDOPT "\0"
VALUE "ProductVersion", C4VERSION "\0"
*/
#define C4VERSION "4.10.0.0 [002] Beta mac" C4BUILDOPT
#endif

View File

@ -401,7 +401,7 @@ bool C4Config::Load(bool forceWorkingDirectory, const char *szConfigFile)
if (home) { home += "/"; }
filename.Copy(home);
#ifdef __APPLE__
filename += "Library/Preferences/de.clonk." C4ENGINENICK ".config";
filename += "Library/Preferences/" C4ENGINEID ".config";
#else
filename += ".clonk/" C4ENGINENICK "/config";
#endif

188
src/res/Info.plist 100644
View File

@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4k</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4K.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/octet-stream</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Key</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4u</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4U.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Update</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4s</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4S.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Scenario</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4d</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4D.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Definition</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4g</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4G.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Group</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4p</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4P.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Player</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4f</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4F.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Folder</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Clonk</string>
<key>CFBundleIdentifier</key>
<string>${C4ENGINEID}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${C4ENGINEINFO}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Clonk Game Link</string>
<key>CFBundleURLSchemes</key>
<array>
<string>clonk</string>
</array>
</dict>
</array>
<key>NSMainNibFile</key>
<string>MainMenu.nib</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHumanReadableCopyright</key>
<string>(c) ${C4COPYRIGHT_YEAR}, ${C4PROJECT}</string>
<key>CFBundleDisplayName</key>
<string>${C4ENGINEINFOLONG}</string>
<key>CFBundleShortVersionString</key>
<string>${C4VERSION}</string>
<key>CFBundleVersion</key>
<string>${C4XVERBUILD}</string>
</dict>
</plist>