Re: [cmake-developers] WindowsCE

2012-11-30 Thread Patrick Gansterer

On Thu, 29 Nov 2012 14:10:12 -0500, Brad King wrote:

On 11/29/2012 10:39 AM, Patrick Gansterer wrote:

I've created a patch and attached it.


Applied:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b558ecb5


Thanks. I've added a few lines abour the usage of the new features at 
http://www.cmake.org/Wiki/CMake_Cross_Compiling#Cross_compilation_for_Windows_CE.


I also tried additional Windows CE SDKs and found a few problems, which 
have been fixed in 
https://gitorious.org/~paroga/cmake/parogas-cmake/commits/ce.


-- Patrick

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] WindowsCE

2012-11-30 Thread Brad King
On 11/30/2012 09:25 AM, Patrick Gansterer wrote:
 I also tried additional Windows CE SDKs and found a few problems, which 
 have been fixed in 
 https://gitorious.org/~paroga/cmake/parogas-cmake/commits/ce.

Thanks.  The new compiler id approach looks cleaner too.
Merged to 'next' for testing:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5cd0db5e

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] WindowsCE

2012-11-29 Thread Patrick Gansterer

On Wed, 28 Nov 2012 09:08:12 -0500, Brad King wrote:

On 11/28/2012 09:03 AM, Patrick Gansterer wrote:

It looks like you're adding new

cmake -E windowsce_environment8
cmake -E windowsce_environment9

commands that print out the environment settings.  That looks okay
to me, but is there no vsvars32.bat equivalent?


No, that's the reason for this. Any better name for this commands?


I have no strong preference, but perhaps

 cmake -E env_vs8_wince
 cmake -E env_vs9_wince

to set a precedent for env_ commands that generate environments.


I've created a patch and attached it.

-- PatrickFrom 67fabc0fa0a6fa62ec74eacd494793ade3ac3e45 Mon Sep 17 00:00:00 2001
From: Patrick Gansterer par...@paroga.com
Date: Thu, 29 Nov 2012 16:36:20 +0100
Subject: [PATCH] Add command to generate environment for a Windows CE SDK

---
 Source/cmVisualStudioWCEPlatformParser.cxx | 48 ++
 Source/cmVisualStudioWCEPlatformParser.h   | 13 
 Source/cmake.cxx   | 34 +
 Source/cmake.h |  2 ++
 4 files changed, 91 insertions(+), 6 deletions(-)

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::vectorstd::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;
   

Re: [cmake-developers] WindowsCE

2012-11-29 Thread Brad King
On 11/29/2012 10:39 AM, Patrick Gansterer wrote:
 I've created a patch and attached it.

Applied:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b558ecb5

Thanks!
-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] WindowsCE

2012-11-28 Thread Brad King
On 11/28/2012 09:03 AM, Patrick Gansterer wrote:
 It looks like you're adding new

 cmake -E windowsce_environment8
 cmake -E windowsce_environment9

 commands that print out the environment settings.  That looks okay
 to me, but is there no vsvars32.bat equivalent?
 
 No, that's the reason for this. Any better name for this commands?

I have no strong preference, but perhaps

 cmake -E env_vs8_wince
 cmake -E env_vs9_wince

to set a precedent for env_ commands that generate environments.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


[cmake-developers] WindowsCE

2012-11-27 Thread Patrick Gansterer

Hi,

since CMake 2.8.10 it's possible to build for WindowsCE via the NMake 
Makefile. But this needs some special preperation of the environment 
variables. My last changed added parsing support for 
WCE.VCPlatform.config, where this information is stored. Qt has a 
special tool (http://qt.gitorious.org/qt/qt/trees/4.8/tools/checksdk) 
for extracting this information. I'd like to add a similar functionality 
to make the environment setup easier.
I attached a first version of a possible solution. Maybe someone can 
give me some early feedack before I add documentation and so on (it 
needs rebase too), because I'm not sure if that is a good place for this 
kind of stuff.


-- Patrick
diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx
index 270ee0c..637ed01 100644
--- a/Source/cmVisualStudioWCEPlatformParser.cxx
+++ b/Source/cmVisualStudioWCEPlatformParser.cxx
@@ -15,18 +15,21 @@
 
 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);
 
   const std::string configFilename =
-vsInstallPath + /VC/vcpackages/WCE.VCPlatform.config;
+this-VcInstallDir + /vcpackages/WCE.VCPlatform.config;
 
   return this-ParseFile(configFilename.c_str());
 }
@@ -93,6 +96,24 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
   this-Macros[name] = value;
   }
 }
+  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 +158,14 @@ 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, \\, /);
+  return ret;
+}
diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h
index 60de01e..64e7205 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::vectorstd::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:
 
   bool FoundRequiredName;
   const char* RequiredName;
+  std::string VcInstallDir;
+  std::string VsInstallDir;
 };
 
 #endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 1424a11..77ccc69 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)
@@ -1689,6 +1690,14 @@ int cmake::ExecuteCMakeCommand(std::vectorstd::string args)
   {
   return cmake::VisualStudioLink(args, 2);
   }
+else if (args[1] == windowsce_environment8