many fixes and cleanup and features

This commit is contained in:
Ken Martin 2001-04-24 16:49:12 -04:00
parent b5746484e4
commit 73f04d1409
36 changed files with 640 additions and 453 deletions

View File

@ -89,10 +89,6 @@ SOURCE=.\cmCacheManager.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmClassFile.cxx
# End Source File
# Begin Source File
SOURCE=.\cmCommands.cxx SOURCE=.\cmCommands.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -129,288 +125,152 @@ SOURCE=.\cmRegularExpression.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmSourceFile.cxx
# End Source File
# Begin Source File
SOURCE=.\cmSourceGroup.cxx SOURCE=.\cmSourceGroup.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmSystemTools.cxx SOURCE=.\cmSystemTools.cxx
# End Source File # End Source File
# Begin Source File
SOURCE=.\cmTarget.cxx
# End Source File
# End Group # End Group
# Begin Group "Header Files" # Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl" # PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File # Begin Source File
SOURCE=..\cmAbstractFilesCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmAbstractFilesCommand.h SOURCE=.\cmAbstractFilesCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmAddTargetCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmAddTargetCommand.h SOURCE=.\cmAddTargetCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmAuxSourceDirectoryCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmAuxSourceDirectoryCommand.h SOURCE=.\cmAuxSourceDirectoryCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmCacheManager.h
# End Source File
# Begin Source File
SOURCE=.\cmCacheManager.h SOURCE=.\cmCacheManager.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmClassFile.h
# End Source File
# Begin Source File
SOURCE=.\cmClassFile.h
# End Source File
# Begin Source File
SOURCE=..\cmCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmCommand.h SOURCE=.\cmCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmDirectory.h
# End Source File
# Begin Source File
SOURCE=.\cmDirectory.h SOURCE=.\cmDirectory.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmDSPMakefile.h
# End Source File
# Begin Source File
SOURCE=.\cmDSPMakefile.h SOURCE=.\cmDSPMakefile.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmDSWMakefile.h
# End Source File
# Begin Source File
SOURCE=.\cmDSWMakefile.h SOURCE=.\cmDSWMakefile.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmExecutablesCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmExecutablesCommand.h SOURCE=.\cmExecutablesCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmFindIncludeCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmFindIncludeCommand.h SOURCE=.\cmFindIncludeCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmFindLibraryCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmFindLibraryCommand.h SOURCE=.\cmFindLibraryCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmFindProgramCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmFindProgramCommand.h SOURCE=.\cmFindProgramCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmIncludeDirectoryCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmIncludeDirectoryCommand.h SOURCE=.\cmIncludeDirectoryCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmLibraryCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmLibraryCommand.h SOURCE=.\cmLibraryCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmLinkDirectoriesCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmLinkDirectoriesCommand.h SOURCE=.\cmLinkDirectoriesCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmLinkLibrariesCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmLinkLibrariesCommand.h SOURCE=.\cmLinkLibrariesCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmMakeDepend.h
# End Source File
# Begin Source File
SOURCE=.\cmMakeDepend.h SOURCE=.\cmMakeDepend.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmMakefile.h
# End Source File
# Begin Source File
SOURCE=.\cmMakefile.h SOURCE=.\cmMakefile.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmMakefileGenerator.h
# End Source File
# Begin Source File
SOURCE=.\cmMakefileGenerator.h SOURCE=.\cmMakefileGenerator.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmMSProjectGenerator.h
# End Source File
# Begin Source File
SOURCE=.\cmMSProjectGenerator.h SOURCE=.\cmMSProjectGenerator.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmProjectCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmProjectCommand.h SOURCE=.\cmProjectCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmRegularExpression.h
# End Source File
# Begin Source File
SOURCE=.\cmRegularExpression.h SOURCE=.\cmRegularExpression.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\cmSourceFilesCommand.h
# End Source File
# Begin Source File
SOURCE=.\cmSourceFilesCommand.h
# End Source File
# Begin Source File
SOURCE=..\cmSourceFilesRequireCommand.h SOURCE=..\cmSourceFilesRequireCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmSourceFilesRequireCommand.h
# End Source File
# Begin Source File
SOURCE=..\cmStandardIncludes.h SOURCE=..\cmStandardIncludes.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmStandardIncludes.h
# End Source File
# Begin Source File
SOURCE=..\cmSubdirCommand.h SOURCE=..\cmSubdirCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmSubdirCommand.h
# End Source File
# Begin Source File
SOURCE=..\cmSystemTools.h SOURCE=..\cmSystemTools.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmSystemTools.h
# End Source File
# Begin Source File
SOURCE=..\cmTestsCommand.h SOURCE=..\cmTestsCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmTestsCommand.h
# End Source File
# Begin Source File
SOURCE=..\cmUnixDefinesCommand.h SOURCE=..\cmUnixDefinesCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmUnixDefinesCommand.h
# End Source File
# Begin Source File
SOURCE=..\cmUnixLibrariesCommand.h SOURCE=..\cmUnixLibrariesCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmUnixLibrariesCommand.h
# End Source File
# Begin Source File
SOURCE=..\cmUnixMakefileGenerator.h SOURCE=..\cmUnixMakefileGenerator.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmUnixMakefileGenerator.h
# End Source File
# Begin Source File
SOURCE=..\cmWin32DefinesCommand.h SOURCE=..\cmWin32DefinesCommand.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\cmWin32DefinesCommand.h
# End Source File
# Begin Source File
SOURCE=..\cmWin32LibrariesCommand.h SOURCE=..\cmWin32LibrariesCommand.h
# End Source File # End Source File
# Begin Source File
SOURCE=.\cmWin32LibrariesCommand.h
# End Source File
# End Group # End Group
# End Target # End Target
# End Project # End Project

View File

@ -289,7 +289,7 @@ bool CMakeSetupDialog::Browse(CString &result, const char *title)
LPITEMIDLIST pidl = SHBrowseForFolder(&bi); LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
bool bSuccess = (bool)SHGetPathFromIDList(pidl, szPathName); bool bSuccess = (SHGetPathFromIDList(pidl, szPathName) ? true : false);
if(bSuccess) if(bSuccess)
{ {
result = szPathName; result = szPathName;
@ -406,17 +406,17 @@ void CMakeSetupDialog::OnBuildProjects()
// copy from the cache manager to the cache edit list box // copy from the cache manager to the cache edit list box
void CMakeSetupDialog::FillCacheEditorFromCacheManager() void CMakeSetupDialog::FillCacheEditorFromCacheManager()
{ {
cmCacheManager::CacheEntryMap cache = const cmCacheManager::CacheEntryMap &cache =
cmCacheManager::GetInstance()->GetCacheMap(); cmCacheManager::GetInstance()->GetCacheMap();
for(cmCacheManager::CacheEntryMap::iterator i = cache.begin(); for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
i != cache.end(); ++i) i != cache.end(); ++i)
{ {
const char* key = i->first.c_str(); const char* key = i->first.c_str();
cmCacheManager::CacheEntry& value = i->second; const cmCacheManager::CacheEntry& value = i->second;
switch(value.m_Type ) switch(value.m_Type )
{ {
case cmCacheManager::BOOL: case cmCacheManager::BOOL:
if(cmCacheManager::GetInstance()->IsOn(value.m_Value.c_str())) if(cmCacheManager::GetInstance()->IsOn(key))
{ {
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
"ON", "ON",
@ -451,7 +451,6 @@ void CMakeSetupDialog::FillCacheEditorFromCacheManager()
// copy from the list box to the cache manager // copy from the list box to the cache manager
void CMakeSetupDialog::FillCacheManagerFromCacheEditor() void CMakeSetupDialog::FillCacheManagerFromCacheEditor()
{ {
cmCacheManager::CacheEntryMap cache =
cmCacheManager::GetInstance()->GetCacheMap(); cmCacheManager::GetInstance()->GetCacheMap();
std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems(); std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems();
for(std::set<CPropertyItem*>::iterator i = items.begin(); for(std::set<CPropertyItem*>::iterator i = items.begin();
@ -465,9 +464,12 @@ void CMakeSetupDialog::FillCacheManagerFromCacheEditor()
} }
else else
{ {
cmCacheManager::CacheEntryMap::iterator p = cmCacheManager::CacheEntry *entry =
cache.find((const char*)item->m_propName); cmCacheManager::GetInstance()->GetCacheEntry((const char*)item->m_propName);
(*p).second.m_Value = item->m_curValue; if (entry)
{
entry->m_Value = item->m_curValue;
}
} }
} }
} }

View File

@ -17,11 +17,12 @@ cmMakeDepend.o \
cmMakefile.o \ cmMakefile.o \
cmMakefileGenerator.o \ cmMakefileGenerator.o \
cmRegularExpression.o \ cmRegularExpression.o \
cmClassFile.o \ cmSourceFile.o \
cmSystemTools.o \ cmSystemTools.o \
cmDirectory.o \ cmDirectory.o \
cmUnixMakefileGenerator.o \ cmUnixMakefileGenerator.o \
cmCommands.o \ cmCommands.o \
cmTarget.o \
cmCustomCommand.o \ cmCustomCommand.o \
cmCacheManager.o \ cmCacheManager.o \
cmSourceGroup.o cmSourceGroup.o
@ -35,11 +36,12 @@ cmMakefile.o : $(DEPENDS)
cmMakefileGenerator.o : $(DEPENDS) cmMakefileGenerator.o : $(DEPENDS)
cmAuxSourceDirectoryCommand.o : $(DEPENDS) cmAuxSourceDirectoryCommand.o : $(DEPENDS)
cmRegularExpression.o : $(DEPENDS) cmRegularExpression.o : $(DEPENDS)
cmClassFile.o : $(DEPENDS) cmSourceFile.o : $(DEPENDS)
cmDirectory.o : $(DEPENDS) cmDirectory.o : $(DEPENDS)
cmCustomCommand.o : $(DEPENDS) cmCustomCommand.o : $(DEPENDS)
cmUnixMakefileGenerator.o : $(DEPENDS) cmUnixMakefileGenerator.o : $(DEPENDS)
cmCommands.o : $(DEPENDS) cmCommands.o : $(DEPENDS)
cmTarget.o : $(DEPENDS)
cmCacheManager.o : $(DEPENDS) cmCacheManager.o : $(DEPENDS)
cmSourceGroup.o : $(DEPENDS) cmSourceGroup.o : $(DEPENDS)

View File

@ -23,19 +23,19 @@ bool cmAbstractFilesCommand::Invoke(std::vector<std::string>& args)
this->SetError("called with incorrect number of arguments"); this->SetError("called with incorrect number of arguments");
return false; return false;
} }
cmMakefile::ClassMap &Classes = m_Makefile->GetClasses(); cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::iterator j = args.begin(); for(std::vector<std::string>::iterator j = args.begin();
j != args.end(); ++j) j != args.end(); ++j)
{ {
for(cmMakefile::ClassMap::iterator l = Classes.begin(); for(cmMakefile::SourceMap::iterator l = Classes.begin();
l != Classes.end(); l++) l != Classes.end(); l++)
{ {
for(std::vector<cmClassFile>::iterator i = l->second.begin(); for(std::vector<cmSourceFile>::iterator i = l->second.begin();
i != l->second.end(); i++) i != l->second.end(); i++)
{ {
if(i->m_ClassName == (*j)) if(i->GetSourceName() == (*j))
{ {
i->m_AbstractClass = true; i->SetIsAnAbstractClass(true);
} }
} }
} }

View File

@ -49,10 +49,10 @@ bool cmAuxSourceDirectoryCommand::Invoke(std::vector<std::string>& args)
fullname += file; fullname += file;
// add the file as a class file so // add the file as a class file so
// depends can be done // depends can be done
cmClassFile cmfile; cmSourceFile cmfile;
cmfile.SetName(fullname.c_str(), m_Makefile->GetCurrentDirectory()); cmfile.SetName(fullname.c_str(), m_Makefile->GetCurrentDirectory());
cmfile.m_AbstractClass = false; cmfile.SetIsAnAbstractClass(false);
m_Makefile->AddClass(cmfile,args[1].c_str()); m_Makefile->AddSource(cmfile,args[1].c_str());
} }
} }
} }

