Permalink
Browse files

Core/Build: Updating genrevisioning for git.

Signed-off-by: Bootz <bootz@projectskyfire.org>
  • Loading branch information...
1 parent 94dca93 commit 9bec1c3853aa1b9f7463ccb5becc9b56e7878cdc @Bootz Bootz committed Feb 20, 2012
Showing with 124 additions and 96 deletions.
  1. +52 −40 cmake/genrev.cmake
  2. +8 −6 revision.h.in.cmake
  3. +1 −3 src/genrev/CMakeLists.txt
  4. +38 −29 src/server/authserver/authserver.rc
  5. +25 −18 src/server/worldserver/worldserver.rc
View
@@ -1,4 +1,6 @@
-# Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
+# Copyright (C) 2010-2012 Project SkyFire <http://www.projectskyfire.org/>
+# Copyright (C) 2008-2012 Trinity <http://www.trinitycore.org/>
+# Copyright (C) 2005-2012 MaNGOS <http://www.getmangos.com/>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@@ -8,65 +10,75 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-execute_process(
- COMMAND hg id -n
- WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
- OUTPUT_VARIABLE rev_id_str
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_QUIET
-)
+include(${CMAKE_SOURCE_DIR}/cmake/macros/EnsureVersion.cmake)
+
+set(_REQUIRED_GIT_VERSION "1.7")
-execute_process(
- COMMAND hg id -i
- WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
- OUTPUT_VARIABLE rev_hash_str
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_QUIET
+find_program(_GIT_EXEC
+ NAMES
+ git git.cmd
+ HINTS
+ ENV PATH
+ DOC "git installation path"
)
-if(EXISTS ${CMAKE_SOURCE_DIR}/.hg_archival.txt)
- file(READ
- ${CMAKE_SOURCE_DIR}/.hg_archival.txt rev_hash_str
- LIMIT 10
- OFFSET 7
- NEWLINE_CONSUME
+if(_GIT_EXEC)
+ execute_process(
+ COMMAND "${_GIT_EXEC}" --version
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE _GIT_VERSION
+ ERROR_QUIET
)
- string(STRIP ${rev_hash_str} rev_hash_str)
- set(rev_id_str "Archive")
- set(rev_id "0")
- set(rev_hash ${rev_hash_str})
+
+ # make sure we're using minimum the required version of git, so the "dirty-testing" will work properly
+ ensure_version( "${_REQUIRED_GIT_VERSION}" "${_GIT_VERSION}" _GIT_VERSION_OK)
endif()
-# Last minute check - ensure that we have a proper revision
-# If everything above fails (means the user has erased the mercurial revisional control directory, or runs archive and erased their .hg_archival.txt)
-if(NOT rev_id_str)
+if(_GIT_VERSION_OK)
+ execute_process(
+ COMMAND "${_GIT_EXEC}" describe --match init --dirty=+ --abbrev=12
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE rev_info
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_QUIET
+ )
+ execute_process(
+ COMMAND "${_GIT_EXEC}" show -s --format=%ci
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE rev_date
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_QUIET
+ )
+else()
message("")
- message(STATUS "WARNING - No revision-information found - have you been tampering with the sources?")
-
- # Ok, since we have no valid ways of finding/setting the revision, let's force some defaults
- set(rev_hash_str "Archive")
- set(rev_hash "0")
- set(rev_id_str "0")
- set(rev_id "0")
+ message(STATUS "WARNING - Missing or outdated git - did you forget to install a recent version?")
+ message(STATUS "WARNING - Observe that for revision hash/date to work you need at least version ${_REQUIRED_GIT_VERSION}")
endif()
-# Strip off excess strings (shows when the source is actually modified)
-if(NOT rev_id_str MATCHES "Archive")
- string(REPLACE "+" "" rev_id ${rev_id_str})
+# Last minute check - ensure that we have a proper revision
+# If everything above fails (means the user has erased the git revision control directory or removed the origin/HEAD tag)
+if(NOT rev_info)
+ # No valid ways available to find/set the revision/hash, so let's force some defaults
+ message(STATUS "WARNING - Missing repository tags - you may need to pull tags with git fetch -t")
+ message(STATUS "WARNING - Continuing anyway - note that the versionstring will be set to 0000-00-00 00:00:00 (Archived)")
+ set(rev_date "0000-00-00 00:00:00 +0000")
+ set(rev_hash "Archived")
+else()
+ # Extract information required to build a proper versionstring
+ string(REGEX REPLACE init-|[0-9]+-g "" rev_hash ${rev_info})
endif()
-string(REPLACE "+" "" rev_hash ${rev_hash_str})
# Its not set during initial run
if(NOT BUILDDIR)
set(BUILDDIR ${CMAKE_BINARY_DIR})
endif()
# Create the actual revision.h file from the above params
-if(NOT "${rev_id_cached}" MATCHES "${rev_id_str}")
+if(NOT "${rev_hash_cached}" MATCHES "${rev_hash}")
configure_file(
"${CMAKE_SOURCE_DIR}/revision.h.in.cmake"
"${BUILDDIR}/revision.h"
@ONLY
)
- set(rev_id_cached "${rev_id_str}" CACHE INTERNAL "Cached revision ID")
+ set(rev_hash_cached "${rev_hash}" CACHE INTERNAL "Cached commit-hash")
endif()
View
@@ -1,9 +1,11 @@
#ifndef __REVISION_H__
#define __REVISION_H__
- #define _REVISION "@rev_id_str@"
- #define _HASH "@rev_hash_str@"
- #define FILEVER 0,0,@rev_id@,0
- #define PRODUCTVER 0,0,@rev_id@,0
- #define STRFILEVER "0, 0, @rev_id@, @rev_hash@"
- #define STRPRODUCTVER "0, 0, @rev_id@, @rev_hash@"
+ #define _HASH "@rev_hash@"
+ #define _DATE "@rev_date@"
+ #define VER_COMPANYNAME_STR "Project SkyFire Developers"
+ #define VER_LEGALCOPYRIGHT_STR "(c)2010-2012 Project SkyFire & TrinityCore"
+ #define VER_FILEVERSION 0,0,0
+ #define VER_FILEVERSION_STR "@rev_date@ (@rev_hash@)"
+ #define VER_PRODUCTVERSION VER_FILEVERSION
+ #define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
#endif // __REVISION_H__
@@ -1,6 +1,4 @@
-# Copyright (C) 2010-2012 Oregon <http://www.oregoncore.com/>
-# Copyright (C) 2008-2012 Trinity <http://www.trinitycore.org/>
-# Copyright (C) 2005-2012 MaNGOS <http://www.getmangos.com/>
+# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@@ -1,19 +1,20 @@
/*
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ * Copyright (C) 2010-2012 Project SkyFire <http://www.projectskyfire.org/>
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "resource.h"
@@ -39,7 +40,7 @@
IDI_APPICON ICON "authserver.ico"
/////////////////////////////////////////////////////////////////////////////
-// Neutre (Par d�faut syst�me) resources
+// Neutral (Default System) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
#ifdef _WIN32
@@ -53,31 +54,39 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION FILEVER
- PRODUCTVERSION PRODUCTVER
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
+FILEVERSION VER_FILEVERSION
+PRODUCTVERSION VER_PRODUCTVERSION
+
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+
+#ifndef _DEBUG
+ FILEFLAGS 0
#else
- FILEFLAGS 0x0L
+ #define VER_PRERELEASE VS_FF_PRERELEASE
+ #define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD
+ #define VER_DEBUG 0
+ FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
#endif
- FILEOS 0x0L
- FILETYPE 0x0L
- FILESUBTYPE 0x0L
+
+FILEOS VOS_NT_WINDOWS32
+FILETYPE VFT_APP
+
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080004b0"
BEGIN
- VALUE "FileDescription", "authserver"
- VALUE "FileVersion", STRFILEVER
- VALUE "InternalName", "authserver"
- VALUE "LegalCopyright", "Copyright (C) 2008-2010"
- VALUE "OriginalFilename", "authserver.exe"
- VALUE "ProductName", "authserver"
- VALUE "ProductVersion", STRPRODUCTVER
+ VALUE "CompanyName", VER_COMPANYNAME_STR
+ VALUE "FileDescription", "SkyFireEMU Authentication Server Daemon"
+ VALUE "FileVersion", VER_FILEVERSION_STR
+ VALUE "InternalName", "authserver"
+ VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
+ VALUE "OriginalFilename", "authserver.exe"
+ VALUE "ProductName", "SkyFireEMU Authentication Server"
+ VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
+
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x800, 1200
@@ -1,5 +1,4 @@
/*
- * Copyright (C) 2010-2012 Oregon <http://www.oregoncore.com/>
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
*
@@ -40,7 +39,7 @@
IDI_APPICON ICON "worldserver.ico"
/////////////////////////////////////////////////////////////////////////////
-// Neutre (Par d�faut syst�me) resources
+// Neutre (Par défaut système) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
#ifdef _WIN32
@@ -54,31 +53,39 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION FILEVER
- PRODUCTVERSION PRODUCTVER
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
+FILEVERSION VER_FILEVERSION
+PRODUCTVERSION VER_PRODUCTVERSION
+
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+
+#ifndef _DEBUG
+ FILEFLAGS 0
#else
- FILEFLAGS 0x0L
+ #define VER_PRERELEASE VS_FF_PRERELEASE
+ #define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD
+ #define VER_DEBUG 0
+ FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
#endif
- FILEOS 0x0L
- FILETYPE 0x0L
- FILESUBTYPE 0x0L
+
+FILEOS VOS_NT_WINDOWS32
+FILETYPE VFT_APP
+
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080004b0"
BEGIN
- VALUE "FileDescription", "OregonCore"
- VALUE "FileVersion", STRFILEVER
- VALUE "InternalName", "OregonCore"
- VALUE "LegalCopyright", "Copyright (C) 2009-2010"
- VALUE "OriginalFilename", "OregonCore.exe"
- VALUE "ProductName", "OregonCore"
- VALUE "ProductVersion", STRPRODUCTVER
+ VALUE "CompanyName", VER_COMPANYNAME_STR
+ VALUE "FileDescription", "SkyFireEMU World Server Daemon"
+ VALUE "FileVersion", VER_FILEVERSION_STR
+ VALUE "InternalName", "worldserver"
+ VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
+ VALUE "OriginalFilename", "worldserver.exe"
+ VALUE "ProductName", "SkyFireEMU World Server"
+ VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
+
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x800, 1200

0 comments on commit 9bec1c3

Please sign in to comment.