Factor version number out in C++ code

* Fewer places to update with the version number.
* Linux can now use this natively rather than passing via Makefile var
This commit is contained in:
baldurk
2014-09-09 23:39:59 +01:00
parent 3d0fe01a56
commit 3e45d2775b
7 changed files with 41 additions and 12 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
CC=gcc
CPP=g++
COMMIT=`git rev-parse HEAD`
MACROS=-DLINUX \
-DRENDERDOC_PLATFORM=linux \
-DRENDERDOC_EXPORTS \
-DGIT_COMMIT_HASH='"'$$(git rev-parse HEAD)'"' \
-DRENDERDOC_VERSION_STRING='"0.21"'
-DGIT_COMMIT_HASH="\"$(COMMIT)\""
CFLAGS=-c -Wall -Werror -Wno-unknown-pragmas -Wno-error=format -fPIC $(MACROS) -I.
CPPFLAGS=-std=c++11 -g -Wno-unused -Wno-unknown-pragmas -Wno-reorder -fvisibility=hidden -fvisibility-inlines-hidden
LDFLAGS=-lpthread -lrt -shared -ldl -lX11
+1 -4
View File
@@ -30,10 +30,7 @@
#include <time.h>
#ifdef WIN32
#include "data/resource.h"
#endif
#include "data/version.h"
#include "crash_handler.h"
template<>
+2 -4
View File
@@ -24,12 +24,8 @@
#define STRINGIZE(a) STRINGIZE2(a)
#endif
#define RENDERDOC_VERSION_MAJOR 0
#define RENDERDOC_VERSION_MINOR 21
#define GIT_COMMIT_HASH "NO_GIT_COMMIT_HASH_DEFINED"
//#define RENDERDOC_OFFICIAL_BUILD // used to determine whether to submit auto crash reports
#define RENDERDOC_VERSION_STRING STRINGIZE(RENDERDOC_VERSION_MAJOR) "." STRINGIZE(RENDERDOC_VERSION_MINOR)
#define RENDERDOC_VERSION_STRING_W WIDEN(STRINGIZE(RENDERDOC_VERSION_MAJOR)) L"." WIDEN(STRINGIZE(RENDERDOC_VERSION_MINOR))
// Next default values for new objects
//
@@ -41,3 +37,5 @@
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
#include "version.h"
+30
View File
@@ -0,0 +1,30 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2014 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#pragma once
#define RENDERDOC_VERSION_MAJOR 0
#define RENDERDOC_VERSION_MINOR 21
#define RENDERDOC_VERSION_STRING STRINGIZE(RENDERDOC_VERSION_MAJOR) "." STRINGIZE(RENDERDOC_VERSION_MINOR)
#define RENDERDOC_VERSION_STRING_W WIDEN(STRINGIZE(RENDERDOC_VERSION_MAJOR)) L"." WIDEN(STRINGIZE(RENDERDOC_VERSION_MINOR))
+1
View File
@@ -243,6 +243,7 @@
<ClInclude Include="core\socket_helpers.h" />
<ClInclude Include="data\hlsl\debugcbuffers.h" />
<ClInclude Include="data\resource.h" />
<ClInclude Include="data\version.h" />
<ClInclude Include="driver\d3d11\d3d11_common.h" />
<ClInclude Include="driver\d3d11\d3d11_context.h" />
<ClInclude Include="driver\d3d11\d3d11_debug.h" />
+3
View File
@@ -303,6 +303,9 @@
<ClInclude Include="3rdparty\stb\stb_image_write.h">
<Filter>3rdparty\stb</Filter>
</ClInclude>
<ClInclude Include="data\version.h">
<Filter>Resources</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="maths\camera.cpp">
+2 -2
View File
@@ -1,10 +1,10 @@
CC=gcc
CPP=g++
COMMIT=`git rev-parse HEAD`
MACROS=-DLINUX \
-DRENDERDOC_PLATFORM=linux \
-DRENDERDOC_EXPORTS \
-DGIT_COMMIT_HASH='"'$$(git rev-parse HEAD)'"' \
-DRENDERDOC_VERSION_STRING='"0.21"'
-DGIT_COMMIT_HASH="\"$(COMMIT)\""
CFLAGS=-c -Wall -Werror -fPIC $(MACROS) -I../renderdoc/
CPPFLAGS=-std=c++11 -g -Wno-unused -Wno-unknown-pragmas -Wno-reorder
LDFLAGS=-L../renderdoc -lrenderdoc -lGL