View File

@ -128,11 +128,11 @@ void cmCablePackageCommand::FinalPass()
// Add a rule to build the generated package. // Add a rule to build the generated package.
std::string fileName = "Cxx/"+m_PackageName+"_cxx"; std::string fileName = "Cxx/"+m_PackageName+"_cxx";
std::string filePath = m_Makefile->GetStartOutputDirectory(); std::string filePath = m_Makefile->GetStartOutputDirectory();
cmClassFile file; cmSourceFile file;
file.m_AbstractClass = false; file.SetIsAnAbstractClass(false);
file.m_HeaderFileOnly = false; file.SetIsAHeaderFileOnly(false);
file.SetName(fileName.c_str(), filePath.c_str(), "cxx", false); file.SetName(fileName.c_str(), filePath.c_str(), "cxx", false);
m_Makefile->AddClass(file, m_PackageName.c_str()); m_Makefile->AddSource(file, m_PackageName.c_str());
} }

View File

@ -24,8 +24,8 @@ void cmCableSourceFilesCommand::FinalPass()
std::string fileName = "Cxx/"; std::string fileName = "Cxx/";
fileName += cablePackage->GetPackageName(); fileName += cablePackage->GetPackageName();
fileName += "_cxx"; fileName += "_cxx";
cmClassFile *ci = m_Makefile->GetClass(cablePackage->GetPackageName(), cmSourceFile *ci = m_Makefile->GetSource(cablePackage->GetPackageName(),
fileName.c_str()); fileName.c_str());
if(ci == 0) if(ci == 0)
{ return; } { return; }
@ -36,7 +36,7 @@ void cmCableSourceFilesCommand::FinalPass()
f != m_Entries.end(); ++f) f != m_Entries.end(); ++f)
{ {
std::string header = *f+".h"; std::string header = *f+".h";
ci->m_Depends.push_back(header); ci->GetDepends().push_back(header);
} }
} }

View File

