|
From: Stefano A. <xa...@us...> - 2009-12-23 07:21:27
|
Module: performous
Branch: master
Commit: bc69c429eaf1eaad468f68fe5ea7a6d4dc43f180
Author: Xaldyz <xa...@us...>
Date: Wed Dec 23 08:21:06 2009 +0100
Added automatic version numeric to rc file (if enabled). Extract the most-right numeric value by version that's comma or dot separated (only Windows)
---
CMakeLists.txt | 3 +++
game/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++
win32/performous.cmake.rc | 6 +++---
3 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e89b173..00e61e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,3 +64,6 @@ if (ENABLE_TOOLS)
add_subdirectory(tools)
endif (ENABLE_TOOLS)
+if(WIN32)
+ option(ENABLE_VERSIONING "Add number version information. This allows to add version information to exe. Be carefull, in beta (and a lot useless)" OFF)
+endif(WIN32)
\ No newline at end of file
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index bf08bf2..52d50a6 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -4,6 +4,41 @@ FILE(GLOB SOURCE_FILES "*.cc")
FILE(GLOB HEADER_FILES "*.hh")
if(WIN32)
+ if(ENABLE_VERSIONING)
+ set(COMMENTS)
+ string(REGEX MATCHALL "([^\\.,^$]+)(\\.|,|$)" VERSIONING ${PROJECT_VERSION})
+ set(VERSIONS "MAJOR" "MINOR" "PATCH" "TWEAK")
+ foreach(s ${VERSIONING})
+ #we get the most-right number
+ string(REGEX REPLACE "[^0-9]+$" "" s ${s})#removes most right part non-numeric (like .)
+ #now we have a string in format <numbers-letters..........numbers>
+ #take last numbers (if there are)
+ #if string not empty, there are some numbers in right of string
+ #otherwise, set a 0, to be sure that there's a number
+ if(s STREQUAL "")
+ set(s "0")
+ endif()
+ string(REGEX MATCH "[0-9]*$" s ${s})
+
+ foreach(v ${VERSIONS})
+ if(NOT VERSION_${v}_DONE)
+ set(VERSION_${v}_DONE 1)
+ set(VERSION_${v} "${s}")
+ break()
+ endif()
+ endforeach()
+ endforeach()
+
+ foreach(v ${VERSIONS})
+ if(NOT VERSION_${v}_DONE OR VERSION_${v} STREQUAL "") #For the substitution did before, in VERSION_${v} we have or a empty string (if all letters) or a number
+ set(VERSION_${v} "0")
+ endif()
+ endforeach()
+ message(STATUS "Setting .exe version: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}")
+ else(ENABLE_VERSIONING)
+ set(COMMENTS "//")
+ endif(ENABLE_VERSIONING)
+
set(RESOURCE_FILES "${CMAKE_BINARY_DIR}/performous.rc")
set(RESOURCE_OBJECT)#nothing
diff --git a/win32/performous.cmake.rc b/win32/performous.cmake.rc
index 102d54b..80fc79c 100644
--- a/win32/performous.cmake.rc
+++ b/win32/performous.cmake.rc
@@ -3,11 +3,11 @@
LANGUAGE 9, 1
-1 ICON "${CMAKE_SOURCE_DIR}/win32/performous.ico"
+1 ICON "@CMAKE_SOURCE_DIR@/win32/performous.ico"
VS_VERSION_INFO VERSIONINFO
- //FILEVERSION 0, 4, 0, 0
- //PRODUCTVERSION 0, 4, 0, 0
+@COMMENTS@ FILEVERSION @VERSION_MAJOR@, @VERSION_MINOR@, @VERSION_PATCH@, @VERSION_TWEAK@
+@COMMENTS@ PRODUCTVERSION @VERSION_MAJOR@, @VERSION_MINOR@, @VERSION_PATCH@, @VERSION_TWEAK@
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
|