Skip to content

Commit

Permalink
* Added -v: outputs the revision and date.
Browse files Browse the repository at this point in the history
  • Loading branch information
takeshimiya committed Sep 7, 2006
1 parent 118b866 commit c959bdd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wx-config-win.cbp
Expand Up @@ -13,7 +13,7 @@
<Option object_output="obj" />
<Option type="1" />
<Option compiler="gcc" />
<Option parameters="--cflags" />
<Option parameters="--help" />
<Compiler>
<Add option="-O2" />
<Add option="-pedantic" />
Expand Down
28 changes: 25 additions & 3 deletions wx-config-win.cpp
Expand Up @@ -5,7 +5,7 @@
// Created: 2006-03-23
// Copyright: (c) Takeshi Miya
// Licence: wxWidgets licence
// $Rev$
// $Revision$
// $URL$
// $Date$
// $Id$
Expand All @@ -27,6 +27,23 @@
#define WXCONFIG_EASY_MODE 0
#endif

// -------------------------------------------------------------------------------------------------

std::string getSvnRevision()
{
std::string str = "$Rev$";
return str.substr(6, str.length()-8);
//return str.substr(1, str.length()-3);

}

std::string getSvnDate()
{
std::string str = "$Date$";
return str.substr(7, 10);
//return str.substr(1, str.length()-3);
}

// -------------------------------------------------------------------------------------------------

/// Program options
Expand Down Expand Up @@ -128,7 +145,8 @@ class CmdLineOptions : public Options
keyExists("--release") ||
keyExists("--cc") ||
keyExists("--cxx") ||
keyExists("--ld");
keyExists("--ld") ||
keyExists("-v");

if(!valid)
{
Expand Down Expand Up @@ -156,6 +174,8 @@ class CmdLineOptions : public Options
std::cout << " --cc Outputs the name of the C compiler.\n";
std::cout << " --cxx Outputs the name of the C++ compiler.\n";
std::cout << " --ld Outputs the linker command.\n";
std::cout << " -v Outputs the version of wx-config.\n";


std::cout << std::endl;
std::cout << " Note that using --prefix is not needed if you have defined the \n";
Expand All @@ -164,7 +184,7 @@ class CmdLineOptions : public Options
std::cout << " Also note that using --wxcfg is not needed if you have defined the \n";
std::cout << " environmental variable WXCFG.\n";
std::cout << std::endl;

}

return valid;
Expand Down Expand Up @@ -1711,6 +1731,8 @@ void outputFlags(Options& po, CmdLineOptions& cl)
std::cout << po["rcflags"] << std::endl;
if (cl.keyExists("--release"))
std::cout << po["release"] << std::endl;
if (cl.keyExists("-v"))
std::cout << "wx-config revision " << getSvnRevision() << " " << getSvnDate() << std::endl;

#if 0 // not implemented
if (cl.keyExists("--version"))
Expand Down

0 comments on commit c959bdd

Please sign in to comment.