@ -96,7 +96,7 @@ bool cmCacheManager::LoadCache(cmMakefile* mf)
return true; return true;
} }
bool cmCacheManager::SaveCache(cmMakefile* mf) bool cmCacheManager::SaveCache(cmMakefile* mf) const
{ {
std::string cacheFile = mf->GetHomeOutputDirectory(); std::string cacheFile = mf->GetHomeOutputDirectory();
cacheFile += "/CMakeCache.txt"; cacheFile += "/CMakeCache.txt";
@ -119,7 +119,7 @@ bool cmCacheManager::SaveCache(cmMakefile* mf)
<< "# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.\n" << "# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.\n"
<< "# VALUE is the current value for the KEY.\n\n"; << "# VALUE is the current value for the KEY.\n\n";
for( std::map<std::string, CacheEntry>::iterator i = m_Cache.begin(); for( std::map<std::string, CacheEntry>::const_iterator i = m_Cache.begin();
i != m_Cache.end(); ++i) i != m_Cache.end(); ++i)
{ {
CacheEntryType t = (*i).second.m_Type; CacheEntryType t = (*i).second.m_Type;
@ -151,34 +151,43 @@ void cmCacheManager::AddCacheEntry(const char* key,
m_Cache[key] = e; m_Cache[key] = e;
} }
const char* cmCacheManager::GetCacheValue(const char* key) cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* key)
{ {
if(m_Cache.count(key)) if(m_Cache.count(key))
{ {
return m_Cache[key].m_Value.c_str(); return &(m_Cache.find(key)->second);
}
return 0;
}
const char* cmCacheManager::GetCacheValue(const char* key) const
{
if(m_Cache.count(key))
{
return m_Cache.find(key)->second.m_Value.c_str();
} }
return 0; return 0;
} }
bool cmCacheManager::IsOn(const char* key) bool cmCacheManager::IsOn(const char* key) const
{ {
if(!m_Cache.count(key)) if(!m_Cache.count(key))
{ {
return false; return false;
} }
std::string &v = m_Cache[key].m_Value; const std::string &v = m_Cache.find(key)->second.m_Value;
return (v == "ON" || v == "on" || v == "1" || v == "true" || v == "yev" return (v == "ON" || v == "on" || v == "1" || v == "true" || v == "yev"
|| v == "TRUE" || v == "True" || v == "y" || v == "Y"); || v == "TRUE" || v == "True" || v == "y" || v == "Y");
} }
void cmCacheManager::PrintCache(std::ostream& out) void cmCacheManager::PrintCache(std::ostream& out) const
{ {
out << "=================================================" << std::endl; out << "=================================================" << std::endl;
out << "CMakeCache Contents:" << std::endl; out << "CMakeCache Contents:" << std::endl;
for(std::map<std::string, CacheEntry>::iterator i = m_Cache.begin(); for(std::map<std::string, CacheEntry>::const_iterator i = m_Cache.begin();
i != m_Cache.end(); ++i) i != m_Cache.end(); ++i)
{ {
out << (*i).first.c_str() << " = " << (*i).second.m_Value.c_str() << std::endl; out << (*i).first.c_str() << " = " << (*i).second.m_Value.c_str() << std::endl;

View File

@ -35,8 +35,8 @@ public:
std::string m_Value; std::string m_Value;
CacheEntryType m_Type; CacheEntryType m_Type;
}; };
typedef std::map<std::string, CacheEntry> CacheEntryMap;
public: public:
typedef std::map<std::string, CacheEntry> CacheEntryMap;
/** /**
* Types for the cache entries. These are useful as * Types for the cache entries. These are useful as
* hints for a cache editor program. Path should bring * hints for a cache editor program. Path should bring
@ -53,7 +53,7 @@ public:
bool LoadCache(cmMakefile*); bool LoadCache(cmMakefile*);
//! Save cache for given makefile. Saves to ouput home CMakeCache.txt //! Save cache for given makefile. Saves to ouput home CMakeCache.txt
bool SaveCache(cmMakefile*); bool SaveCache(cmMakefile*) const;
//! Add an entry into the cache //! Add an entry into the cache
void AddCacheEntry(const char* key, const char* value, CacheEntryType type); void AddCacheEntry(const char* key, const char* value, CacheEntryType type);
@ -64,18 +64,22 @@ public:
//! Remove an entry from the cache //! Remove an entry from the cache
void RemoveCacheEntry(const char* key); void RemoveCacheEntry(const char* key);
//! Print the cache to a stream
CacheEntry *GetCacheEntry(const char *key);
//! Get a value from the cache given a key //! Get a value from the cache given a key
const char* GetCacheValue(const char* key); const char* GetCacheValue(const char* key) const;
//! Test a boolean cache entry to see if it is true or false, returns false //! Test a boolean cache entry to see if it is true or false, returns false
// if no entry. // if no entry.
bool IsOn(const char*); bool IsOn(const char*) const;
//! Print the cache to a stream //! Print the cache to a stream
void PrintCache(std::ostream&); void PrintCache(std::ostream&) const;
//! Get the cache map ivar. //! Get the cache map ivar.
CacheEntryMap GetCacheMap() { return m_Cache; } const CacheEntryMap &GetCacheMap() const { return m_Cache; }
private: private:
static cmCacheManager* s_Instance; static cmCacheManager* s_Instance;
CacheEntryMap m_Cache; CacheEntryMap m_Cache;

View File

@ -38,7 +38,8 @@
#include "cmCableInstantiateClassCommand.cxx" #include "cmCableInstantiateClassCommand.cxx"
#include "cmFindFileCommand.cxx" #include "cmFindFileCommand.cxx"
#include "cmWrapExcludeFilesCommand.cxx" #include "cmWrapExcludeFilesCommand.cxx"
#include "cmWrapTclCommand.cxx" #include "cmVTKWrapPythonCommand.cxx"
#include "cmVTKWrapTclCommand.cxx"
#include "cmBuildSharedLibrariesCommand.cxx" #include "cmBuildSharedLibrariesCommand.cxx"
#include "cmUtilitySourceCommand.cxx" #include "cmUtilitySourceCommand.cxx"
#include "cmIncludeRegularExpressionCommand.cxx" #include "cmIncludeRegularExpressionCommand.cxx"
@ -83,7 +84,8 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmCableInstantiateClassCommand); commands.push_back(new cmCableInstantiateClassCommand);
commands.push_back(new cmFindFileCommand); commands.push_back(new cmFindFileCommand);
commands.push_back(new cmWrapExcludeFilesCommand); commands.push_back(new cmWrapExcludeFilesCommand);
commands.push_back(new cmWrapTclCommand); commands.push_back(new cmVTKWrapPythonCommand);
commands.push_back(new cmVTKWrapTclCommand);
commands.push_back(new cmBuildSharedLibrariesCommand); commands.push_back(new cmBuildSharedLibrariesCommand);
commands.push_back(new cmUtilitySourceCommand); commands.push_back(new cmUtilitySourceCommand);
commands.push_back(new cmIncludeRegularExpressionCommand); commands.push_back(new cmIncludeRegularExpressionCommand);

View File

@ -87,8 +87,8 @@ void cmDSPMakefile::OutputDSPFile()
m_CreatedProjectNames.clear(); m_CreatedProjectNames.clear();
// build any targets // build any targets
const cmTargets &tgts = m_Makefile->GetTargets(); cmTargets &tgts = m_Makefile->GetTargets();
for(cmTargets::const_iterator l = tgts.begin(); for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
if (l->second.IsALibrary()) if (l->second.IsALibrary())
@ -103,8 +103,7 @@ void cmDSPMakefile::OutputDSPFile()
} }
} }
void cmDSPMakefile::CreateSingleDSP(const char *lname, void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
const cmTarget &target)
{ {
std::string fname; std::string fname;
fname = m_Makefile->GetStartOutputDirectory(); fname = m_Makefile->GetStartOutputDirectory();
@ -186,7 +185,7 @@ void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
void cmDSPMakefile::WriteDSPFile(std::ostream& fout, void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
const char *libName, const char *libName,
const cmTarget &target) cmTarget &target)
{ {
// Write the DSP file's header. // Write the DSP file's header.
this->WriteDSPHeader(fout, libName); this->WriteDSPHeader(fout, libName);
@ -195,15 +194,15 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups(); std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
// get the classes from the source lists then add them to the groups // get the classes from the source lists then add them to the groups
std::vector<cmClassFile> classes = target.GenerateSourceFilesFromSourceLists(*m_Makefile);
m_Makefile->GetClassesFromSourceLists(target.GetSourceLists()); std::vector<cmSourceFile> classes = target.GetSourceFiles();
for(std::vector<cmClassFile>::iterator i = classes.begin(); for(std::vector<cmSourceFile>::iterator i = classes.begin();
i != classes.end(); i++) i != classes.end(); i++)
{ {
if(!i->m_HeaderFileOnly) if(!i->IsAHeaderFileOnly())
{ {
// Add the file to the list of sources. // Add the file to the list of sources.
std::string source = i->m_FullPath; std::string source = i->GetFullPath();
cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(), cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(),
sourceGroups); sourceGroups);
sourceGroup.AddSource(source.c_str()); sourceGroup.AddSource(source.c_str());

View File

@ -67,9 +67,9 @@ private:
std::string m_DSPFooterTemplate; std::string m_DSPFooterTemplate;
std::vector<std::string> m_CreatedProjectNames; std::vector<std::string> m_CreatedProjectNames;
void CreateSingleDSP(const char *lname, const cmTarget &tgt); void CreateSingleDSP(const char *lname, cmTarget &tgt);
void WriteDSPFile(std::ostream& fout, void WriteDSPFile(std::ostream& fout,
const char *libName, const cmTarget &tgt); const char *libName, cmTarget &tgt);
void WriteDSPBeginGroup(std::ostream& fout, void WriteDSPBeginGroup(std::ostream& fout,
const char* group, const char* group,
const char* filter); const char* filter);

View File

@ -87,8 +87,8 @@ void cmDSPMakefile::OutputDSPFile()
m_CreatedProjectNames.clear(); m_CreatedProjectNames.clear();
// build any targets // build any targets
const cmTargets &tgts = m_Makefile->GetTargets(); cmTargets &tgts = m_Makefile->GetTargets();
for(cmTargets::const_iterator l = tgts.begin(); for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
if (l->second.IsALibrary()) if (l->second.IsALibrary())
@ -103,8 +103,7 @@ void cmDSPMakefile::OutputDSPFile()
} }
} }
void cmDSPMakefile::CreateSingleDSP(const char *lname, void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
const cmTarget &target)
{ {
std::string fname; std::string fname;
fname = m_Makefile->GetStartOutputDirectory(); fname = m_Makefile->GetStartOutputDirectory();
@ -186,7 +185,7 @@ void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
void cmDSPMakefile::WriteDSPFile(std::ostream& fout, void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
const char *libName, const char *libName,
const cmTarget &target) cmTarget &target)
{ {
// Write the DSP file's header. // Write the DSP file's header.
this->WriteDSPHeader(fout, libName); this->WriteDSPHeader(fout, libName);
@ -195,15 +194,15 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups(); std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
// get the classes from the source lists then add them to the groups // get the classes from the source lists then add them to the groups
std::vector<cmClassFile> classes = target.GenerateSourceFilesFromSourceLists(*m_Makefile);
m_Makefile->GetClassesFromSourceLists(target.GetSourceLists()); std::vector<cmSourceFile> classes = target.GetSourceFiles();
for(std::vector<cmClassFile>::iterator i = classes.begin(); for(std::vector<cmSourceFile>::iterator i = classes.begin();
i != classes.end(); i++) i != classes.end(); i++)
{ {
if(!i->m_HeaderFileOnly) if(!i->IsAHeaderFileOnly())
{ {
// Add the file to the list of sources. // Add the file to the list of sources.
std::string source = i->m_FullPath; std::string source = i->GetFullPath();
cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(), cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(),
sourceGroups); sourceGroups);
sourceGroup.AddSource(source.c_str()); sourceGroup.AddSource(source.c_str());

View File

@ -67,9 +67,9 @@ private:
std::string m_DSPFooterTemplate; std::string m_DSPFooterTemplate;
std::vector<std::string> m_CreatedProjectNames; std::vector<std::string> m_CreatedProjectNames;
void CreateSingleDSP(const char *lname, const cmTarget &tgt); void CreateSingleDSP(const char *lname, cmTarget &tgt);
void WriteDSPFile(std::ostream& fout, void WriteDSPFile(std::ostream& fout,
const char *libName, const cmTarget &tgt); const char *libName, cmTarget &tgt);
void WriteDSPBeginGroup(std::ostream& fout, void WriteDSPBeginGroup(std::ostream& fout,
const char* group, const char* group,
const char* filter); const char* filter);

View File

@ -54,20 +54,23 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
{ {
this->AddSearchPath(j->c_str()); this->AddSearchPath(j->c_str());
} }
// Now create cmDependInformation objects for files in the directory // Now create cmDependInformation objects for files in the directory
cmMakefile::ClassMap &Classes = m_Makefile->GetClasses(); cmTargets &tgts = m_Makefile->GetTargets();
for(cmMakefile::ClassMap::iterator l = Classes.begin(); for(cmTargets::iterator l = tgts.begin();
l != Classes.end(); l++) l != tgts.end(); l++)
{ {
for(std::vector<cmClassFile>::iterator i = l->second.begin(); l->second.GenerateSourceFilesFromSourceLists(*m_Makefile);
i != l->second.end(); ++i) std::vector<cmSourceFile> &classes = l->second.GetSourceFiles();
for(std::vector<cmSourceFile>::iterator i = classes.begin();
i != classes.end(); ++i)
{ {
if(!i->m_HeaderFileOnly) if(!i->GetIsAHeaderFileOnly())
{ {
cmDependInformation* info = new cmDependInformation; cmDependInformation* info = new cmDependInformation;
info->m_FullPath = this->FullPath(i->m_FullPath.c_str()); info->m_FullPath = this->FullPath(i->GetFullPath().c_str());
this->AddFileToSearchPath(info->m_FullPath.c_str()); this->AddFileToSearchPath(info->m_FullPath.c_str());
info->m_IncludeName = i->m_FullPath; info->m_IncludeName = i->GetFullPath();
info->m_ClassFileIndex = &*i; info->m_ClassFileIndex = &*i;
m_DependInformation.push_back(info); m_DependInformation.push_back(info);
} }
@ -101,11 +104,11 @@ void cmMakeDepend::DoDepends()
// find the class // find the class
if(info->m_ClassFileIndex != 0) if(info->m_ClassFileIndex != 0)
{ {
cmClassFile& cfile = *(info->m_ClassFileIndex); cmSourceFile& cfile = *(info->m_ClassFileIndex);
for( cmDependInformation::IndexSet::const_iterator indx = info->m_IndexSet.begin(); for( cmDependInformation::IndexSet::const_iterator indx = info->m_IndexSet.begin();
indx != info->m_IndexSet.end(); ++indx) indx != info->m_IndexSet.end(); ++indx)
{ {
cfile.m_Depends.push_back(m_DependInformation[*indx]->m_FullPath); cfile.GetDepends().push_back(m_DependInformation[*indx]->m_FullPath);
} }
} }
} }
@ -128,8 +131,9 @@ void cmMakeDepend::Depend(cmDependInformation* info)
// exist since we can find the dependencies for real. // exist since we can find the dependencies for real.
if(info->m_ClassFileIndex != 0) if(info->m_ClassFileIndex != 0)
{ {
cmClassFile& cFile = *(info->m_ClassFileIndex); cmSourceFile& cFile = *(info->m_ClassFileIndex);
cFile.m_Depends.erase(cFile.m_Depends.begin(), cFile.m_Depends.end()); cFile.GetDepends().erase(cFile.GetDepends().begin(),
cFile.GetDepends().end());
} }
// Use the real file to find its dependencies. // Use the real file to find its dependencies.
@ -143,22 +147,24 @@ void cmMakeDepend::Depend(cmDependInformation* info)
if(info->m_ClassFileIndex != 0) if(info->m_ClassFileIndex != 0)
{ {
// Get the cmClassFile corresponding to this. // Get the cmClassFile corresponding to this.
cmClassFile& cFile = *(info->m_ClassFileIndex); cmSourceFile& cFile = *(info->m_ClassFileIndex);
// See if there are any hints for finding dependencies for the missing // See if there are any hints for finding dependencies for the missing
// file. // file.
if(!cFile.m_Depends.empty()) if(!cFile.GetDepends().empty())
{ {
// Initial dependencies have been given. Use them to begin the // Initial dependencies have been given. Use them to begin the
// recursion. // recursion.
for(std::vector<std::string>::iterator file = for(std::vector<std::string>::iterator file =
cFile.m_Depends.begin(); file != cFile.m_Depends.end(); ++file) cFile.GetDepends().begin(); file != cFile.GetDepends().end();
++file)
{ {
this->AddDependency(info, file->c_str()); this->AddDependency(info, file->c_str());
} }
// Erase the dependency hints from the cmClassFile. They will be // Erase the dependency hints from the cmClassFile. They will be
// put in again as real dependencies later. // put in again as real dependencies later.
cFile.m_Depends.erase(cFile.m_Depends.begin(), cFile.m_Depends.end()); cFile.GetDepends().erase(cFile.GetDepends().begin(),
cFile.GetDepends().end());
// Found dependency information. We are done. // Found dependency information. We are done.
return; return;

View File

@ -17,7 +17,7 @@
#define cmMakeDepend_h #define cmMakeDepend_h
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmClassFile.h" #include "cmSourceFile.h"
#include "cmRegularExpression.h" #include "cmRegularExpression.h"
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
@ -60,7 +60,7 @@ struct cmDependInformation
* The index into the cmMakefile::m_Classes list. * The index into the cmMakefile::m_Classes list.
* The index value of 0 indicates that it is not in the list. * The index value of 0 indicates that it is not in the list.
*/ */
cmClassFile *m_ClassFileIndex; cmSourceFile *m_ClassFileIndex;
/** /**
* This flag indicates whether dependency checking has been * This flag indicates whether dependency checking has been

View File

@ -16,7 +16,7 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmCommand.h" #include "cmCommand.h"
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmClassFile.h" #include "cmSourceFile.h"
#include "cmDirectory.h" #include "cmDirectory.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmMakefileGenerator.h" #include "cmMakefileGenerator.h"
@ -92,11 +92,11 @@ void cmMakefile::Print() const
{ {
// print the class lists // print the class lists
std::cout << "classes:\n"; std::cout << "classes:\n";
for(ClassMap::const_iterator l = m_Classes.begin(); for(SourceMap::const_iterator l = m_Sources.begin();
l != m_Classes.end(); l++) l != m_Sources.end(); l++)
{ {
std::cout << " Class list named: " << l->first << std::endl; std::cout << " Class list named: " << l->first << std::endl;
for(std::vector<cmClassFile>::const_iterator i = l->second.begin(); for(std::vector<cmSourceFile>::const_iterator i = l->second.begin();
i != l->second.end(); i++) i != l->second.end(); i++)
{ {
i->Print(); i->Print();
@ -240,19 +240,19 @@ bool cmMakefile::ReadListFile(const char* filename)
cmClassFile *cmMakefile::GetClass(const char *srclist, const char *cname) cmSourceFile *cmMakefile::GetSource(const char *srclist, const char *cname)
{ {
ClassMap::iterator sl = m_Classes.find(srclist); SourceMap::iterator sl = m_Sources.find(srclist);
// find the src list // find the src list
if (sl == m_Classes.end()) if (sl == m_Sources.end())
{ {
return 0; return 0;
} }
// find the class // find the class
for (std::vector<cmClassFile>::iterator i = sl->second.begin(); for (std::vector<cmSourceFile>::iterator i = sl->second.begin();
i != sl->second.end(); ++i) i != sl->second.end(); ++i)
{ {
if (i->m_ClassName == cname) if (i->GetSourceName() == cname)
{ {
return &(*i); return &(*i);
} }
@ -291,9 +291,9 @@ void cmMakefile::GenerateMakefile()
m_MakefileGenerator->GenerateMakefile(); m_MakefileGenerator->GenerateMakefile();
} }
void cmMakefile::AddClass(cmClassFile& cmfile, const char *srclist) void cmMakefile::AddSource(cmSourceFile& cmfile, const char *srclist)
{ {
m_Classes[srclist].push_back(cmfile); m_Sources[srclist].push_back(cmfile);
} }
void cmMakefile::AddCustomCommand(const char* source, void cmMakefile::AddCustomCommand(const char* source,
@ -661,38 +661,6 @@ cmMakefile::FindSourceGroup(const char* source,
return groups.front(); return groups.front();
} }
// take srclists and put all the classes into a vector
std::vector<cmClassFile>
cmMakefile::GetClassesFromSourceLists(
const std::vector<std::string> &srcLists)
{
std::vector<cmClassFile> result;
// for each src lists add the classes
for (std::vector<std::string>::const_iterator s = srcLists.begin();
s != srcLists.end(); ++s)
{
// replace any variables
std::string temps = *s;
this->ExpandVariablesInString(temps);
// look for a srclist
if (m_Classes.find(temps) != m_Classes.end())
{
const std::vector<cmClassFile> &clsList =
m_Classes.find(temps)->second;
result.insert(result.end(), clsList.begin(), clsList.end());
}
// if one wasn't found then assume it is a single class
else
{
cmClassFile file;
file.m_AbstractClass = false;
file.SetName(temps.c_str(), this->GetCurrentDirectory());
result.push_back(file);
}
}
return result;
}
bool cmMakefile::IsFunctionBlocked(const char *name, bool cmMakefile::IsFunctionBlocked(const char *name,
std::vector<std::string> &args) const std::vector<std::string> &args) const

View File

@ -17,7 +17,7 @@
#define cmMakefile_h #define cmMakefile_h
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmClassFile.h" #include "cmSourceFile.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmSourceGroup.h" #include "cmSourceGroup.h"
#include "cmTarget.h" #include "cmTarget.h"
@ -170,7 +170,7 @@ public:
/** /**
* Add a class/source file to the build. * Add a class/source file to the build.
*/ */
void AddClass(cmClassFile& ,const char *srcListName); void AddSource(cmSourceFile& ,const char *srcListName);
/** /**
* Add a source group for consideration when adding a new source. * Add a source group for consideration when adding a new source.
@ -206,7 +206,7 @@ public:
cmSystemTools::ConvertToUnixSlashes(m_cmHomeDirectory); cmSystemTools::ConvertToUnixSlashes(m_cmHomeDirectory);
this->AddDefinition("CMAKE_SOURCE_DIR", this->GetHomeDirectory()); this->AddDefinition("CMAKE_SOURCE_DIR", this->GetHomeDirectory());
} }
const char* GetHomeDirectory() const char* GetHomeDirectory() const
{ {
return m_cmHomeDirectory.c_str(); return m_cmHomeDirectory.c_str();
} }
@ -216,7 +216,7 @@ public:
cmSystemTools::ConvertToUnixSlashes(m_HomeOutputDirectory); cmSystemTools::ConvertToUnixSlashes(m_HomeOutputDirectory);
this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory()); this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory());
} }
const char* GetHomeOutputDirectory() const char* GetHomeOutputDirectory() const
{ {
return m_HomeOutputDirectory.c_str(); return m_HomeOutputDirectory.c_str();
} }
@ -235,7 +235,7 @@ public:
m_cmStartDirectory = dir; m_cmStartDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(m_cmStartDirectory); cmSystemTools::ConvertToUnixSlashes(m_cmStartDirectory);
} }
const char* GetStartDirectory() const char* GetStartDirectory() const
{ {
return m_cmStartDirectory.c_str(); return m_cmStartDirectory.c_str();
} }
@ -244,7 +244,7 @@ public:
m_StartOutputDirectory = lib; m_StartOutputDirectory = lib;
cmSystemTools::ConvertToUnixSlashes(m_StartOutputDirectory); cmSystemTools::ConvertToUnixSlashes(m_StartOutputDirectory);
} }
const char* GetStartOutputDirectory() const char* GetStartOutputDirectory() const
{ {
return m_StartOutputDirectory.c_str(); return m_StartOutputDirectory.c_str();
} }
@ -263,7 +263,7 @@ public:
m_cmCurrentDirectory = dir; m_cmCurrentDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(m_cmCurrentDirectory); cmSystemTools::ConvertToUnixSlashes(m_cmCurrentDirectory);
} }
const char* GetCurrentDirectory() const char* GetCurrentDirectory() const
{ {
return m_cmCurrentDirectory.c_str(); return m_cmCurrentDirectory.c_str();
} }
@ -272,7 +272,7 @@ public:
m_CurrentOutputDirectory = lib; m_CurrentOutputDirectory = lib;
cmSystemTools::ConvertToUnixSlashes(m_CurrentOutputDirectory); cmSystemTools::ConvertToUnixSlashes(m_CurrentOutputDirectory);
} }
const char* GetCurrentOutputDirectory() const char* GetCurrentOutputDirectory() const
{ {
return m_CurrentOutputDirectory.c_str(); return m_CurrentOutputDirectory.c_str();
} }
@ -359,16 +359,10 @@ public:
/** /**
* Return a list of source files in this makefile. * Return a list of source files in this makefile.
*/ */
typedef std::map<std::string,std::vector<cmClassFile> > ClassMap; typedef std::map<std::string,std::vector<cmSourceFile> > SourceMap;
ClassMap &GetClasses() {return m_Classes;} const SourceMap &GetSources() const {return m_Sources;}
cmClassFile *GetClass(const char *srclist, const char *className); SourceMap &GetSources() {return m_Sources;}
cmSourceFile *GetSource(const char *srclist, const char *sourceName);
/**
* Return a list of classes in the passed source lists
*/
std::vector<cmClassFile> GetClassesFromSourceLists(
const std::vector<std::string> &srcLists);
/** /**
* Obtain a list of auxiliary source directories. * Obtain a list of auxiliary source directories.
@ -460,7 +454,7 @@ protected:
// libraries, classes, and executables // libraries, classes, and executables
cmTargets m_Targets; cmTargets m_Targets;
ClassMap m_Classes; SourceMap m_Sources;
std::vector<std::string> m_SubDirectories; // list of sub directories std::vector<std::string> m_SubDirectories; // list of sub directories
std::vector<std::string> m_MakeVerbatim; // lines copied from input file std::vector<std::string> m_MakeVerbatim; // lines copied from input file
@ -489,9 +483,9 @@ private:
*/ */
std::string GetParentListFileName(const char *listFileName); std::string GetParentListFileName(const char *listFileName);
void ReadClasses(std::ifstream& fin, bool t); void ReadSources(std::ifstream& fin, bool t);
friend class cmMakeDepend; // make depend needs direct access friend class cmMakeDepend; // make depend needs direct access
// to the m_Classes array // to the m_Sources array
void PrintStringVector(const char* s, const std::vector<std::string>& v) const; void PrintStringVector(const char* s, const std::vector<std::string>& v) const;
void AddDefaultCommands(); void AddDefaultCommands();
void AddDefaultDefinitions(); void AddDefaultDefinitions();

View File

@ -35,7 +35,7 @@ bool cmOptionCommand::Invoke(std::vector<std::string>& args)
} }
else else
{ {
m_Makefile->AddDefinition("WRAP_TCL", cacheValue); m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
} }
return true; return true;

View File

@ -13,7 +13,7 @@
See COPYRIGHT.txt for copyright details. See COPYRIGHT.txt for copyright details.
=========================================================================*/ =========================================================================*/
#include "cmClassFile.h" #include "cmSourceFile.h"
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
@ -23,10 +23,10 @@
// The class must be found in dir and end in name.cxx, name.txx, // The class must be found in dir and end in name.cxx, name.txx,
// name.c or it will be considered a header file only class // name.c or it will be considered a header file only class
// and not included in the build process // and not included in the build process
void cmClassFile::SetName(const char* name, const char* dir) void cmSourceFile::SetName(const char* name, const char* dir)
{ {
m_HeaderFileOnly = true; m_HeaderFileOnly = true;
m_ClassName = name; m_SourceName = name;
std::string pathname = dir; std::string pathname = dir;
if(pathname != "") if(pathname != "")
{ {
@ -35,7 +35,7 @@ void cmClassFile::SetName(const char* name, const char* dir)
// First try and see whether the listed file can be found // First try and see whether the listed file can be found
// as is without extensions added on. // as is without extensions added on.
pathname += m_ClassName; pathname += m_SourceName;
std::string hname = pathname; std::string hname = pathname;
if(cmSystemTools::FileExists(hname.c_str())) if(cmSystemTools::FileExists(hname.c_str()))
{ {
@ -49,7 +49,7 @@ void cmClassFile::SetName(const char* name, const char* dir)
hname += ".cxx"; hname += ".cxx";
if(cmSystemTools::FileExists(hname.c_str())) if(cmSystemTools::FileExists(hname.c_str()))
{ {
m_ClassExtension = "cxx"; m_SourceExtension = "cxx";
m_HeaderFileOnly = false; m_HeaderFileOnly = false;
m_FullPath = hname; m_FullPath = hname;
return; return;
@ -60,7 +60,7 @@ void cmClassFile::SetName(const char* name, const char* dir)
if(cmSystemTools::FileExists(hname.c_str())) if(cmSystemTools::FileExists(hname.c_str()))
{ {
m_HeaderFileOnly = false; m_HeaderFileOnly = false;
m_ClassExtension = "c"; m_SourceExtension = "c";
m_FullPath = hname; m_FullPath = hname;
return; return;
} }
@ -69,7 +69,7 @@ void cmClassFile::SetName(const char* name, const char* dir)
if(cmSystemTools::FileExists(hname.c_str())) if(cmSystemTools::FileExists(hname.c_str()))
{ {
m_HeaderFileOnly = false; m_HeaderFileOnly = false;
m_ClassExtension = "txx"; m_SourceExtension = "txx";
m_FullPath = hname; m_FullPath = hname;
return; return;
} }
@ -77,7 +77,7 @@ void cmClassFile::SetName(const char* name, const char* dir)
hname += ".h"; hname += ".h";
if(cmSystemTools::FileExists(hname.c_str())) if(cmSystemTools::FileExists(hname.c_str()))
{ {
m_ClassExtension = "h"; m_SourceExtension = "h";
m_FullPath = hname; m_FullPath = hname;
return; return;
} }
@ -86,24 +86,24 @@ void cmClassFile::SetName(const char* name, const char* dir)
cmSystemTools::Error("Tried .txx .cxx .c for ", hname.c_str()); cmSystemTools::Error("Tried .txx .cxx .c for ", hname.c_str());
} }
void cmClassFile::SetName(const char* name, const char* dir, const char *ext, void cmSourceFile::SetName(const char* name, const char* dir, const char *ext,
bool hfo) bool hfo)
{ {
m_HeaderFileOnly = hfo; m_HeaderFileOnly = hfo;
m_ClassName = name; m_SourceName = name;
std::string pathname = dir; std::string pathname = dir;
if(pathname != "") if(pathname != "")
{ {
pathname += "/"; pathname += "/";
} }
pathname += m_ClassName + "." + ext; pathname += m_SourceName + "." + ext;
m_FullPath = pathname; m_FullPath = pathname;
m_ClassExtension = ext; m_SourceExtension = ext;
return; return;
} }
void cmClassFile::Print() const void cmSourceFile::Print() const
{ {
if(m_AbstractClass) if(m_AbstractClass)
{ {
@ -121,5 +121,5 @@ void cmClassFile::Print() const
{ {
std::cout << "CXX file "; std::cout << "CXX file ";
} }
std::cout << m_ClassName << std::endl; std::cout << m_SourceName << std::endl;
} }

View File

@ -13,25 +13,25 @@
See COPYRIGHT.txt for copyright details. See COPYRIGHT.txt for copyright details.
=========================================================================*/ =========================================================================*/
#ifndef cmClassFile_h #ifndef cmSourceFile_h
#define cmClassFile_h #define cmSourceFile_h
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
/** \class cmClassFile /** \class cmSourceFile
* \brief Represent a class loaded from a makefile. * \brief Represent a class loaded from a makefile.
* *
* cmClassFile is represents a class loaded from * cmSourceFile is represents a class loaded from
* a makefile. * a makefile.
*/ */
class cmClassFile class cmSourceFile
{ {
public: public:
/** /**
* Construct instance as a concrete class with both a * Construct instance as a concrete class with both a
* .h and .cxx file. * .h and .cxx file.
*/ */
cmClassFile() cmSourceFile()
{ {
m_AbstractClass = false; m_AbstractClass = false;
m_HeaderFileOnly = false; m_HeaderFileOnly = false;
@ -61,38 +61,56 @@ public:
/** /**
* Indicate whether the class is abstract (non-instantiable). * Indicate whether the class is abstract (non-instantiable).
*/ */
bool m_AbstractClass; bool IsAnAbstractClass() const { return m_AbstractClass; }
bool GetIsAnAbstractClass() const { return m_AbstractClass; }
void SetIsAnAbstractClass(bool f) { m_AbstractClass = f; }
/** /**
* Indicate whether the class should not be wrapped * Indicate whether the class should not be wrapped
*/ */
bool m_WrapExclude; bool GetWrapExclude() const { return m_WrapExclude; }
void SetWrapExclude(bool f) { m_WrapExclude = f; }
/** /**
* Indicate whether this class is defined with only the header file. * Indicate whether this class is defined with only the header file.
*/ */
bool m_HeaderFileOnly; bool IsAHeaderFileOnly() const { return m_HeaderFileOnly; }
bool GetIsAHeaderFileOnly() const { return m_HeaderFileOnly; }
void SetIsAHeaderFileOnly(bool f) { m_HeaderFileOnly = f; }
/** /**
* The full path to the file. * The full path to the file.
*/ */
std::string GetFullPath() const {return m_FullPath;}
void SetFullPath(const char *name) {m_FullPath = name;}
/**
* The file name associated with stripped off directory and extension.
* (In most cases this is the name of the class.)
*/
std::string GetSourceName() const {return m_SourceName;}
void SetSourceName(const char *name) {m_SourceName = name;}
/**
* The file name associated with stripped off directory and extension.
* (In most cases this is the name of the class.)
*/
std::string GetSourceExtension() const {return m_SourceExtension;}
void SetSourceExtension(const char *name) {m_SourceExtension = name;}
/**
* Return the vector that holds the list of dependencies
*/
const std::vector<std::string> &GetDepends() const {return m_Depends;}
std::vector<std::string> &GetDepends() {return m_Depends;}
private:
bool m_AbstractClass;
bool m_WrapExclude;
bool m_HeaderFileOnly;
std::string m_FullPath; std::string m_FullPath;
std::string m_SourceName;
/** std::string m_SourceExtension;
* The file name associated with stripped off directory and extension.
* (In most cases this is the name of the class.)
*/
std::string m_ClassName;
/**
* The file name associated with stripped off directory and extension.
* (In most cases this is the name of the class.)
*/
std::string m_ClassExtension;
/**
* The dependencies of this class are gathered here.
*/
std::vector<std::string> m_Depends; std::vector<std::string> m_Depends;
}; };

View File

@ -26,10 +26,10 @@ bool cmSourceFilesCommand::Invoke(std::vector<std::string>& args)
for(std::vector<std::string>::iterator i = (args.begin() + 1); for(std::vector<std::string>::iterator i = (args.begin() + 1);
i != args.end(); ++i) i != args.end(); ++i)
{ {
cmClassFile file; cmSourceFile file;
file.m_AbstractClass = false; file.SetIsAnAbstractClass(false);
file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory());
m_Makefile->AddClass(file, args[0].c_str()); m_Makefile->AddSource(file, args[0].c_str());
} }
return true; return true;
} }

View File

@ -18,11 +18,9 @@
// cmSourceFilesRequireCommand // cmSourceFilesRequireCommand
bool cmSourceFilesRequireCommand::Invoke(std::vector<std::string>& args) bool cmSourceFilesRequireCommand::Invoke(std::vector<std::string>& args)
{ {
if(args.size() < 4 ) this->SetError(" deprecated - use SourceFiles command inside an If block ");
{ return false;
this->SetError("called with incorrect number of arguments");
return false;
}
std::vector<std::string>::iterator i = args.begin(); std::vector<std::string>::iterator i = args.begin();
// Search to the key word SOURCES_BEGIN is found // Search to the key word SOURCES_BEGIN is found
// if one of the required defines is not there, then // if one of the required defines is not there, then
@ -46,10 +44,10 @@ bool cmSourceFilesRequireCommand::Invoke(std::vector<std::string>& args)
++i; ++i;
for(; i != args.end(); ++i) for(; i != args.end(); ++i)
{ {
cmClassFile file; cmSourceFile file;
file.m_AbstractClass = false; file.SetIsAnAbstractClass(false);
file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory()); file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory());
m_Makefile->AddClass(file, sname); m_Makefile->AddSource(file, sname);
} }
return true; return true;
} }

44
Source/cmTarget.cxx Normal file
View File

@ -0,0 +1,44 @@
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2000 National Library of Medicine
All rights reserved.
See COPYRIGHT.txt for copyright details.
=========================================================================*/
#include "cmTarget.h"
#include "cmMakefile.h"
void cmTarget::GenerateSourceFilesFromSourceLists(const cmMakefile &mf)
{
// for each src lists add the classes
for (std::vector<std::string>::const_iterator s = m_SourceLists.begin();
s != m_SourceLists.end(); ++s)
{
// replace any variables
std::string temps = *s;
mf.ExpandVariablesInString(temps);
// look for a srclist
if (mf.GetSources().find(temps) != mf.GetSources().end())
{
const std::vector<cmSourceFile> &clsList =
mf.GetSources().find(temps)->second;
m_SourceFiles.insert(m_SourceFiles.end(), clsList.begin(), clsList.end());
}
// if one wasn't found then assume it is a single class
else
{
cmSourceFile file;
file.SetIsAnAbstractClass(false);
file.SetName(temps.c_str(), mf.GetCurrentDirectory());
m_SourceFiles.push_back(file);
}
}
}

View File

@ -18,6 +18,7 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmCustomCommand.h" #include "cmCustomCommand.h"
#include "cmSourceFile.h"
/** \class cmTarget /** \class cmTarget
* \brief Represent a library or executable target loaded from a makefile. * \brief Represent a library or executable target loaded from a makefile.
@ -44,13 +45,28 @@ public:
/** /**
* Get the list of the source lists used by this target * Get the list of the source lists used by this target
*/ */
const std::vector<std::string> &GetSourceLists() const {return m_SourceLists;} const std::vector<std::string> &GetSourceLists() const
{return m_SourceLists;}
std::vector<std::string> &GetSourceLists() {return m_SourceLists;} std::vector<std::string> &GetSourceLists() {return m_SourceLists;}
/**
* Get the list of the source files used by this target
*/
const std::vector<cmSourceFile> &GetSourceFiles() const
{return m_SourceFiles;}
std::vector<cmSourceFile> &GetSourceFiles() {return m_SourceFiles;}
/**
* Generate the SourceFilesList from the SourceLists. This should only be
* done once to be safe.
*/
void GenerateSourceFilesFromSourceLists(const cmMakefile &mf);
private: private:
std::vector<cmCustomCommand> m_CustomCommands; std::vector<cmCustomCommand> m_CustomCommands;
std::vector<std::string> m_SourceLists; std::vector<std::string> m_SourceLists;
bool m_IsALibrary; bool m_IsALibrary;
std::vector<cmSourceFile> m_SourceFiles;
}; };
typedef std::map<std::string,cmTarget> cmTargets; typedef std::map<std::string,cmTarget> cmTargets;

View File

@ -25,11 +25,9 @@ cmUnixDefinesCommand::cmUnixDefinesCommand()
// cmUNIXDefinesCommand // cmUNIXDefinesCommand
bool cmUnixDefinesCommand::Invoke(std::vector<std::string>& args) bool cmUnixDefinesCommand::Invoke(std::vector<std::string>& args)
{ {
if(args.size() < 1 ) this->SetError(" deprecated - use AddDefinitions inside an If block ");
{ return false;
this->SetError("called with incorrect number of arguments");
return false;
}
for(std::vector<std::string>::iterator i = args.begin(); for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i) i != args.end(); ++i)
{ {

View File

@ -25,11 +25,9 @@ cmUnixLibrariesCommand::cmUnixLibrariesCommand()
// cmUnixLibrariesCommand // cmUnixLibrariesCommand
bool cmUnixLibrariesCommand::Invoke(std::vector<std::string>& args) bool cmUnixLibrariesCommand::Invoke(std::vector<std::string>& args)
{ {
if(args.size() < 1 ) this->SetError(" deprecated - use LIBRARY command inside an IF block ");
{ return false;
this->SetError("called with incorrect number of arguments");
return false;
}
for(std::vector<std::string>::iterator i = args.begin(); for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i) i != args.end(); ++i)
{ {

View File

@ -94,38 +94,18 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
for(cmTargets::const_iterator l = tgts.begin(); for(cmTargets::const_iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
std::vector<cmClassFile> classes = std::vector<cmSourceFile> classes = l->second.GetSourceFiles();
m_Makefile->GetClassesFromSourceLists(l->second.GetSourceLists());
fout << l->first << "_SRC_OBJS = "; fout << l->first << "_SRC_OBJS = ";
for(std::vector<cmClassFile>::iterator i = classes.begin(); for(std::vector<cmSourceFile>::iterator i = classes.begin();
i != classes.end(); i++) i != classes.end(); i++)
{ {
if(!i->m_HeaderFileOnly) if(!i->IsAHeaderFileOnly())
{ {
fout << "\\\n" << i->m_ClassName << ".o "; fout << "\\\n" << i->GetSourceName() << ".o ";
} }
} }
fout << "\n\n"; fout << "\n\n";
} }
// get the classes from the source lists then add them to the SRC_OBJ list
fout << "SRC_OBJ = ";
for(cmTargets::const_iterator l = tgts.begin();
l != tgts.end(); l++)
{
std::vector<cmClassFile> classes =
m_Makefile->GetClassesFromSourceLists(l->second.GetSourceLists());
for(std::vector<cmClassFile>::iterator i = classes.begin();
i != classes.end(); i++)
{
if(!i->m_HeaderFileOnly)
{
fout << "\\\n" << i->m_ClassName << ".o ";
}
}
}
fout << "\n\n";
} }
@ -404,23 +384,23 @@ void cmUnixMakefileGenerator::OutputSubDirectoryRules(std::ostream& fout)
// by the class cmMakeDepend GenerateMakefile // by the class cmMakeDepend GenerateMakefile
void cmUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout) void cmUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout)
{ {
cmMakefile::ClassMap &Classes = m_Makefile->GetClasses(); cmMakefile::SourceMap &Sources = m_Makefile->GetSources();
for(cmMakefile::ClassMap::iterator l = Classes.begin(); for(cmMakefile::SourceMap::iterator l = Sources.begin();
l != Classes.end(); l++) l != Sources.end(); l++)
{ {
for(std::vector<cmClassFile>::iterator i = l->second.begin(); for(std::vector<cmSourceFile>::iterator i = l->second.begin();
i != l->second.end(); i++) i != l->second.end(); i++)
{ {
if(!i->m_HeaderFileOnly) if(!i->IsAHeaderFileOnly())
{ {
if(i->m_Depends.size()) if(i->GetDepends().size())
{ {
fout << i->m_ClassName << ".o : \\\n"; fout << i->GetSourceName() << ".o : \\\n";
for(std::vector<std::string>::iterator j = for(std::vector<std::string>::iterator j =
i->m_Depends.begin(); i->GetDepends().begin();
j != i->m_Depends.end(); ++j) j != i->GetDepends().end(); ++j)
{ {
if(j+1 == i->m_Depends.end()) if(j+1 == i->GetDepends().end())
{ {
fout << *j << " \n"; fout << *j << " \n";
} }

View File

@ -0,0 +1,213 @@
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2000 National Library of Medicine
All rights reserved.
See COPYRIGHT.txt for copyright details.
=========================================================================*/
#include "cmVTKWrapPythonCommand.h"
// cmVTKWrapPythonCommand
bool cmVTKWrapPythonCommand::Invoke(std::vector<std::string>& args)
{
if(args.size() < 3 )
{
this->SetError("called with incorrect number of arguments");
return false;
}
// Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program
const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue("VTK_WRAP_PYTHON");
if(!cacheValue || !strcmp(cacheValue,"0"))
{
return true;
}
// add in a depend in the vtkVTKWrapPython executable
m_Makefile->AddUtility("vtkWrapPython");
// what is the current source dir
std::string cdir = m_Makefile->GetCurrentDirectory();
// keep the library name
m_LibraryName = args[0];
m_SourceList = args[1];
// get the list of classes for this library
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::iterator j = (args.begin() + 2);
j != args.end(); ++j)
{
for(cmMakefile::SourceMap::iterator l = Classes.begin();
l != Classes.end(); l++)
{
for(std::vector<cmSourceFile>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
cmSourceFile &curr = *i;
// if we should wrap the class
if (!curr.GetWrapExclude())
{
cmSourceFile file;
file.SetIsAnAbstractClass(curr.IsAnAbstractClass());
std::string newName = curr.GetSourceName() + "Python";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string hname = cdir + "/" + curr.GetSourceName() + ".h";
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
}
}
}
}
return true;
}
void cmVTKWrapPythonCommand::FinalPass()
{
// first we add the rules for all the .h to Python.cxx files
int lastClass = m_WrapClasses.size();
std::vector<std::string> depends;
std::string wpython = "${VTK_WRAP_PYTHON_EXE}";
std::string hints = "${VTK_WRAP_HINTS}";
// Create the init file
std::string res = m_LibraryName;
res += "Init.cxx";
this->CreateInitFile(res);
// add the init file
cmSourceFile cfile;
cfile.SetIsAnAbstractClass(false);
std::string newName = m_LibraryName;
newName += "Init";
cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
m_Makefile->AddSource(cfile,m_SourceList.c_str());
// wrap all the .h files
depends.push_back(wpython);
for(int classNum = 0; classNum < lastClass; classNum++)
{
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
std::string res = m_WrapClasses[classNum].GetSourceName() + ".cxx";
std::string cmd = wpython + " " + m_WrapHeaders[classNum] + " "
+ hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + m_WrapClasses[classNum].GetSourceName() + ".cxx";
m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
cmd.c_str(), depends,
res.c_str(), m_LibraryName.c_str());
}
}
bool cmVTKWrapPythonCommand::CreateInitFile(std::string& res)
{
unsigned int i;
/* we have to make sure that the name is the correct case */
std::string kitName = m_LibraryName;
if (kitName[0] > 90) kitName[0] -= 32;
for (i = 1; i < kitName.size(); i++)
{
if ((kitName[i] > 64)&&(kitName[i] < 91))
{
kitName[i] += 32;
}
}
std::vector<std::string> classes;
int lastClass = m_WrapHeaders.size();
int classNum;
for(classNum = 0; classNum < lastClass; classNum++)
{
if (!m_WrapClasses[classNum].IsAnAbstractClass())
{
std::string cls = m_WrapHeaders[classNum];
cls = cls.substr(0,cls.size()-2);
std::string::size_type pos = cls.rfind('/');
if(pos != std::string::npos)
{
cls = cls.substr(pos+1);
}
classes.push_back(cls);
}
}
// open the init file
std::string outFileName =
m_Makefile->GetCurrentOutputDirectory();
outFileName += "/" + res;
return this->WriteInit(kitName.c_str(), outFileName, classes);
}
/* warning this code is also in getclasses.cxx under pcmaker */
bool cmVTKWrapPythonCommand::WriteInit(const char *kitName,
std::string& outFileName,
std::vector<std::string>& classes)
{
unsigned int i;
FILE *fout = fopen(outFileName.c_str(),"w");
if (!fout)
{
return false;
}
fprintf(fout,"#include <string.h>\n");
fprintf(fout,"#include \"Python.h\"\n\n");
for (i = 0; i < classes.size(); i++)
{
fprintf(fout,"extern \"C\" {__declspec( dllexport) PyObject *PyVTKClass_%sNew(char *); }\n",classes[i].c_str());
}
fprintf(fout,"\nstatic PyMethodDef Py%s_ClassMethods[] = {\n",
kitName);
fprintf(fout,"{NULL, NULL}};\n\n");
fprintf(fout,"extern \"C\" {__declspec( dllexport) void init%s();}\n\n",kitName);
/* module init function */
fprintf(fout,"void init%s()\n{\n",kitName);
fprintf(fout," PyObject *m, *d, *c;\n\n");
fprintf(fout," static char modulename[] = \"%s\";\n",kitName);
fprintf(fout," m = Py_InitModule(modulename, Py%s_ClassMethods);\n",
kitName);
fprintf(fout," d = PyModule_GetDict(m);\n");
fprintf(fout," if (!d) Py_FatalError(\"can't get dictionary for module %s!\");\n\n",
kitName);
for (i = 0; i < classes.size(); i++)
{
fprintf(fout," if ((c = PyVTKClass_%sNew(modulename)))\n",
classes[i].c_str());
fprintf(fout," if (-1 == PyDict_SetItemString(d, \"%s\", c))\n",
classes[i].c_str());
fprintf(fout," Py_FatalError(\"can't add class %s to dictionary!\");\n\n",
classes[i].c_str());
}
fprintf(fout,"}\n\n");
fclose(fout);
return true;
}

View File

@ -0,0 +1,82 @@
#ifndef cmVTKWrapPythonCommand_h
#define cmVTKWrapPythonCommand_h
#include "cmStandardIncludes.h"
#include "cmCommand.h"
/** \class cmVTKWrapPythonCommand
* \brief Create Python Language bindings for classes
*
* cmVTKWrapPythonCommand is used to create wrappers for classes into Python
*/
class cmVTKWrapPythonCommand : public cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
{
return new cmVTKWrapPythonCommand;
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
virtual bool Invoke(std::vector<std::string>& args);
/**
* This is called at the end after all the information
* specified by the command is accumulated. Most commands do
* not implement this method. At this point, reading and
* writing to the cache can be done.
*/
virtual void FinalPass();
/**
* This determines if the command gets propagated down
* to makefiles located in subdirectories.
*/
virtual bool IsInherited()
{return true;}
/**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return "VTK_WRAP_PYTHON";}
/**
* Succinct documentation.
*/
virtual const char* GetTerseDocumentation()
{
return "Create Python Wrappers.";
}
/**
* More documentation.
*/
virtual const char* GetFullDocumentation()
{
return
"VTK_WRAP_PYTHON(resultingLibraryName SourceListName SourceLists ...)";
}
/**
* Helper methods
*/
virtual bool CreateInitFile(std::string &name);
virtual bool WriteInit(const char *kitName, std::string& outFileName,
std::vector<std::string>& classes);
private:
std::vector<cmSourceFile> m_WrapClasses;
std::vector<std::string> m_WrapHeaders;
std::string m_LibraryName;
std::string m_SourceList;
};
#endif

View File

@ -13,10 +13,10 @@
See COPYRIGHT.txt for copyright details. See COPYRIGHT.txt for copyright details.
=========================================================================*/ =========================================================================*/
#include "cmWrapTclCommand.h" #include "cmVTKWrapTclCommand.h"
// cmWrapTclCommand // cmVTKWrapTclCommand
bool cmWrapTclCommand::Invoke(std::vector<std::string>& args) bool cmVTKWrapTclCommand::Invoke(std::vector<std::string>& args)
{ {
if(args.size() < 3 ) if(args.size() < 3 )
{ {
@ -26,12 +26,12 @@ bool cmWrapTclCommand::Invoke(std::vector<std::string>& args)
// Now check and see if the value has been stored in the cache // Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program // already, if so use that value and don't look for the program
if(!cmCacheManager::GetInstance()->IsOn("WRAP_TCL")) if(!cmCacheManager::GetInstance()->IsOn("VTK_WRAP_TCL"))
{ {
return true; return true;
} }
// add in a depend in the vtkWrapTcl executable // add in a depend in the vtkVTKWrapTcl executable
m_Makefile->AddUtility("vtkWrapTcl"); m_Makefile->AddUtility("vtkWrapTcl");
// what is the current source dir // what is the current source dir
@ -42,29 +42,29 @@ bool cmWrapTclCommand::Invoke(std::vector<std::string>& args)
m_SourceList = args[1]; m_SourceList = args[1];
// get the list of classes for this library // get the list of classes for this library
cmMakefile::ClassMap &Classes = m_Makefile->GetClasses(); cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::iterator j = (args.begin() + 2); for(std::vector<std::string>::iterator j = (args.begin() + 2);
j != args.end(); ++j) j != args.end(); ++j)
{ {
for(cmMakefile::ClassMap::iterator l = Classes.begin(); for(cmMakefile::SourceMap::iterator l = Classes.begin();
l != Classes.end(); l++) l != Classes.end(); l++)
{ {
for(std::vector<cmClassFile>::iterator i = l->second.begin(); for(std::vector<cmSourceFile>::iterator i = l->second.begin();
i != l->second.end(); i++) i != l->second.end(); i++)
{ {
cmClassFile &curr = *i; cmSourceFile &curr = *i;
// if we should wrap the class // if we should wrap the class
if (!curr.m_WrapExclude) if (!curr.GetWrapExclude())
{ {
cmClassFile file; cmSourceFile file;
file.m_AbstractClass = curr.m_AbstractClass; file.SetIsAnAbstractClass(curr.IsAnAbstractClass());
std::string newName = curr.m_ClassName + "Tcl"; std::string newName = curr.GetSourceName() + "Tcl";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(), file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false); "cxx",false);
std::string hname = cdir + "/" + curr.m_ClassName + ".h"; std::string hname = cdir + "/" + curr.GetSourceName() + ".h";
m_WrapHeaders.push_back(hname); m_WrapHeaders.push_back(hname);
// add starting depends // add starting depends
file.m_Depends.push_back(hname); file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file); m_WrapClasses.push_back(file);
} }
} }
@ -74,13 +74,13 @@ bool cmWrapTclCommand::Invoke(std::vector<std::string>& args)
return true; return true;
} }
void cmWrapTclCommand::FinalPass() void cmVTKWrapTclCommand::FinalPass()
{ {
// first we add the rules for all the .h to Tcl.cxx files // first we add the rules for all the .h to Tcl.cxx files
int lastClass = m_WrapClasses.size(); int lastClass = m_WrapClasses.size();
std::vector<std::string> depends; std::vector<std::string> depends;
std::string wtcl = "${WRAP_TCL_EXE}"; std::string wtcl = "${VTK_WRAP_TCL_EXE}";
std::string hints = "${WRAP_HINTS}"; std::string hints = "${VTK_WRAP_HINTS}";
// Create the init file // Create the init file
std::string res = m_LibraryName; std::string res = m_LibraryName;
@ -88,22 +88,22 @@ void cmWrapTclCommand::FinalPass()
this->CreateInitFile(res); this->CreateInitFile(res);
// add the init file // add the init file
cmClassFile cfile; cmSourceFile cfile;
cfile.m_AbstractClass = false; cfile.SetIsAnAbstractClass(false);
std::string newName = m_LibraryName; std::string newName = m_LibraryName;
newName += "Init"; newName += "Init";
cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(), cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false); "cxx",false);
m_Makefile->AddClass(cfile,m_SourceList.c_str()); m_Makefile->AddSource(cfile,m_SourceList.c_str());
// wrap all the .h files // wrap all the .h files
depends.push_back(wtcl); depends.push_back(wtcl);
for(int classNum = 0; classNum < lastClass; classNum++) for(int classNum = 0; classNum < lastClass; classNum++)
{ {
m_Makefile->AddClass(m_WrapClasses[classNum],m_SourceList.c_str()); m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
std::string res = m_WrapClasses[classNum].m_ClassName + ".cxx"; std::string res = m_WrapClasses[classNum].GetSourceName() + ".cxx";
std::string cmd = wtcl + " " + m_WrapHeaders[classNum] + " " std::string cmd = wtcl + " " + m_WrapHeaders[classNum] + " "
+ hints + (m_WrapClasses[classNum].m_AbstractClass ? " 0 " : " 1 ") + " > " + m_WrapClasses[classNum].m_ClassName + ".cxx"; + hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + m_WrapClasses[classNum].GetSourceName() + ".cxx";
m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(), m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
cmd.c_str(), depends, cmd.c_str(), depends,
res.c_str(), m_LibraryName.c_str()); res.c_str(), m_LibraryName.c_str());
@ -111,7 +111,7 @@ void cmWrapTclCommand::FinalPass()
} }
bool cmWrapTclCommand::CreateInitFile(std::string& res) bool cmVTKWrapTclCommand::CreateInitFile(std::string& res)
{ {
unsigned int i; unsigned int i;
@ -131,7 +131,7 @@ bool cmWrapTclCommand::CreateInitFile(std::string& res)
int classNum; int classNum;
for(classNum = 0; classNum < lastClass; classNum++) for(classNum = 0; classNum < lastClass; classNum++)
{ {
if (!m_WrapClasses[classNum].m_AbstractClass) if (!m_WrapClasses[classNum].IsAnAbstractClass())
{ {
std::string cls = m_WrapHeaders[classNum]; std::string cls = m_WrapHeaders[classNum];
cls = cls.substr(0,cls.size()-2); cls = cls.substr(0,cls.size()-2);
@ -154,8 +154,9 @@ bool cmWrapTclCommand::CreateInitFile(std::string& res)
/* warning this code is also in getclasses.cxx under pcmaker */ /* warning this code is also in getclasses.cxx under pcmaker */
bool cmWrapTclCommand::WriteInit(const char *kitName, std::string& outFileName, bool cmVTKWrapTclCommand::WriteInit(const char *kitName,
std::vector<std::string>& classes) std::string& outFileName,
std::vector<std::string>& classes)
{ {
unsigned int i; unsigned int i;
FILE *fout = fopen(outFileName.c_str(),"w"); FILE *fout = fopen(outFileName.c_str(),"w");

View File

@ -1,16 +1,16 @@
#ifndef cmWrapTclCommand_h #ifndef cmVTKWrapTclCommand_h
#define cmWrapTclCommand_h #define cmVTKWrapTclCommand_h
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmCommand.h" #include "cmCommand.h"
/** \class cmWrapTclCommand /** \class cmVTKWrapTclCommand
* \brief Define a command that searches for an include file. * \brief Define a command that searches for an include file.
* *
* cmWrapTclCommand is used to define a CMake variable include * cmVTKWrapTclCommand is used to define a CMake variable include
* path location by specifying a file and list of directories. * path location by specifying a file and list of directories.
*/ */
class cmWrapTclCommand : public cmCommand class cmVTKWrapTclCommand : public cmCommand
{ {
public: public:
/** /**
@ -18,7 +18,7 @@ public:
*/ */
virtual cmCommand* Clone() virtual cmCommand* Clone()
{ {
return new cmWrapTclCommand; return new cmVTKWrapTclCommand;
} }
/** /**
@ -45,14 +45,14 @@ public:
/** /**
* The name of the command as specified in CMakeList.txt. * The name of the command as specified in CMakeList.txt.
*/ */
virtual const char* GetName() { return "WRAP_TCL";} virtual const char* GetName() { return "VTK_WRAP_TCL";}
/** /**
* Succinct documentation. * Succinct documentation.
*/ */
virtual const char* GetTerseDocumentation() virtual const char* GetTerseDocumentation()
{ {
return "Create Tcl Wrappers."; return "Create Tcl Wrappers for VTK classes.";
} }
/** /**
@ -61,7 +61,7 @@ public:
virtual const char* GetFullDocumentation() virtual const char* GetFullDocumentation()
{ {
return return
"WRAP_TCL(resultingLibraryName SourceListName SourceLists ...)"; "VTK_WRAP_TCL(resultingLibraryName SourceListName SourceLists ...)";
} }
/** /**
@ -72,7 +72,7 @@ public:
std::vector<std::string>& classes); std::vector<std::string>& classes);
private: private:
std::vector<cmClassFile> m_WrapClasses; std::vector<cmSourceFile> m_WrapClasses;
std::vector<std::string> m_WrapHeaders; std::vector<std::string> m_WrapHeaders;
std::string m_LibraryName; std::string m_LibraryName;
std::string m_SourceList; std::string m_SourceList;

View File

@ -25,11 +25,9 @@ cmWin32DefinesCommand::cmWin32DefinesCommand()
// cmWin32DefinesCommand // cmWin32DefinesCommand
bool cmWin32DefinesCommand::Invoke(std::vector<std::string>& args) bool cmWin32DefinesCommand::Invoke(std::vector<std::string>& args)
{ {
if(args.size() < 1 ) this->SetError(" deprecated - use AddDefinitions inside an If block ");
{ return false;
this->SetError("called with incorrect number of arguments");
return false;
}
for(std::vector<std::string>::iterator i = args.begin(); for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i) i != args.end(); ++i)
{ {

View File

@ -27,11 +27,9 @@ cmWin32IncludeDirectoryCommand::cmWin32IncludeDirectoryCommand()
bool cmWin32IncludeDirectoryCommand::Invoke(std::vector<std::string>& args) bool cmWin32IncludeDirectoryCommand::Invoke(std::vector<std::string>& args)
{ {
if(args.size() < 1 ) this->SetError(" deprecated - use INCLUDE_DIRECTORIES command inside an if block ");
{ return false;
this->SetError("called with incorrect number of arguments");
return false;
}
for(std::vector<std::string>::iterator i = args.begin(); for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i) i != args.end(); ++i)
{ {

View File

@ -26,11 +26,9 @@ cmWin32LibrariesCommand::cmWin32LibrariesCommand()
// cmWin32LibrariesCommand // cmWin32LibrariesCommand
bool cmWin32LibrariesCommand::Invoke(std::vector<std::string>& args) bool cmWin32LibrariesCommand::Invoke(std::vector<std::string>& args)
{ {
if(args.size() < 1 ) this->SetError(" deprecated - use LIBRARY command inside an IF block ");
{ return false;
this->SetError("Called with incorrect number of arguments");
return false;
}
for(std::vector<std::string>::iterator i = args.begin(); for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i) i != args.end(); ++i)
{ {

View File

@ -24,19 +24,19 @@ bool cmWrapExcludeFilesCommand::Invoke(std::vector<std::string>& args)
return false; return false;
} }
cmMakefile::ClassMap &Classes = m_Makefile->GetClasses(); cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::iterator j = args.begin(); for(std::vector<std::string>::iterator j = args.begin();
j != args.end(); ++j) j != args.end(); ++j)
{ {
for(cmMakefile::ClassMap::iterator l = Classes.begin(); for(cmMakefile::SourceMap::iterator l = Classes.begin();
l != Classes.end(); l++) l != Classes.end(); l++)
{ {
for(std::vector<cmClassFile>::iterator i = l->second.begin(); for(std::vector<cmSourceFile>::iterator i = l->second.begin();
i != l->second.end(); i++) i != l->second.end(); i++)
{ {
if(i->m_ClassName == (*j)) if(i->GetSourceName() == (*j))
{ {
i->m_WrapExclude = true; i->SetWrapExclude(true);
} }
} }
} }