Permalink
Browse files

Adds Debug or Release to the Full Revision string, fully tested under…

… Windows.

--HG--
branch : trunk
  • Loading branch information...
Paradox committed Dec 14, 2009
1 parent 79c1021 commit dc6f2cd40e74a2627c69e075d1ab9b5152e1d614
Showing with 43 additions and 18 deletions.
  1. +21 −9 CMakeLists.txt
  2. +3 −3 src/shared/SystemConfig.h
  3. +13 −0 src/tools/genrevision/genrevision.cpp
  4. +2 −2 win/VC80/shared.vcproj
  5. +4 −4 win/VC90/shared.vcproj
View
@@ -30,15 +30,27 @@ SET(GENREV_SRC
src/tools/genrevision/genrevision.cpp
)
-ADD_EXECUTABLE(genrev
-${GENREV_SRC}
-)
-ADD_CUSTOM_TARGET("revision.h" ALL
- COMMAND "${Trinity_BINARY_DIR}/genrev"
- ${Trinity_SOURCE_DIR}
- WORKING_DIRECTORY "${Trinity_SOURCE_DIR}/src/shared"
- DEPENDS genrev
-)
+if (DO_DEBUG)
+ ADD_EXECUTABLE(genrev
+ ${GENREV_SRC}
+ )
+ ADD_CUSTOM_TARGET("revision.h" ALL
+ COMMAND "${Trinity_BINARY_DIR}/genrev -d"
+ ${Trinity_SOURCE_DIR}
+ WORKING_DIRECTORY "${Trinity_SOURCE_DIR}/src/shared"
+ DEPENDS genrev
+ )
+else (DO_DEBUG)
+ ADD_EXECUTABLE(genrev
+ ${GENREV_SRC}
+ )
+ ADD_CUSTOM_TARGET("revision.h" ALL
+ COMMAND "${Trinity_BINARY_DIR}/genrev"
+ ${Trinity_SOURCE_DIR}
+ WORKING_DIRECTORY "${Trinity_SOURCE_DIR}/src/shared"
+ DEPENDS genrev
+ )
+endif (DO_DEBUG)
EXECUTE_PROCESS(
@@ -38,12 +38,12 @@
#if PLATFORM == PLATFORM_WINDOWS
# ifdef _WIN64
-# define _FULLVERSION _PACKAGENAME "Rev: " _REVISION " Hash: " _HASH " (Win64," _ENDIAN_STRING ")"
+# define _FULLVERSION _PACKAGENAME "Rev: " _REVISION " " _BUILD_DIRECTIVE " Hash: " _HASH " (Win64," _ENDIAN_STRING ")"
# else
-# define _FULLVERSION _PACKAGENAME "Rev: " _REVISION " Hash: " _HASH " (Win32," _ENDIAN_STRING ")"
+# define _FULLVERSION _PACKAGENAME "Rev: " _REVISION " " _BUILD_DIRECTIVE " Hash: " _HASH " (Win32," _ENDIAN_STRING ")"
# endif
#else
-# define _FULLVERSION _PACKAGENAME "Rev: " _REVISION " Hash: " _HASH " (Unix," _ENDIAN_STRING ")"
+# define _FULLVERSION _PACKAGENAME "Rev: " _REVISION " " _BUILD_DIRECTIVE " Hash: " _HASH " (Unix," _ENDIAN_STRING ")"
#endif
#define DEFAULT_PLAYER_LIMIT 100
@@ -24,6 +24,8 @@
#pragma warning(disable:4996)
+std::string build_directive;
+
struct RawData
{
char hash_str[200];
@@ -298,6 +300,7 @@ std::string generateHeader(char const* rev_str, char const* date_str, char const
std::ostringstream newData;
newData << "#ifndef __REVISION_H__" << std::endl;
newData << "#define __REVISION_H__" << std::endl;
+ newData << " #define _BUILD_DIRECTIVE \"" << build_directive << "\"" << std::endl;
newData << " #define _REVISION \"" << rev_str << "\"" << std::endl;
newData << " #define _HASH \"" << hash_str << "\"" << std::endl;
newData << " #define _REVISION_DATE \"" << date_str << "\"" << std::endl;
@@ -325,6 +328,7 @@ int main(int argc, char **argv)
bool hg_prefered = true;
bool git_prefered = false;
bool svn_prefered = false;
+ bool debug = false;
std::string path;
// Call: tool {options} [path]
@@ -333,6 +337,7 @@ int main(int argc, char **argv)
// -s use svn prefered
// -r use only revision (without repo URL) (default)
// -u include repositire URL as commit URL or "rev at URL"
+ // -d compile directive debug
for (int k = 1; k <= argc; ++k)
{
if(!argv[k] || !*argv[k])
@@ -369,12 +374,20 @@ int main(int argc, char **argv)
case 'u':
use_url = true;
continue;
+ case 'd':
+ debug = true;
+ continue;
default:
printf("Unknown option %s",argv[k]);
return 1;
}
}
+ if (debug)
+ build_directive = "Debug";
+ else
+ build_directive = "Release";
+
/// new data extraction
std::string newData;
View
@@ -884,7 +884,7 @@
<Tool
Name="VCCustomBuildTool"
Description="Getting Version..."
- CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;..\..&quot;&#x0D;&#x0A;"
+ CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;-d&quot; &quot;..\..&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(SolutionDir)../.hg/branch.cache"
Outputs="revision.h"
/>
@@ -895,7 +895,7 @@
<Tool
Name="VCCustomBuildTool"
Description="Getting Version..."
- CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;..\..&quot;&#x0D;&#x0A;"
+ CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;-d&quot; &quot;..\..&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(SolutionDir)../.hg/branch.cache"
Outputs="revision.h"
/>
View
@@ -883,7 +883,7 @@
<Tool
Name="VCCustomBuildTool"
Description="Getting Version..."
- CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;..\..&quot;&#x0D;&#x0A;"
+ CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;-d&quot; &quot;..\..&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(SolutionDir)../.hg/branch.cache"
Outputs="revision.h"
/>
@@ -894,7 +894,7 @@
<Tool
Name="VCCustomBuildTool"
Description="Getting Version..."
- CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;..\..&quot;&#x0D;&#x0A;"
+ CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;-d&quot; &quot;..\..&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(SolutionDir)../.hg/branch.cache"
Outputs="revision.h"
/>
@@ -916,7 +916,7 @@
<Tool
Name="VCCustomBuildTool"
Description="Getting Version..."
- CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;..\..&quot;&#x0D;&#x0A;"
+ CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;-d&quot; &quot;..\..&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(SolutionDir)../.hg/branch.cache"
Outputs="revision.h"
/>
@@ -927,7 +927,7 @@
<Tool
Name="VCCustomBuildTool"
Description="Getting Version..."
- CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;..\..&quot;&#x0D;&#x0A;"
+ CommandLine="cd $(InputDir)&#x0D;&#x0A;&quot;$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe&quot; &quot;-d&quot; &quot;..\..&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(SolutionDir)../.hg/branch.cache"
Outputs="revision.h"
/>

0 comments on commit dc6f2cd

Please sign in to comment.