[cmake-commits] king committed cmDocumentVariables.cxx 1.16 1.17
cmMakefileExecutableTargetGenerator.cxx 1.45 1.46
cmMakefileLibraryTargetGenerator.cxx 1.57 1.58
cmMakefileTargetGenerator.cxx 1.92 1.93
cmMakefileTargetGenerator.h 1.23 1.24
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Feb 27 17:10:47 EST 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv5054/Source
Modified Files:
cmDocumentVariables.cxx
cmMakefileExecutableTargetGenerator.cxx
cmMakefileLibraryTargetGenerator.cxx
cmMakefileTargetGenerator.cxx cmMakefileTargetGenerator.h
Log Message:
ENH: Handle large object file lists on some platforms
- Use a response file when enabled by
CMAKE_<LANG>_USE_RESPONSE_FILE_FOR_OBJECTS
- Enable for C and CXX with cl (MSVC)
- Enable for Fortran with ifort (Intel Fortran)
Index: cmMakefileLibraryTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- cmMakefileLibraryTargetGenerator.cxx 20 Feb 2008 19:56:29 -0000 1.57
+++ cmMakefileLibraryTargetGenerator.cxx 27 Feb 2008 22:10:45 -0000 1.58
@@ -567,6 +567,18 @@
// Determine whether a link script will be used.
bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
+ // Select whether to use a response file for objects.
+ bool useResponseFile = false;
+ {
+ std::string responseVar = "CMAKE_";
+ responseVar += linkLanguage;
+ responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS";
+ if(this->Makefile->IsOn(responseVar.c_str()))
+ {
+ useResponseFile = true;
+ }
+ }
+
// For static libraries there might be archiving rules.
std::vector<std::string> archiveCreateCommands;
std::vector<std::string> archiveAppendCommands;
@@ -605,6 +617,9 @@
// Archiving rules are always run with a link script.
useLinkScript = true;
+ // Archiving rules never use a response file.
+ useResponseFile = false;
+
// Limit the length of individual object lists to less than the
// 32K command line length limit on Windows. We could make this a
// platform file variable but this should work everywhere.
@@ -631,7 +646,18 @@
std::string variableNameExternal;
this->WriteObjectsVariable(variableName, variableNameExternal);
std::string buildObjs;
- if(useLinkScript)
+ if(useResponseFile)
+ {
+ std::string objects;
+ this->WriteObjectsString(objects);
+ std::string objects_rsp =
+ this->CreateResponseFile("objects.rsp", objects, depends);
+ buildObjs = "@";
+ buildObjs += this->Convert(objects_rsp.c_str(),
+ cmLocalGenerator::NONE,
+ cmLocalGenerator::SHELL);
+ }
+ else if(useLinkScript)
{
if(!useArchiveRules)
{
Index: cmDocumentVariables.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentVariables.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cmDocumentVariables.cxx 12 Feb 2008 01:13:21 -0000 1.16
+++ cmDocumentVariables.cxx 27 Feb 2008 22:10:45 -0000 1.17
@@ -1059,6 +1059,8 @@
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_STANDARD_LIBRARIES_INIT",
cmProperty::VARIABLE,0,0);
+ cm->DefineProperty("CMAKE_<LANG>_USE_RESPONSE_FILE_FOR_OBJECTS",
+ cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_EXECUTABLE_SUFFIX_<LANG>",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_EXE_LINK_DYNAMIC_<LANG>_FLAGS",
Index: cmMakefileTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cmMakefileTargetGenerator.h 20 Feb 2008 19:56:29 -0000 1.23
+++ cmMakefileTargetGenerator.h 27 Feb 2008 22:10:45 -0000 1.24
@@ -137,6 +137,13 @@
std::vector<std::string>& makefile_commands,
std::vector<std::string>& makefile_depends);
+ /** Create a response file with the given set of options. Returns
+ the relative path from the target build working directory to the
+ response file name. */
+ std::string CreateResponseFile(const char* name,
+ std::string const& options,
+ std::vector<std::string>& makefile_depends);
+
virtual void CloseFileStreams();
void RemoveForbiddenFlags(const char* flagVar, const char* linkLang,
std::string& linkFlags);
Index: cmMakefileExecutableTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileExecutableTargetGenerator.cxx,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- cmMakefileExecutableTargetGenerator.cxx 20 Feb 2008 19:56:29 -0000 1.45
+++ cmMakefileExecutableTargetGenerator.cxx 27 Feb 2008 22:10:45 -0000 1.46
@@ -328,6 +328,18 @@
}
}
+ // Select whether to use a response file for objects.
+ bool useResponseFile = false;
+ {
+ std::string responseVar = "CMAKE_";
+ responseVar += linkLanguage;
+ responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS";
+ if(this->Makefile->IsOn(responseVar.c_str()))
+ {
+ useResponseFile = true;
+ }
+ }
+
// Expand the rule variables.
{
// Set path conversion for link script shells.
@@ -343,7 +355,18 @@
std::string variableNameExternal;
this->WriteObjectsVariable(variableName, variableNameExternal);
std::string buildObjs;
- if(useLinkScript)
+ if(useResponseFile)
+ {
+ std::string objects;
+ this->WriteObjectsString(objects);
+ std::string objects_rsp =
+ this->CreateResponseFile("objects.rsp", objects, depends);
+ buildObjs = "@";
+ buildObjs += this->Convert(objects_rsp.c_str(),
+ cmLocalGenerator::NONE,
+ cmLocalGenerator::SHELL);
+ }
+ else if(useLinkScript)
{
this->WriteObjectsString(buildObjs);
}
Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- cmMakefileTargetGenerator.cxx 24 Feb 2008 19:05:21 -0000 1.92
+++ cmMakefileTargetGenerator.cxx 27 Feb 2008 22:10:45 -0000 1.93
@@ -1584,6 +1584,30 @@
}
//----------------------------------------------------------------------------
+std::string
+cmMakefileTargetGenerator
+::CreateResponseFile(const char* name, std::string const& options,
+ std::vector<std::string>& makefile_depends)
+{
+ // Create the response file.
+ std::string responseFileNameFull = this->TargetBuildDirectoryFull;
+ responseFileNameFull += "/";
+ responseFileNameFull += name;
+ cmGeneratedFileStream responseStream(responseFileNameFull.c_str());
+ responseStream << options << "\n";
+
+ // Add a dependency so the target will rebuild when the set of
+ // objects changes.
+ makefile_depends.push_back(responseFileNameFull);
+
+ // Construct the name to be used on the command line.
+ std::string responseFileName = this->TargetBuildDirectory;
+ responseFileName += "/";
+ responseFileName += name;
+ return responseFileName;
+}
+
+//----------------------------------------------------------------------------
const char* cmMakefileTargetGenerator::GetFortranModuleDirectory()
{
// Compute the module directory.
More information about the Cmake-commits
mailing list