Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add build information for when compiling directly from the git reposi…

…tory.

Also, ignore generated files so that the commit id doesn't unnecessarily mention "-dirty".
  • Loading branch information...
commit c803c32c9d676b43a196a392d437a6368548e30b 1 parent 5057aae
Darren Salt authored
View
13 .gitignore
@@ -1,3 +1,16 @@
*~
build/*
*.DS_STORE
+CMakeCache.txt
+CMakeFiles
+CPackConfig.cmake
+CPackSourceConfig.cmake
+Makefile
+cmake_install.cmake
+daemon.*
+daemonded.*
+librendererGL*
+main/cgame.mp.*
+main/qagame.mp.*
+main/ui.mp.*
+snd_openal.*
View
26 CMakeLists.txt
@@ -130,6 +130,32 @@ else()
endif()
endif()
+# Report the git commit identification, if possible
+
+set( GIT_DESCRIBE "?" CACHE STRING "commit id reported by git" FORCE )
+
+if( EXISTS "${CMAKE_SOURCE_DIR}/.git" )
+ find_package( Git )
+ if( GIT_FOUND )
+ execute_process( COMMAND git describe --long --dirty=+dirty OUTPUT_VARIABLE GIT_DESCRIBE_REPORT OUTPUT_STRIP_TRAILING_WHITESPACE )
+ message( STATUS "git reported ${GIT_DESCRIBE_REPORT}" )
+ # this may fail with annotated non-release tags
+ if( GIT_DESCRIBE_REPORT MATCHES "-0-g.......$" )
+ set( GIT_DESCRIBE_REPORT )
+ endif()
+ endif()
+endif()
+
+if( NOT GIT_DESCRIBE STREQUAL GIT_DESCRIBE_REPORT )
+ if( GIT_DESCRIBE_REPORT )
+ file( WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/git_version.h" "#define GIT_VERSION \"${GIT_DESCRIBE_REPORT}\"" )
+ else()
+ file( WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/git_version.h" )
+ endif()
+ set( GIT_DESCRIBE ${GIT_DESCRIBE_REPORT} )
+endif()
+
+include_directories( "${CMAKE_BINARY_DIR}/CMakeFiles" )
#################
# Compile flags #
View
2  src/engine/client/cl_console.c
@@ -34,6 +34,8 @@ Maryland 20850 USA.
// console.c
+#include "git_version.h"
+
#include "client.h"
int g_console_field_width = 78;
View
2  src/engine/client/cl_irc.c
@@ -28,6 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #include "config.h"
#endif
+#include "git_version.h"
+
#include "client.h"
#include "../qcommon/htable.h"
View
2  src/engine/client/cl_main.c
@@ -34,6 +34,8 @@ Maryland 20850 USA.
// cl_main.c -- client main loop
+#include "git_version.h"
+
#include "client.h"
#include <limits.h>
View
2  src/engine/qcommon/common.c
@@ -34,6 +34,8 @@ Maryland 20850 USA.
// common.c -- misc functions used in client and server
+#include "git_version.h"
+
#include "../qcommon/q_shared.h"
#include "qcommon.h"
#include "../database/database.h"
View
4 src/engine/qcommon/q_shared.h
@@ -50,8 +50,8 @@ extern "C" {
#define ENGINE_NAME "Daemon Engine"
#define ENGINE_VERSION "0.3.0"
-#ifdef SVN_VERSION
-# define Q3_VERSION PRODUCT_NAME " " SVN_VERSION
+#ifdef GIT_VERSION
+# define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION" " GIT_VERSION
#else
# define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
#endif
View
2  src/engine/sys/sys_main.c
@@ -32,6 +32,8 @@ Maryland 20850 USA.
===========================================================================
*/
+#include "git_version.h"
+
#include <CPUInfo.h>
// the CPUInfo.h implemntation of lengthof is unsafe, so use the one
// from q_shared.h
View
2  src/engine/sys/sys_win32.c
@@ -32,6 +32,8 @@ Maryland 20850 USA.
===========================================================================
*/
+#include "git_version.h"
+
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"
#include "sys_local.h"
View
2  src/gamelogic/base/src/game/g_main.c
@@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
+#include "git_version.h"
+
#include "g_local.h"
level_locals_t level;
View
2  src/gamelogic/etmain/src/ui/ui_main.c
@@ -40,6 +40,8 @@ USER INTERFACE MAIN
=======================================================================
*/
+#include "git_version.h"
+
#include "ui_local.h"
// NERVE - SMF
View
2  src/gamelogic/gpp/src/game/g_main.c
@@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
+#include "git_version.h"
+
#include "g_local.h"
level_locals_t level;
Please sign in to comment.
Something went wrong with that request. Please try again.