[Cmake-commits] CMake branch, next, updated. v2.8.10.2-1126-g3bd01d6
Brad King
brad.king at kitware.com
Thu Nov 29 14:07:57 EST 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 3bd01d6b54035ea2e4b18a9dd5e37df4f8c058cb (commit)
via b558ecb593a353fee14ae741e986198b65d37741 (commit)
from 34de461268eaf4f5d267c2781eb7543a07809f1f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3bd01d6b54035ea2e4b18a9dd5e37df4f8c058cb
commit 3bd01d6b54035ea2e4b18a9dd5e37df4f8c058cb
Merge: 34de461 b558ecb
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Nov 29 14:07:55 2012 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Nov 29 14:07:55 2012 -0500
Merge topic 'windows-ce-env-helper' into next
b558ecb Add command to generate environment for a Windows CE SDK
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b558ecb593a353fee14ae741e986198b65d37741
commit b558ecb593a353fee14ae741e986198b65d37741
Author: Patrick Gansterer <paroga at paroga.com>
AuthorDate: Thu Nov 29 16:36:20 2012 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Nov 29 14:03:37 2012 -0500
Add command to generate environment for a Windows CE SDK
diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx
index 0afcf67..b302246 100644
--- a/Source/cmVisualStudioWCEPlatformParser.cxx
+++ b/Source/cmVisualStudioWCEPlatformParser.cxx
@@ -15,18 +15,23 @@
int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version)
{
- std::string vskey = cmGlobalVisualStudioGenerator::GetRegistryBase(version);
- vskey += "\\Setup\\VS;ProductDir";
+ const std::string registryBase =
+ cmGlobalVisualStudioGenerator::GetRegistryBase(version);
+ const std::string vckey = registryBase + "\\Setup\\VC;ProductDir";
+ const std::string vskey = registryBase + "\\Setup\\VS;ProductDir";
- std::string vsInstallPath;
- if(!cmSystemTools::ReadRegistryValue(vskey.c_str(), vsInstallPath))
+ if(!cmSystemTools::ReadRegistryValue(vckey.c_str(), this->VcInstallDir) ||
+ !cmSystemTools::ReadRegistryValue(vskey.c_str(), this->VsInstallDir))
{
return 0;
}
- cmSystemTools::ConvertToUnixSlashes(vsInstallPath);
+ cmSystemTools::ConvertToUnixSlashes(this->VcInstallDir);
+ cmSystemTools::ConvertToUnixSlashes(this->VsInstallDir);
+ this->VcInstallDir.append("/");
+ this->VsInstallDir.append("/");
const std::string configFilename =
- vsInstallPath + "/VC/vcpackages/WCE.VCPlatform.config";
+ this->VcInstallDir + "vcpackages/WCE.VCPlatform.config";
return this->ParseFile(configFilename.c_str());
}
@@ -93,6 +98,24 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
this->Macros[macroName] = macroValue;
}
}
+ else if(strcmp(name, "Directories") == 0)
+ {
+ for(const char** attr = attributes; *attr; attr += 2)
+ {
+ if(strcmp(attr[0], "Include") == 0)
+ {
+ this->Include = attr[1];
+ }
+ else if(strcmp(attr[0], "Library") == 0)
+ {
+ this->Library = attr[1];
+ }
+ else if(strcmp(attr[0], "Path") == 0)
+ {
+ this->Path = attr[1];
+ }
+ }
+ }
}
void cmVisualStudioWCEPlatformParser::EndElement(const char* name)
@@ -137,3 +160,16 @@ void cmVisualStudioWCEPlatformParser::CharacterDataHandler(const char* data,
{
this->CharacterData.append(data, length);
}
+
+std::string cmVisualStudioWCEPlatformParser::FixPaths(
+ const std::string& paths) const
+{
+ std::string ret = paths;
+ cmSystemTools::ReplaceString(ret, "$(PATH)", "%PATH%");
+ cmSystemTools::ReplaceString(ret, "$(VCInstallDir)", VcInstallDir.c_str());
+ cmSystemTools::ReplaceString(ret, "$(VSInstallDir)", VsInstallDir.c_str());
+ cmSystemTools::ReplaceString(ret, "\\", "/");
+ cmSystemTools::ReplaceString(ret, "//", "/");
+ cmSystemTools::ReplaceString(ret, "/", "\\");
+ return ret;
+}
diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h
index 28061fd..466e1dd 100644
--- a/Source/cmVisualStudioWCEPlatformParser.h
+++ b/Source/cmVisualStudioWCEPlatformParser.h
@@ -31,6 +31,12 @@ public:
bool Found() const {return this->FoundRequiredName;}
const char* GetArchitectureFamily() const;
std::string GetOSVersion() const;
+ std::string GetIncludeDirectories() const {
+ return this->FixPaths(this->Include); }
+ std::string GetLibraryDirectories() const {
+ return this->FixPaths(this->Library); }
+ std::string GetPathDirectories() const {
+ return this->FixPaths(this->Path); }
const std::vector<std::string>& GetAvailablePlatforms() const {
return this->AvailablePlatforms; }
@@ -40,8 +46,13 @@ protected:
void CharacterDataHandler(const char* data, int length);
private:
+ std::string FixPaths(const std::string& paths) const;
+
std::string CharacterData;
+ std::string Include;
+ std::string Library;
+ std::string Path;
std::string PlatformName;
std::string OSMajorVersion;
std::string OSMinorVersion;
@@ -50,6 +61,8 @@ private:
const char* RequiredName;
bool FoundRequiredName;
+ std::string VcInstallDir;
+ std::string VsInstallDir;
};
#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 1424a11..ab5a59b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -82,6 +82,7 @@
#if defined(CMAKE_HAVE_VS_GENERATORS)
#include "cmCallVisualStudioMacro.h"
+#include "cmVisualStudioWCEPlatformParser.h"
#endif
#if !defined(CMAKE_BOOT_MINGW)
@@ -1143,6 +1144,10 @@ void CMakeCommandUsage(const char* program)
<< "Available on Windows only:\n"
<< " comspec - on windows 9x use this for RunCommand\n"
<< " delete_regv key - delete registry value\n"
+ << " env_vs8_wince sdkname - displays a batch file which sets the "
+ "environment for the provided Windows CE SDK installed in VS2005\n"
+ << " env_vs9_wince sdkname - displays a batch file which sets the "
+ "environment for the provided Windows CE SDK installed in VS2008\n"
<< " write_regv key value - write registry value\n"
#else
<< "Available on UNIX only:\n"
@@ -1808,6 +1813,14 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return cmWin32ProcessExecution::Windows9xHack(command.c_str());
}
+ else if (args[1] == "env_vs8_wince" && args.size() == 3)
+ {
+ return cmake::WindowsCEEnvironment("8.0", args[2]);
+ }
+ else if (args[1] == "env_vs9_wince" && args.size() == 3)
+ {
+ return cmake::WindowsCEEnvironment("9.0", args[2]);
+ }
#endif
}
@@ -4001,6 +4014,27 @@ static bool cmakeCheckStampList(const char* stampList)
return true;
}
+//----------------------------------------------------------------------------
+int cmake::WindowsCEEnvironment(const char* version, const std::string& name)
+{
+#if defined(CMAKE_HAVE_VS_GENERATORS)
+ cmVisualStudioWCEPlatformParser parser(name.c_str());
+ parser.ParseVersion(version);
+ if (parser.Found())
+ {
+ std::cout << "@echo off" << std::endl;
+ std::cout << "echo Environment Selection: " << name << std::endl;
+ std::cout << "set PATH=" << parser.GetPathDirectories() << std::endl;
+ std::cout << "set INCLUDE=" << parser.GetIncludeDirectories() <<std::endl;
+ std::cout << "set LIB=" << parser.GetLibraryDirectories() <<std::endl;
+ return 0;
+ }
+#endif
+
+ std::cerr << "Could not find " << name;
+ return -1;
+}
+
// For visual studio 2005 and newer manifest files need to be embeded into
// exe and dll's. This code does that in such a way that incremental linking
// still works.
diff --git a/Source/cmake.h b/Source/cmake.h
index 79e05ca..e5aa076 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -445,6 +445,8 @@ protected:
std::string const& link);
static int ExecuteEchoColor(std::vector<std::string>& args);
static int ExecuteLinkScript(std::vector<std::string>& args);
+ static int WindowsCEEnvironment(const char* version,
+ const std::string& name);
static int VisualStudioLink(std::vector<std::string>& args, int type);
static int VisualStudioLinkIncremental(std::vector<std::string>& args,
int type,
-----------------------------------------------------------------------
Summary of changes:
Source/cmVisualStudioWCEPlatformParser.cxx | 48 ++++++++++++++++++++++++---
Source/cmVisualStudioWCEPlatformParser.h | 13 +++++++
Source/cmake.cxx | 34 +++++++++++++++++++
Source/cmake.h | 2 +
4 files changed, 91 insertions(+), 6 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list