[Cmake-commits] [cmake-commits] hoffman committed cmLocalVisualStudio10Generator.cxx 1.2 1.3 cmLocalVisualStudio10Generator.h 1.1 1.2 cmLocalVisualStudio7Generator.h 1.56 1.57 cmVisualStudio10TargetGenerator.cxx 1.10 1.11 cmVisualStudio10TargetGenerator.h 1.5 1.6 cmVisualStudioGeneratorOptions.cxx 1.1 1.2
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Jul 13 16:58:26 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv16370/Source
Modified Files:
cmLocalVisualStudio10Generator.cxx
cmLocalVisualStudio10Generator.h
cmLocalVisualStudio7Generator.h
cmVisualStudio10TargetGenerator.cxx
cmVisualStudio10TargetGenerator.h
cmVisualStudioGeneratorOptions.cxx
Log Message:
ENH: almost all tests passing in vs 10, commit fixes preprocess and starts vs external project
Index: cmLocalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -C 2 -d -r1.56 -r1.57
*** cmLocalVisualStudio7Generator.h 10 Jul 2009 13:12:36 -0000 1.56
--- cmLocalVisualStudio7Generator.h 13 Jul 2009 20:58:24 -0000 1.57
***************
*** 73,87 ****
cmSourceFile* CreateVCProjBuildRule();
void WriteStampFiles();
void ComputeMaxDirectoryLength(std::string& maxdir,
cmTarget& target);
private:
typedef cmLocalVisualStudio7GeneratorOptions Options;
typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
- // Compute the maximum length full path to the intermediate
- // files directory for any configuration. This is used to construct
- // object file names that do not produce paths that are too long.
- void ReadAndStoreExternalGUID(const char* name,
- const char* path);
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const char* configName);
--- 73,87 ----
cmSourceFile* CreateVCProjBuildRule();
void WriteStampFiles();
+ // Compute the maximum length full path to the intermediate
+ // files directory for any configuration. This is used to construct
+ // object file names that do not produce paths that are too long.
void ComputeMaxDirectoryLength(std::string& maxdir,
cmTarget& target);
+ virtual void ReadAndStoreExternalGUID(const char* name,
+ const char* path);
private:
typedef cmLocalVisualStudio7GeneratorOptions Options;
typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const char* configName);
Index: cmVisualStudio10TargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmVisualStudio10TargetGenerator.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C 2 -d -r1.5 -r1.6
*** cmVisualStudio10TargetGenerator.h 11 Jul 2009 04:05:20 -0000 1.5
--- cmVisualStudio10TargetGenerator.h 13 Jul 2009 20:58:24 -0000 1.6
***************
*** 86,89 ****
--- 86,90 ----
std::string Platform;
std::string GUID;
+ std::string Name;
cmGlobalVisualStudio7Generator* GlobalGenerator;
cmGeneratedFileStream* BuildFileStream;
Index: cmLocalVisualStudio10Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio10Generator.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmLocalVisualStudio10Generator.h 25 Jun 2009 20:41:55 -0000 1.1
--- cmLocalVisualStudio10Generator.h 13 Jul 2009 20:58:24 -0000 1.2
***************
*** 40,44 ****
*/
virtual void Generate();
!
private:
};
--- 40,45 ----
*/
virtual void Generate();
! virtual void ReadAndStoreExternalGUID(const char* name,
! const char* path);
private:
};
Index: cmVisualStudioGeneratorOptions.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmVisualStudioGeneratorOptions.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmVisualStudioGeneratorOptions.cxx 25 Jun 2009 20:41:56 -0000 1.1
--- cmVisualStudioGeneratorOptions.cxx 13 Jul 2009 20:58:24 -0000 1.2
***************
*** 4,7 ****
--- 4,16 ----
#include "cmVisualStudio10TargetGenerator.h"
+ inline std::string cmVisualStudio10GeneratorOptionsEscapeForXML(const char* s)
+ {
+ std::string ret = s;
+ cmSystemTools::ReplaceString(ret, "&", "&");
+ cmSystemTools::ReplaceString(ret, "<", "<");
+ cmSystemTools::ReplaceString(ret, ">", ">");
+ return ret;
+ }
+
inline std::string cmVisualStudioGeneratorOptionsEscapeForXML(const char* s)
{
***************
*** 322,326 ****
}
// Escape this flag for the IDE.
! if(this->Version != 10)
{
define = cmVisualStudioGeneratorOptionsEscapeForXML(define.c_str());
--- 331,339 ----
}
// Escape this flag for the IDE.
! if(this->Version == 10)
! {
! define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str());
! }
! else
{
define = cmVisualStudioGeneratorOptionsEscapeForXML(define.c_str());
Index: cmVisualStudio10TargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmVisualStudio10TargetGenerator.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -C 2 -d -r1.10 -r1.11
*** cmVisualStudio10TargetGenerator.cxx 11 Jul 2009 04:05:20 -0000 1.10
--- cmVisualStudio10TargetGenerator.cxx 13 Jul 2009 20:58:24 -0000 1.11
***************
*** 24,28 ****
#include "cmVisualStudioGeneratorOptions.h"
#include "cmLocalVisualStudio7Generator.h"
-
#include "cmVS10CLFlagTable.h"
#include "cmVS10LinkFlagTable.h"
--- 24,27 ----
***************
*** 30,34 ****
-
cmVisualStudio10TargetGenerator::
cmVisualStudio10TargetGenerator(cmTarget* target,
--- 29,32 ----
***************
*** 36,41 ****
{
this->GlobalGenerator = gg;
- this->GlobalGenerator->CreateGUID(target->GetName());
- this->GUID = this->GlobalGenerator->GetGUID(target->GetName());
this->Target = target;
this->Makefile = target->GetMakefile();
--- 34,37 ----
***************
*** 43,52 ****
--- 39,67 ----
(cmLocalVisualStudio7Generator*)
this->Makefile->GetLocalGenerator();
+ const char* name = this->Target->GetName();
+ if (strncmp(name, "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
+ {
+ cmCustomCommand cc = this->Target->GetPostBuildCommands()[0];
+ const cmCustomCommandLines& cmds = cc.GetCommandLines();
+ this->Name = cmds[0][0];
+ this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
+ }
+ else
+ {
+ this->Name = name;
+ this->GlobalGenerator->CreateGUID(this->Name.c_str());
+ this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
+ }
this->Platform = "|Win32";
this->ComputeObjectNames();
+ this->BuildFileStream = 0;
}
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
{
+ if(!this->BuildFileStream)
+ {
+ return;
+ }
if (this->BuildFileStream->Close())
{
***************
*** 98,105 ****
}
void cmVisualStudio10TargetGenerator::Generate()
! {
// Tell the global generator the name of the project file
! this->Target->SetProperty("GENERATOR_FILE_NAME",this->Target->GetName());
this->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
".vcxproj");
--- 113,121 ----
}
+
void cmVisualStudio10TargetGenerator::Generate()
! {
// Tell the global generator the name of the project file
! this->Target->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str());
this->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
".vcxproj");
***************
*** 107,111 ****
std::string path = mf->GetStartOutputDirectory();
path += "/";
! path += this->Target->GetName();
path += ".vcxproj";
this->BuildFileStream =
--- 123,127 ----
std::string path = mf->GetStartOutputDirectory();
path += "/";
! path += this->Name;
path += ".vcxproj";
this->BuildFileStream =
***************
*** 372,376 ****
std::string path = this->Makefile->GetStartOutputDirectory();
path += "/";
! path += this->Target->GetName();
path += ".vcxproj.filters";
cmGeneratedFileStream fout(path.c_str());
--- 388,392 ----
std::string path = this->Makefile->GetStartOutputDirectory();
path += "/";
! path += this->Name;
path += ".vcxproj.filters";
cmGeneratedFileStream fout(path.c_str());
***************
*** 435,448 ****
this->WriteString("<", 2);
std::string path = source;
! // custom command source are done with relative paths
! // so that the custom command display in the GUI
! // the source groups have to EXACTLY match the string
! // used in the .vcxproj file
! if(sf->GetCustomCommand())
! {
! path = cmSystemTools::RelativePath(
! this->Makefile->GetCurrentOutputDirectory(),
! source.c_str());
! }
this->ConvertToWindowsSlash(path);
(*this->BuildFileStream) << name << " Include=\""
--- 451,457 ----
this->WriteString("<", 2);
std::string path = source;
! path = cmSystemTools::RelativePath(
! this->Makefile->GetCurrentOutputDirectory(),
! source.c_str());
this->ConvertToWindowsSlash(path);
(*this->BuildFileStream) << name << " Include=\""
***************
*** 515,518 ****
--- 524,530 ----
{
std::string sourceFile = (*source)->GetFullPath();
+ sourceFile = cmSystemTools::RelativePath(
+ this->Makefile->GetCurrentOutputDirectory(),
+ sourceFile.c_str());
this->ConvertToWindowsSlash(sourceFile);
// output the source file
***************
*** 643,647 ****
if(configDefines.size())
{
! configDefines += ",";
}
configDefines += ccdefs;
--- 655,659 ----
if(configDefines.size())
{
! configDefines += ";";
}
configDefines += ccdefs;
***************
*** 747,751 ****
cmSystemTools::Error
("CMake can not determine linker language for target:",
! this->Target->GetName());
return;
}
--- 759,763 ----
cmSystemTools::Error
("CMake can not determine linker language for target:",
! this->Name.c_str());
return;
}
***************
*** 804,808 ****
cmSystemTools::Error
("CMake can not determine linker language for target:",
! this->Target->GetName());
return;
}
--- 816,820 ----
cmSystemTools::Error
("CMake can not determine linker language for target:",
! this->Name.c_str());
return;
}
***************
*** 945,949 ****
cmSystemTools::Error
("CMake can not determine linker language for target:",
! this->Target->GetName());
return;
}
--- 957,961 ----
cmSystemTools::Error
("CMake can not determine linker language for target:",
! this->Name.c_str());
return;
}
***************
*** 1028,1032 ****
cmSystemTools::Error
("CMake can not compute cmComputeLinkInformation for target:",
! this->Target->GetName());
return;
}
--- 1040,1044 ----
cmSystemTools::Error
("CMake can not compute cmComputeLinkInformation for target:",
! this->Name.c_str());
return;
}
***************
*** 1225,1236 ****
this->WriteString("<ProjectReference Include=\"", 2);
cmMakefile* mf = dt->GetMakefile();
! std::string path = mf->GetStartOutputDirectory();
! path += "/";
! path += dt->GetName();
! path += ".vcxproj";
(*this->BuildFileStream) << path << "\">\n";
this->WriteString("<Project>", 3);
(*this->BuildFileStream)
! << this->GlobalGenerator->GetGUID(dt->GetName())
<< "</Project>\n";
this->WriteString("</ProjectReference>\n", 2);
--- 1237,1260 ----
this->WriteString("<ProjectReference Include=\"", 2);
cmMakefile* mf = dt->GetMakefile();
! std::string name = dt->GetName();
! std::string path;
! if (strncmp(name.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
! {
! cmCustomCommand cc = dt->GetPostBuildCommands()[0];
! const cmCustomCommandLines& cmds = cc.GetCommandLines();
! path = cmds[0][1];
! name = cmds[0][0].c_str();
! }
! else
! {
! path = mf->GetStartOutputDirectory();
! path += "/";
! path += dt->GetName();
! path += ".vcxproj";
! }
(*this->BuildFileStream) << path << "\">\n";
this->WriteString("<Project>", 3);
(*this->BuildFileStream)
! << this->GlobalGenerator->GetGUID(name.c_str())
<< "</Project>\n";
this->WriteString("</ProjectReference>\n", 2);
Index: cmLocalVisualStudio10Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio10Generator.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmLocalVisualStudio10Generator.cxx 10 Jul 2009 13:12:34 -0000 1.2
--- cmLocalVisualStudio10Generator.cxx 13 Jul 2009 20:58:24 -0000 1.3
***************
*** 20,23 ****
--- 20,68 ----
#include "cmVisualStudio10TargetGenerator.h"
#include "cmGlobalVisualStudio7Generator.h"
+ #include <cm_expat.h>
+ #include "cmXMLParser.h"
+ class cmVS10XMLParser : public cmXMLParser
+ {
+ public:
+ virtual void EndElement(const char* /* name */)
+ {
+ }
+ virtual void CharacterDataHandler(const char* data, int length)
+ {
+ if(this->DoGUID )
+ {
+ this->GUID.assign(data, length);
+ this->DoGUID = false;
+ }
+ }
+ virtual void StartElement(const char* name, const char**)
+ {
+ // once the GUID is found do nothing
+ if(this->GUID.size())
+ {
+ return;
+ }
+ if(strcmp("ProjectGUID", name) == 0)
+ {
+ this->DoGUID = true;
+ }
+ }
+ int InitializeParser()
+ {
+ this->DoGUID = false;
+ int ret = cmXMLParser::InitializeParser();
+ if(ret == 0)
+ {
+ return ret;
+ }
+ // visual studio projects have a strange encoding, but it is
+ // really utf-8
+ XML_SetEncoding(static_cast<XML_Parser>(this->Parser), "utf-8");
+ return 1;
+ }
+ std::string GUID;
+ bool DoGUID;
+ };
+
//----------------------------------------------------------------------------
***************
*** 63,64 ****
--- 108,126 ----
}
+
+ void cmLocalVisualStudio10Generator
+ ::ReadAndStoreExternalGUID(const char* name,
+ const char* path)
+ {
+
+ cmVS10XMLParser parser;
+ parser.ParseFile(path);
+ std::string guidStoreName = name;
+ guidStoreName += "_GUID_CMAKE";
+ // save the GUID in the cache
+ this->GlobalGenerator->GetCMakeInstance()->
+ AddCacheEntry(guidStoreName.c_str(),
+ parser.GUID.c_str(),
+ "Stored GUID",
+ cmCacheManager::INTERNAL);
+ }
More information about the Cmake-commits
mailing list