[cmake-commits] hoffman committed cmGlobalXCodeGenerator.cxx 1.128
1.129 cmGlobalXCodeGenerator.h 1.43 1.44 cmLocalGenerator.cxx
1.172 1.173 cmLocalGenerator.h 1.70 1.71
cmLocalUnixMakefileGenerator3.cxx 1.185 1.186
cmLocalUnixMakefileGenerator3.h 1.65 1.66
cmLocalVisualStudio6Generator.cxx 1.110 1.111
cmLocalVisualStudio6Generator.h 1.15 1.16
cmLocalVisualStudio7Generator.cxx 1.168 1.169
cmLocalVisualStudio7Generator.h 1.32 1.33
cmLocalVisualStudioGenerator.cxx 1.9 1.10
cmLocalVisualStudioGenerator.h 1.4 1.5
cmLocalXCodeGenerator.cxx 1.2 1.3 cmLocalXCodeGenerator.h 1.2
1.3 cmMakefileTargetGenerator.cxx 1.51 1.52
cmMakefileTargetGenerator.h 1.12 1.13 cmTarget.cxx 1.119 1.120
cmTarget.h 1.69 1.70
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Feb 16 16:12:18 EST 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv9088/Source
Modified Files:
cmGlobalXCodeGenerator.cxx cmGlobalXCodeGenerator.h
cmLocalGenerator.cxx cmLocalGenerator.h
cmLocalUnixMakefileGenerator3.cxx
cmLocalUnixMakefileGenerator3.h
cmLocalVisualStudio6Generator.cxx
cmLocalVisualStudio6Generator.h
cmLocalVisualStudio7Generator.cxx
cmLocalVisualStudio7Generator.h
cmLocalVisualStudioGenerator.cxx
cmLocalVisualStudioGenerator.h cmLocalXCodeGenerator.cxx
cmLocalXCodeGenerator.h cmMakefileTargetGenerator.cxx
cmMakefileTargetGenerator.h cmTarget.cxx cmTarget.h
Log Message:
ENH: check in initial conv library stuff
Index: cmLocalUnixMakefileGenerator3.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- cmLocalUnixMakefileGenerator3.h 25 Jan 2007 20:44:52 -0000 1.65
+++ cmLocalUnixMakefileGenerator3.h 16 Feb 2007 21:12:16 -0000 1.66
@@ -246,7 +246,9 @@
{
return !this->SkipAssemblySourceRules;
}
-
+ // Get the directories into which the .o files will go for this target
+ void GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>& dirs);
protected:
// these two methods just compute reasonable values for LibraryOutputPath
// and ExecutableOutputPath
Index: cmLocalVisualStudioGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudioGenerator.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cmLocalVisualStudioGenerator.cxx 18 Jan 2007 21:10:21 -0000 1.9
+++ cmLocalVisualStudioGenerator.cxx 16 Feb 2007 21:12:16 -0000 1.10
@@ -15,7 +15,7 @@
=========================================================================*/
#include "cmLocalVisualStudioGenerator.h"
-
+#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
@@ -178,3 +178,4 @@
}
return script;
}
+
Index: cmMakefileTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmMakefileTargetGenerator.h 14 Dec 2006 19:30:41 -0000 1.12
+++ cmMakefileTargetGenerator.h 16 Feb 2007 21:12:16 -0000 1.13
@@ -60,7 +60,7 @@
return this->NumberOfProgressActions;}
const char *GetTargetName() { return this->TargetName.c_str(); }
-
+ cmTarget* GetTarget() { return this->Target;}
protected:
// create the file and directory etc
Index: cmLocalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cmLocalVisualStudio7Generator.h 1 Feb 2007 20:22:42 -0000 1.32
+++ cmLocalVisualStudio7Generator.h 16 Feb 2007 21:12:16 -0000 1.33
@@ -66,6 +66,10 @@
void SetVersion8() {this->Version = 8;}
void SetPlatformName(const char* n) { this->PlatformName = n;}
virtual void ConfigureFinalPass();
+ void GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs);
+
private:
typedef cmLocalVisualStudio7GeneratorOptions Options;
void ReadAndStoreExternalGUID(const char* name,
Index: cmLocalVisualStudio6Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cmLocalVisualStudio6Generator.h 11 Jul 2006 17:23:02 -0000 1.15
+++ cmLocalVisualStudio6Generator.h 16 Feb 2007 21:12:16 -0000 1.16
@@ -61,7 +61,9 @@
{
return this->CreatedProjectNames;
}
-
+ void GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs);
private:
std::string DSPHeaderTemplate;
std::string DSPFooterTemplate;
Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- cmLocalVisualStudio7Generator.cxx 15 Feb 2007 17:23:42 -0000 1.168
+++ cmLocalVisualStudio7Generator.cxx 16 Feb 2007 21:12:16 -0000 1.169
@@ -1949,3 +1949,16 @@
fout << "\"" << suffix;
}
}
+void cmLocalVisualStudio7Generator::
+GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs)
+{
+ std::string dir = this->Makefile->GetCurrentOutputDirectory();
+ dir += "/";
+ dir += this->GetTargetDirectory(*target);
+ dir += "/";
+ dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory();
+ std::cerr << dir << "\n";
+ dirs.push_back(dir);
+}
Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- cmGlobalXCodeGenerator.cxx 13 Oct 2006 15:53:12 -0000 1.128
+++ cmGlobalXCodeGenerator.cxx 16 Feb 2007 21:12:16 -0000 1.129
@@ -124,6 +124,20 @@
mf->AddDefinition("CMAKE_GENERATOR_CXX", "g++");
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
this->cmGlobalGenerator::EnableLanguage(lang, mf);
+ const char* osxArch =
+ mf->GetDefinition("CMAKE_OSX_ARCHITECTURES");
+ const char* sysroot =
+ mf->GetDefinition("CMAKE_OSX_SYSROOT");
+ if(osxArch && sysroot)
+ {
+ std::cerr <<"EnableLanguage archs\n";
+ this->Architectures.clear();
+ cmSystemTools::ExpandListArgument(std::string(osxArch),
+ this->Architectures);
+ }
+ else
+ std::cerr <<"no EnableLanguage archs\n";
+
}
//----------------------------------------------------------------------------
@@ -2156,9 +2170,6 @@
this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
if(osxArch && sysroot)
{
- this->Architectures.clear();
- cmSystemTools::ExpandListArgument(std::string(osxArch),
- this->Architectures);
if(this->Architectures.size() > 1)
{
buildSettings->AddAttribute("SDKROOT",
@@ -2217,7 +2228,6 @@
this->RootObject->AddAttribute("targets", allTargets);
}
-
//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
@@ -2555,6 +2565,52 @@
return ret;
}
+void cmGlobalXCodeGenerator::
+GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs)
+{
+ std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory();
+ dir += "/";
+ dir += target->GetName();
+ dir += ".build/";
+ dir += this->GetCMakeCFGInitDirectory();
+ dir += "/";
+ if(target->GetType() != cmTarget::EXECUTABLE)
+ {
+ dir += "lib";
+ }
+ dir += target->GetName();
+ if(target->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ dir += ".a";
+ }
+ if(target->GetType() == cmTarget::SHARED_LIBRARY)
+ {
+ dir += ".dylib";
+ }
+ if(target->GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ dir += ".so";
+ }
+ dir += ".build/Objects-normal/";
+ std::string dirsave = dir;
+ if(this->Architectures.size())
+ {
+ for(std::vector<std::string>::iterator i = this->Architectures.begin();
+ i != this->Architectures.end(); ++i)
+ {
+ dir += *i;
+ dirs.push_back(dir);
+ dir = dirsave;
+ }
+ }
+ else
+ {
+ dirs.push_back(dir);
+ }
+}
+
//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator
@@ -2567,6 +2623,7 @@
{
if(config)
{
+
dir += prefix;
dir += config;
dir += suffix;
Index: cmLocalVisualStudioGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudioGenerator.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cmLocalVisualStudioGenerator.h 27 Sep 2006 17:43:46 -0000 1.4
+++ cmLocalVisualStudioGenerator.h 16 Feb 2007 21:12:16 -0000 1.5
@@ -33,7 +33,9 @@
public:
cmLocalVisualStudioGenerator();
virtual ~cmLocalVisualStudioGenerator();
-
+ /** Return the directories into which object files will be put.
+ * There maybe more than one for fat binary systems like OSX.
+ */
protected:
/** Construct a script from the given list of command lines. */
Index: cmLocalXCodeGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalXCodeGenerator.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cmLocalXCodeGenerator.h 16 Mar 2006 15:53:14 -0000 1.2
+++ cmLocalXCodeGenerator.h 16 Feb 2007 21:12:16 -0000 1.3
@@ -32,6 +32,11 @@
cmLocalXCodeGenerator();
virtual ~cmLocalXCodeGenerator();
+ void GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs);
+ // return the source name for the object file
+ virtual std::string GetSourceObjectName(cmSourceFile& );
private:
};
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- cmTarget.h 1 Feb 2007 21:54:49 -0000 1.69
+++ cmTarget.h 16 Feb 2007 21:12:16 -0000 1.70
@@ -261,6 +261,9 @@
// Define the properties
static void DefineProperties(cmake *cm);
+
+ // Compute the OBJECT_FILES property only when requested
+ void ComputeObjectFiles();
private:
/**
Index: cmLocalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- cmLocalVisualStudio6Generator.cxx 23 Jan 2007 16:25:26 -0000 1.110
+++ cmLocalVisualStudio6Generator.cxx 16 Feb 2007 21:12:16 -0000 1.111
@@ -1472,3 +1472,15 @@
options += "\n";
}
}
+
+
+void cmLocalVisualStudio6Generator
+::GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs)
+{
+ std::string dir = this->Makefile->GetCurrentOutputDirectory();
+ dir += "/";
+ dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory();
+ dirs.push_back(dir);
+}
Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- cmMakefileTargetGenerator.cxx 1 Feb 2007 21:56:36 -0000 1.51
+++ cmMakefileTargetGenerator.cxx 16 Feb 2007 21:12:16 -0000 1.52
@@ -1275,4 +1275,3 @@
current += this->NumberOfProgressActions;
delete progressFileStream;
}
-
Index: cmLocalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalXCodeGenerator.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cmLocalXCodeGenerator.cxx 24 Mar 2006 14:15:05 -0000 1.2
+++ cmLocalXCodeGenerator.cxx 16 Feb 2007 21:12:16 -0000 1.3
@@ -1,4 +1,6 @@
#include "cmLocalXCodeGenerator.h"
+#include "cmGlobalXCodeGenerator.h"
+#include "cmSourceFile.h"
cmLocalXCodeGenerator::cmLocalXCodeGenerator()
{
@@ -11,3 +13,26 @@
{
}
+void cmLocalXCodeGenerator::
+GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs)
+{
+ cmGlobalXCodeGenerator* g = (cmGlobalXCodeGenerator*)this->GetGlobalGenerator();
+ g->SetCurrentLocalGenerator(this);
+ g->GetTargetObjectFileDirectories(target,
+ dirs);
+}
+
+ // return the source name for the object file
+std::string cmLocalXCodeGenerator::GetSourceObjectName(cmSourceFile& sf )
+{
+ std::string ret = sf.GetSourceName();
+ std::string::size_type pos = ret.find("/");
+ if(pos == ret.npos)
+ {
+ return ret;
+ }
+ return ret.substr(pos+1);
+}
+
Index: cmLocalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- cmLocalGenerator.h 25 Oct 2006 15:23:03 -0000 1.70
+++ cmLocalGenerator.h 16 Feb 2007 21:12:16 -0000 1.71
@@ -214,7 +214,17 @@
/** Backwards-compatibility version of EscapeForShell. */
std::string EscapeForShellOldStyle(const char* str);
-
+
+ /** Return the directories into which object files will be put.
+ * There maybe more than one for fat binary systems like OSX.
+ */
+ virtual void
+ GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs);
+ // return the source name for the object file
+ virtual std::string GetSourceObjectName(cmSourceFile& );
+
protected:
/** Construct a comment for a custom command. */
Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- cmLocalGenerator.cxx 31 Jan 2007 21:49:25 -0000 1.172
+++ cmLocalGenerator.cxx 16 Feb 2007 21:12:16 -0000 1.173
@@ -2399,3 +2399,15 @@
}
return std::string(&arg[0]);
}
+void
+cmLocalGenerator::GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs)
+{
+ cmSystemTools::Error("GetTargetObjectFileDirectories called on cmLocalGenerator");
+}
+
+std::string cmLocalGenerator::GetSourceObjectName(cmSourceFile& sf)
+{
+ return sf.GetSourceName();
+}
Index: cmGlobalXCodeGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- cmGlobalXCodeGenerator.h 1 Jun 2006 19:51:24 -0000 1.43
+++ cmGlobalXCodeGenerator.h 16 Feb 2007 21:12:16 -0000 1.44
@@ -82,13 +82,16 @@
///! What is the configurations directory variable called?
virtual const char* GetCMakeCFGInitDirectory() { return "."; }
+ void GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>&
+ dirs);
+ void SetCurrentLocalGenerator(cmLocalGenerator*);
private:
cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,
cmSourceGroup* sg);
void CreateGroups(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators);
- void SetCurrentLocalGenerator(cmLocalGenerator*);
std::string XCodeEscapePath(const char* p);
std::string ConvertToRelativeForXCode(const char* p);
std::string ConvertToRelativeForMake(const char* p);
@@ -158,6 +161,7 @@
const char* varNameLang,
const char* varNameSuffix,
const char* default_flags);
+
protected:
virtual const char* GetInstallTargetName() { return "install"; }
virtual const char* GetPackageTargetName() { return "package"; }
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- cmTarget.cxx 1 Feb 2007 21:54:49 -0000 1.119
+++ cmTarget.cxx 16 Feb 2007 21:12:16 -0000 1.120
@@ -256,6 +256,14 @@
"in contrast to a console application for example. This changes "
"how the executable will be linked.");
+ cm->DefineProperty
+ ("OBJECT_FILES", cmProperty::TARGET,
+ "Used to get the resulting list of object files that make up a "
+ "target.",
+ "This can be used to put object files from one library "
+ "into another library. It is a read only property. It "
+ "converts the source list for the target into a list of full "
+ "paths to object names that will be produced by the target.");
// define some properties without documentation
cm->DefineProperty("DEBUG_OUTPUT_NAME", cmProperty::TARGET,0,0);
@@ -529,13 +537,20 @@
void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
{
+ // only allow this to be called once
+ // there is a lazy evaluation of this in ComputeObjectFiles,
+ // that could break backwards compatibility with projects that
+ // use old style source lists.
+ if(this->SourceFiles.size() != 0)
+ {
+ return;
+ }
// this is only done for non install targets
if ((this->TargetTypeValue == cmTarget::INSTALL_FILES)
|| (this->TargetTypeValue == cmTarget::INSTALL_PROGRAMS))
{
return;
}
-
// for each src lists add the classes
for (std::vector<std::string>::const_iterator s = this->SourceLists.begin();
s != this->SourceLists.end(); ++s)
@@ -1160,6 +1175,49 @@
return this->GetProperty(prop, cmProperty::TARGET);
}
+void cmTarget::ComputeObjectFiles()
+{
+ // Force the SourceFiles vector to be populated
+ this->GenerateSourceFilesFromSourceLists(*this->Makefile);
+ std::vector<std::string> dirs;
+ this->Makefile->GetLocalGenerator()->
+ GetTargetObjectFileDirectories(this,
+ dirs);
+ std::string objectFiles;
+ std::string objExtensionLookup1 = "CMAKE_";
+ std::string objExtensionLookup2 = "_OUTPUT_EXTENSION";
+
+ for(std::vector<std::string>::iterator d = dirs.begin();
+ d != dirs.end(); ++d)
+ {
+ for(std::vector<cmSourceFile*>::iterator s = this->SourceFiles.begin();
+ s != this->SourceFiles.end(); ++s)
+ {
+ cmSourceFile* sf = *s;
+ const char* lang = this->Makefile->GetLocalGenerator()->
+ GetGlobalGenerator()->GetLanguageFromExtension(sf->GetSourceExtension().c_str());
+ std::string lookupObj = objExtensionLookup1 + lang;
+ lookupObj += objExtensionLookup2;
+ const char* obj = this->Makefile->GetDefinition(lookupObj.c_str());
+ if(obj)
+ {
+ if(objectFiles.size())
+ {
+ objectFiles += ";";
+ }
+ std::string objFile = *d;
+ objFile += "/";
+ objFile += this->Makefile->GetLocalGenerator()->
+ GetSourceObjectName(*sf);
+ objFile += obj;
+ objectFiles += objFile;
+ }
+ }
+ }
+ this->SetProperty("OBJECT_FILES", objectFiles.c_str());
+}
+
+
const char *cmTarget::GetProperty(const char* prop,
cmProperty::ScopeType scope)
{
@@ -1178,7 +1236,10 @@
// variable in the location.
this->SetProperty("LOCATION", this->GetLocation(0));
}
-
+ if(strcmp(prop, "OBJECT_FILES") == 0)
+ {
+ this->ComputeObjectFiles();
+ }
// Per-configuration location can be computed.
int len = static_cast<int>(strlen(prop));
if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
@@ -1186,7 +1247,6 @@
std::string configName(prop, len-9);
this->SetProperty(prop, this->GetLocation(configName.c_str()));
}
-
// the type property returns what type the target is
if (!strcmp(prop,"TYPE"))
{
Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -d -r1.185 -r1.186
--- cmLocalUnixMakefileGenerator3.cxx 1 Feb 2007 14:57:24 -0000 1.185
+++ cmLocalUnixMakefileGenerator3.cxx 16 Feb 2007 21:12:16 -0000 1.186
@@ -1920,3 +1920,14 @@
}
}
}
+
+
+void cmLocalUnixMakefileGenerator3
+::GetTargetObjectFileDirectories(cmTarget* target,
+ std::vector<std::string>& dirs)
+{
+ std::string dir = this->Makefile->GetCurrentOutputDirectory();
+ dir += "/";
+ dir += this->GetTargetDirectory(*target);
+ dirs.push_back(dir);
+}
More information about the Cmake-commits
mailing list