many fixes and cleanup and features
This commit is contained in:
parent
b5746484e4
commit
73f04d1409
|
@ -89,10 +89,6 @@ SOURCE=.\cmCacheManager.cxx
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmClassFile.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmCommands.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -129,288 +125,152 @@ SOURCE=.\cmRegularExpression.cxx
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmSourceFile.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmSourceGroup.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmSystemTools.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmTarget.cxx
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmAbstractFilesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmAbstractFilesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmAddTargetCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmAddTargetCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmAuxSourceDirectoryCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmAuxSourceDirectoryCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmCacheManager.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmCacheManager.h
|
||||
# End 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
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmDirectory.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmDirectory.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmDSPMakefile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmDSPMakefile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmDSWMakefile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmDSWMakefile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmExecutablesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmExecutablesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmFindIncludeCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmFindIncludeCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmFindLibraryCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmFindLibraryCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmFindProgramCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmFindProgramCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmIncludeDirectoryCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmIncludeDirectoryCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmLibraryCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmLibraryCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmLinkDirectoriesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmLinkDirectoriesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmLinkLibrariesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmLinkLibrariesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmMakeDepend.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmMakeDepend.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmMakefile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmMakefile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmMakefileGenerator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmMakefileGenerator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmMSProjectGenerator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmMSProjectGenerator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmProjectCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmProjectCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmRegularExpression.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmRegularExpression.h
|
||||
# End 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
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmSourceFilesRequireCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmStandardIncludes.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmStandardIncludes.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmSubdirCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmSubdirCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmSystemTools.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmSystemTools.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmTestsCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmTestsCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmUnixDefinesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmUnixDefinesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmUnixLibrariesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmUnixLibrariesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmUnixMakefileGenerator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmUnixMakefileGenerator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmWin32DefinesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmWin32DefinesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\cmWin32LibrariesCommand.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmWin32LibrariesCommand.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
|
|
|
@ -289,7 +289,7 @@ bool CMakeSetupDialog::Browse(CString &result, const char *title)
|
|||
|
||||
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
|
||||
|
||||
bool bSuccess = (bool)SHGetPathFromIDList(pidl, szPathName);
|
||||
bool bSuccess = (SHGetPathFromIDList(pidl, szPathName) ? true : false);
|
||||
if(bSuccess)
|
||||
{
|
||||
result = szPathName;
|
||||
|
@ -406,17 +406,17 @@ void CMakeSetupDialog::OnBuildProjects()
|
|||
// copy from the cache manager to the cache edit list box
|
||||
void CMakeSetupDialog::FillCacheEditorFromCacheManager()
|
||||
{
|
||||
cmCacheManager::CacheEntryMap cache =
|
||||
const cmCacheManager::CacheEntryMap &cache =
|
||||
cmCacheManager::GetInstance()->GetCacheMap();
|
||||
for(cmCacheManager::CacheEntryMap::iterator i = cache.begin();
|
||||
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
|
||||
i != cache.end(); ++i)
|
||||
{
|
||||
const char* key = i->first.c_str();
|
||||
cmCacheManager::CacheEntry& value = i->second;
|
||||
const cmCacheManager::CacheEntry& value = i->second;
|
||||
switch(value.m_Type )
|
||||
{
|
||||
case cmCacheManager::BOOL:
|
||||
if(cmCacheManager::GetInstance()->IsOn(value.m_Value.c_str()))
|
||||
if(cmCacheManager::GetInstance()->IsOn(key))
|
||||
{
|
||||
m_CacheEntriesList.AddProperty(key,
|
||||
"ON",
|
||||
|
@ -451,7 +451,6 @@ void CMakeSetupDialog::FillCacheEditorFromCacheManager()
|
|||
// copy from the list box to the cache manager
|
||||
void CMakeSetupDialog::FillCacheManagerFromCacheEditor()
|
||||
{
|
||||
cmCacheManager::CacheEntryMap cache =
|
||||
cmCacheManager::GetInstance()->GetCacheMap();
|
||||
std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems();
|
||||
for(std::set<CPropertyItem*>::iterator i = items.begin();
|
||||
|
@ -465,9 +464,12 @@ void CMakeSetupDialog::FillCacheManagerFromCacheEditor()
|
|||
}
|
||||
else
|
||||
{
|
||||
cmCacheManager::CacheEntryMap::iterator p =
|
||||
cache.find((const char*)item->m_propName);
|
||||
(*p).second.m_Value = item->m_curValue;
|
||||
cmCacheManager::CacheEntry *entry =
|
||||
cmCacheManager::GetInstance()->GetCacheEntry((const char*)item->m_propName);
|
||||
if (entry)
|
||||
{
|
||||
entry->m_Value = item->m_curValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,11 +17,12 @@ cmMakeDepend.o \
|
|||
cmMakefile.o \
|
||||
cmMakefileGenerator.o \
|
||||
cmRegularExpression.o \
|
||||
cmClassFile.o \
|
||||
cmSourceFile.o \
|
||||
cmSystemTools.o \
|
||||
cmDirectory.o \
|
||||
cmUnixMakefileGenerator.o \
|
||||
cmCommands.o \
|
||||
cmTarget.o \
|
||||
cmCustomCommand.o \
|
||||
cmCacheManager.o \
|
||||
cmSourceGroup.o
|
||||
|
@ -35,11 +36,12 @@ cmMakefile.o : $(DEPENDS)
|
|||
cmMakefileGenerator.o : $(DEPENDS)
|
||||
cmAuxSourceDirectoryCommand.o : $(DEPENDS)
|
||||
cmRegularExpression.o : $(DEPENDS)
|
||||
cmClassFile.o : $(DEPENDS)
|
||||
cmSourceFile.o : $(DEPENDS)
|
||||
cmDirectory.o : $(DEPENDS)
|
||||
cmCustomCommand.o : $(DEPENDS)
|
||||
cmUnixMakefileGenerator.o : $(DEPENDS)
|
||||
cmCommands.o : $(DEPENDS)
|
||||
cmTarget.o : $(DEPENDS)
|
||||
cmCacheManager.o : $(DEPENDS)
|
||||
cmSourceGroup.o : $(DEPENDS)
|
||||
|
||||
|
|
|
@ -23,19 +23,19 @@ bool cmAbstractFilesCommand::Invoke(std::vector<std::string>& args)
|
|||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
}
|
||||
cmMakefile::ClassMap &Classes = m_Makefile->GetClasses();
|
||||
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
|
||||
for(std::vector<std::string>::iterator j = args.begin();
|
||||
j != args.end(); ++j)
|
||||
{
|
||||
for(cmMakefile::ClassMap::iterator l = Classes.begin();
|
||||
for(cmMakefile::SourceMap::iterator l = Classes.begin();
|
||||
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++)
|
||||
{
|
||||
if(i->m_ClassName == (*j))
|
||||
if(i->GetSourceName() == (*j))
|
||||
{
|
||||
i->m_AbstractClass = true;
|
||||
i->SetIsAnAbstractClass(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,10 +49,10 @@ bool cmAuxSourceDirectoryCommand::Invoke(std::vector<std::string>& args)
|
|||
fullname += file;
|
||||
// add the file as a class file so
|
||||
// depends can be done
|
||||
cmClassFile cmfile;
|
||||
cmSourceFile cmfile;
|
||||
cmfile.SetName(fullname.c_str(), m_Makefile->GetCurrentDirectory());
|
||||
cmfile.m_AbstractClass = false;
|
||||
m_Makefile->AddClass(cmfile,args[1].c_str());
|
||||
cmfile.SetIsAnAbstractClass(false);
|
||||
m_Makefile->AddSource(cmfile,args[1].c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,11 +128,11 @@ void cmCablePackageCommand::FinalPass()
|
|||
// Add a rule to build the generated package.
|
||||
std::string fileName = "Cxx/"+m_PackageName+"_cxx";
|
||||
std::string filePath = m_Makefile->GetStartOutputDirectory();
|
||||
cmClassFile file;
|
||||
file.m_AbstractClass = false;
|
||||
file.m_HeaderFileOnly = false;
|
||||
cmSourceFile file;
|
||||
file.SetIsAnAbstractClass(false);
|
||||
file.SetIsAHeaderFileOnly(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());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ void cmCableSourceFilesCommand::FinalPass()
|
|||
std::string fileName = "Cxx/";
|
||||
fileName += cablePackage->GetPackageName();
|
||||
fileName += "_cxx";
|
||||
cmClassFile *ci = m_Makefile->GetClass(cablePackage->GetPackageName(),
|
||||
fileName.c_str());
|
||||
cmSourceFile *ci = m_Makefile->GetSource(cablePackage->GetPackageName(),
|
||||
fileName.c_str());
|
||||
|
||||
if(ci == 0)
|
||||
{ return; }
|
||||
|
@ -36,7 +36,7 @@ void cmCableSourceFilesCommand::FinalPass()
|
|||
f != m_Entries.end(); ++f)
|
||||
{
|
||||
std::string header = *f+".h";
|
||||
ci->m_Depends.push_back(header);
|
||||
ci->GetDepends().push_back(header);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ bool cmCacheManager::LoadCache(cmMakefile* mf)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool cmCacheManager::SaveCache(cmMakefile* mf)
|
||||
bool cmCacheManager::SaveCache(cmMakefile* mf) const
|
||||
{
|
||||
std::string cacheFile = mf->GetHomeOutputDirectory();
|
||||
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"
|
||||
<< "# 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)
|
||||
{
|
||||
CacheEntryType t = (*i).second.m_Type;
|
||||
|
@ -151,34 +151,43 @@ void cmCacheManager::AddCacheEntry(const char* key,
|
|||
m_Cache[key] = e;
|
||||
}
|
||||
|
||||
const char* cmCacheManager::GetCacheValue(const char* key)
|
||||
cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* 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;
|
||||
}
|
||||
|
||||
|
||||
bool cmCacheManager::IsOn(const char* key)
|
||||
bool cmCacheManager::IsOn(const char* key) const
|
||||
{
|
||||
if(!m_Cache.count(key))
|
||||
{
|
||||
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"
|
||||
|| 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 << "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)
|
||||
{
|
||||
out << (*i).first.c_str() << " = " << (*i).second.m_Value.c_str() << std::endl;
|
||||
|
|
|
@ -35,8 +35,8 @@ public:
|
|||
std::string m_Value;
|
||||
CacheEntryType m_Type;
|
||||
};
|
||||
typedef std::map<std::string, CacheEntry> CacheEntryMap;
|
||||
public:
|
||||
typedef std::map<std::string, CacheEntry> CacheEntryMap;
|
||||
/**
|
||||
* Types for the cache entries. These are useful as
|
||||
* hints for a cache editor program. Path should bring
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
bool LoadCache(cmMakefile*);
|
||||
|
||||
//! Save cache for given makefile. Saves to ouput home CMakeCache.txt
|
||||
bool SaveCache(cmMakefile*);
|
||||
bool SaveCache(cmMakefile*) const;
|
||||
|
||||
//! Add an entry into the cache
|
||||
void AddCacheEntry(const char* key, const char* value, CacheEntryType type);
|
||||
|
@ -64,17 +64,21 @@ public:
|
|||
//! Remove an entry from the cache
|
||||
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
|
||||
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
|
||||
// if no entry.
|
||||
bool IsOn(const char*);
|
||||
bool IsOn(const char*) const;
|
||||
|
||||
//! Print the cache to a stream
|
||||
void PrintCache(std::ostream&);
|
||||
void PrintCache(std::ostream&) const;
|
||||
|
||||
//! Get the cache map ivar.
|
||||
CacheEntryMap GetCacheMap() { return m_Cache; }
|
||||
const CacheEntryMap &GetCacheMap() const { return m_Cache; }
|
||||
|
||||
private:
|
||||
static cmCacheManager* s_Instance;
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
#include "cmCableInstantiateClassCommand.cxx"
|
||||
#include "cmFindFileCommand.cxx"
|
||||
#include "cmWrapExcludeFilesCommand.cxx"
|
||||
#include "cmWrapTclCommand.cxx"
|
||||
#include "cmVTKWrapPythonCommand.cxx"
|
||||
#include "cmVTKWrapTclCommand.cxx"
|
||||
#include "cmBuildSharedLibrariesCommand.cxx"
|
||||
#include "cmUtilitySourceCommand.cxx"
|
||||
#include "cmIncludeRegularExpressionCommand.cxx"
|
||||
|
@ -83,7 +84,8 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands)
|
|||
commands.push_back(new cmCableInstantiateClassCommand);
|
||||
commands.push_back(new cmFindFileCommand);
|
||||
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 cmUtilitySourceCommand);
|
||||
commands.push_back(new cmIncludeRegularExpressionCommand);
|
||||
|
|
|
@ -87,8 +87,8 @@ void cmDSPMakefile::OutputDSPFile()
|
|||
m_CreatedProjectNames.clear();
|
||||
|
||||
// build any targets
|
||||
const cmTargets &tgts = m_Makefile->GetTargets();
|
||||
for(cmTargets::const_iterator l = tgts.begin();
|
||||
cmTargets &tgts = m_Makefile->GetTargets();
|
||||
for(cmTargets::iterator l = tgts.begin();
|
||||
l != tgts.end(); l++)
|
||||
{
|
||||
if (l->second.IsALibrary())
|
||||
|
@ -103,8 +103,7 @@ void cmDSPMakefile::OutputDSPFile()
|
|||
}
|
||||
}
|
||||
|
||||
void cmDSPMakefile::CreateSingleDSP(const char *lname,
|
||||
const cmTarget &target)
|
||||
void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
|
||||
{
|
||||
std::string fname;
|
||||
fname = m_Makefile->GetStartOutputDirectory();
|
||||
|
@ -186,7 +185,7 @@ void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
|
|||
|
||||
void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
||||
const char *libName,
|
||||
const cmTarget &target)
|
||||
cmTarget &target)
|
||||
{
|
||||
// Write the DSP file's header.
|
||||
this->WriteDSPHeader(fout, libName);
|
||||
|
@ -195,15 +194,15 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
|||
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
|
||||
|
||||
// get the classes from the source lists then add them to the groups
|
||||
std::vector<cmClassFile> classes =
|
||||
m_Makefile->GetClassesFromSourceLists(target.GetSourceLists());
|
||||
for(std::vector<cmClassFile>::iterator i = classes.begin();
|
||||
target.GenerateSourceFilesFromSourceLists(*m_Makefile);
|
||||
std::vector<cmSourceFile> classes = target.GetSourceFiles();
|
||||
for(std::vector<cmSourceFile>::iterator i = classes.begin();
|
||||
i != classes.end(); i++)
|
||||
{
|
||||
if(!i->m_HeaderFileOnly)
|
||||
if(!i->IsAHeaderFileOnly())
|
||||
{
|
||||
// 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(),
|
||||
sourceGroups);
|
||||
sourceGroup.AddSource(source.c_str());
|
||||
|
|
|
@ -67,9 +67,9 @@ private:
|
|||
std::string m_DSPFooterTemplate;
|
||||
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,
|
||||
const char *libName, const cmTarget &tgt);
|
||||
const char *libName, cmTarget &tgt);
|
||||
void WriteDSPBeginGroup(std::ostream& fout,
|
||||
const char* group,
|
||||
const char* filter);
|
||||
|
|
|
@ -87,8 +87,8 @@ void cmDSPMakefile::OutputDSPFile()
|
|||
m_CreatedProjectNames.clear();
|
||||
|
||||
// build any targets
|
||||
const cmTargets &tgts = m_Makefile->GetTargets();
|
||||
for(cmTargets::const_iterator l = tgts.begin();
|
||||
cmTargets &tgts = m_Makefile->GetTargets();
|
||||
for(cmTargets::iterator l = tgts.begin();
|
||||
l != tgts.end(); l++)
|
||||
{
|
||||
if (l->second.IsALibrary())
|
||||
|
@ -103,8 +103,7 @@ void cmDSPMakefile::OutputDSPFile()
|
|||
}
|
||||
}
|
||||
|
||||
void cmDSPMakefile::CreateSingleDSP(const char *lname,
|
||||
const cmTarget &target)
|
||||
void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
|
||||
{
|
||||
std::string fname;
|
||||
fname = m_Makefile->GetStartOutputDirectory();
|
||||
|
@ -186,7 +185,7 @@ void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
|
|||
|
||||
void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
||||
const char *libName,
|
||||
const cmTarget &target)
|
||||
cmTarget &target)
|
||||
{
|
||||
// Write the DSP file's header.
|
||||
this->WriteDSPHeader(fout, libName);
|
||||
|
@ -195,15 +194,15 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
|
|||
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
|
||||
|
||||
// get the classes from the source lists then add them to the groups
|
||||
std::vector<cmClassFile> classes =
|
||||
m_Makefile->GetClassesFromSourceLists(target.GetSourceLists());
|
||||
for(std::vector<cmClassFile>::iterator i = classes.begin();
|
||||
target.GenerateSourceFilesFromSourceLists(*m_Makefile);
|
||||
std::vector<cmSourceFile> classes = target.GetSourceFiles();
|
||||
for(std::vector<cmSourceFile>::iterator i = classes.begin();
|
||||
i != classes.end(); i++)
|
||||
{
|
||||
if(!i->m_HeaderFileOnly)
|
||||
if(!i->IsAHeaderFileOnly())
|
||||
{
|
||||
// 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(),
|
||||
sourceGroups);
|
||||
sourceGroup.AddSource(source.c_str());
|
||||
|
|
|
@ -67,9 +67,9 @@ private:
|
|||
std::string m_DSPFooterTemplate;
|
||||
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,
|
||||
const char *libName, const cmTarget &tgt);
|
||||
const char *libName, cmTarget &tgt);
|
||||
void WriteDSPBeginGroup(std::ostream& fout,
|
||||
const char* group,
|
||||
const char* filter);
|
||||
|
|
|
@ -54,20 +54,23 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
|
|||
{
|
||||
this->AddSearchPath(j->c_str());
|
||||
}
|
||||
|
||||
// Now create cmDependInformation objects for files in the directory
|
||||
cmMakefile::ClassMap &Classes = m_Makefile->GetClasses();
|
||||
for(cmMakefile::ClassMap::iterator l = Classes.begin();
|
||||
l != Classes.end(); l++)
|
||||
cmTargets &tgts = m_Makefile->GetTargets();
|
||||
for(cmTargets::iterator l = tgts.begin();
|
||||
l != tgts.end(); l++)
|
||||
{
|
||||
for(std::vector<cmClassFile>::iterator i = l->second.begin();
|
||||
i != l->second.end(); ++i)
|
||||
l->second.GenerateSourceFilesFromSourceLists(*m_Makefile);
|
||||
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;
|
||||
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());
|
||||
info->m_IncludeName = i->m_FullPath;
|
||||
info->m_IncludeName = i->GetFullPath();
|
||||
info->m_ClassFileIndex = &*i;
|
||||
m_DependInformation.push_back(info);
|
||||
}
|
||||
|
@ -101,11 +104,11 @@ void cmMakeDepend::DoDepends()
|
|||
// find the class
|
||||
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();
|
||||
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.
|
||||
if(info->m_ClassFileIndex != 0)
|
||||
{
|
||||
cmClassFile& cFile = *(info->m_ClassFileIndex);
|
||||
cFile.m_Depends.erase(cFile.m_Depends.begin(), cFile.m_Depends.end());
|
||||
cmSourceFile& cFile = *(info->m_ClassFileIndex);
|
||||
cFile.GetDepends().erase(cFile.GetDepends().begin(),
|
||||
cFile.GetDepends().end());
|
||||
}
|
||||
|
||||
// Use the real file to find its dependencies.
|
||||
|
@ -143,22 +147,24 @@ void cmMakeDepend::Depend(cmDependInformation* info)
|
|||
if(info->m_ClassFileIndex != 0)
|
||||
{
|
||||
// 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
|
||||
// file.
|
||||
if(!cFile.m_Depends.empty())
|
||||
if(!cFile.GetDepends().empty())
|
||||
{
|
||||
// Initial dependencies have been given. Use them to begin the
|
||||
// recursion.
|
||||
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());
|
||||
}
|
||||
|
||||
// Erase the dependency hints from the cmClassFile. They will be
|
||||
// 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.
|
||||
return;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#define cmMakeDepend_h
|
||||
|
||||
#include "cmMakefile.h"
|
||||
#include "cmClassFile.h"
|
||||
#include "cmSourceFile.h"
|
||||
#include "cmRegularExpression.h"
|
||||
#include "cmStandardIncludes.h"
|
||||
|
||||
|
@ -60,7 +60,7 @@ struct cmDependInformation
|
|||
* The index into the cmMakefile::m_Classes 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
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "cmMakefile.h"
|
||||
#include "cmCommand.h"
|
||||
#include "cmStandardIncludes.h"
|
||||
#include "cmClassFile.h"
|
||||
#include "cmSourceFile.h"
|
||||
#include "cmDirectory.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmMakefileGenerator.h"
|
||||
|
@ -92,11 +92,11 @@ void cmMakefile::Print() const
|
|||
{
|
||||
// print the class lists
|
||||
std::cout << "classes:\n";
|
||||
for(ClassMap::const_iterator l = m_Classes.begin();
|
||||
l != m_Classes.end(); l++)
|
||||
for(SourceMap::const_iterator l = m_Sources.begin();
|
||||
l != m_Sources.end(); l++)
|
||||
{
|
||||
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->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
|
||||
if (sl == m_Classes.end())
|
||||
if (sl == m_Sources.end())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// 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)
|
||||
{
|
||||
if (i->m_ClassName == cname)
|
||||
if (i->GetSourceName() == cname)
|
||||
{
|
||||
return &(*i);
|
||||
}
|
||||
|
@ -291,9 +291,9 @@ void cmMakefile::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,
|
||||
|
@ -661,38 +661,6 @@ cmMakefile::FindSourceGroup(const char* source,
|
|||
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,
|
||||
std::vector<std::string> &args) const
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#define cmMakefile_h
|
||||
|
||||
#include "cmStandardIncludes.h"
|
||||
#include "cmClassFile.h"
|
||||
#include "cmSourceFile.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmSourceGroup.h"
|
||||
#include "cmTarget.h"
|
||||
|
@ -170,7 +170,7 @@ public:
|
|||
/**
|
||||
* 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.
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
cmSystemTools::ConvertToUnixSlashes(m_cmHomeDirectory);
|
||||
this->AddDefinition("CMAKE_SOURCE_DIR", this->GetHomeDirectory());
|
||||
}
|
||||
const char* GetHomeDirectory()
|
||||
const char* GetHomeDirectory() const
|
||||
{
|
||||
return m_cmHomeDirectory.c_str();
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ public:
|
|||
cmSystemTools::ConvertToUnixSlashes(m_HomeOutputDirectory);
|
||||
this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory());
|
||||
}
|
||||
const char* GetHomeOutputDirectory()
|
||||
const char* GetHomeOutputDirectory() const
|
||||
{
|
||||
return m_HomeOutputDirectory.c_str();
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ public:
|
|||
m_cmStartDirectory = dir;
|
||||
cmSystemTools::ConvertToUnixSlashes(m_cmStartDirectory);
|
||||
}
|
||||
const char* GetStartDirectory()
|
||||
const char* GetStartDirectory() const
|
||||
{
|
||||
return m_cmStartDirectory.c_str();
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
m_StartOutputDirectory = lib;
|
||||
cmSystemTools::ConvertToUnixSlashes(m_StartOutputDirectory);
|
||||
}
|
||||
const char* GetStartOutputDirectory()
|
||||
const char* GetStartOutputDirectory() const
|
||||
{
|
||||
return m_StartOutputDirectory.c_str();
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ public:
|
|||
m_cmCurrentDirectory = dir;
|
||||
cmSystemTools::ConvertToUnixSlashes(m_cmCurrentDirectory);
|
||||
}
|
||||
const char* GetCurrentDirectory()
|
||||
const char* GetCurrentDirectory() const
|
||||
{
|
||||
return m_cmCurrentDirectory.c_str();
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ public:
|
|||
m_CurrentOutputDirectory = lib;
|
||||
cmSystemTools::ConvertToUnixSlashes(m_CurrentOutputDirectory);
|
||||
}
|
||||
const char* GetCurrentOutputDirectory()
|
||||
const char* GetCurrentOutputDirectory() const
|
||||
{
|
||||
return m_CurrentOutputDirectory.c_str();
|
||||
}
|
||||
|
@ -359,16 +359,10 @@ public:
|
|||
/**
|
||||
* Return a list of source files in this makefile.
|
||||
*/
|
||||
typedef std::map<std::string,std::vector<cmClassFile> > ClassMap;
|
||||
ClassMap &GetClasses() {return m_Classes;}
|
||||
cmClassFile *GetClass(const char *srclist, const char *className);
|
||||
|
||||
|
||||
/**
|
||||
* Return a list of classes in the passed source lists
|
||||
*/
|
||||
std::vector<cmClassFile> GetClassesFromSourceLists(
|
||||
const std::vector<std::string> &srcLists);
|
||||
typedef std::map<std::string,std::vector<cmSourceFile> > SourceMap;
|
||||
const SourceMap &GetSources() const {return m_Sources;}
|
||||
SourceMap &GetSources() {return m_Sources;}
|
||||
cmSourceFile *GetSource(const char *srclist, const char *sourceName);
|
||||
|
||||
/**
|
||||
* Obtain a list of auxiliary source directories.
|
||||
|
@ -460,7 +454,7 @@ protected:
|
|||
|
||||
// libraries, classes, and executables
|
||||
cmTargets m_Targets;
|
||||
ClassMap m_Classes;
|
||||
SourceMap m_Sources;
|
||||
|
||||
std::vector<std::string> m_SubDirectories; // list of sub directories
|
||||
std::vector<std::string> m_MakeVerbatim; // lines copied from input file
|
||||
|
@ -489,9 +483,9 @@ private:
|
|||
*/
|
||||
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
|
||||
// to the m_Classes array
|
||||
// to the m_Sources array
|
||||
void PrintStringVector(const char* s, const std::vector<std::string>& v) const;
|
||||
void AddDefaultCommands();
|
||||
void AddDefaultDefinitions();
|
||||
|
|
|
@ -35,7 +35,7 @@ bool cmOptionCommand::Invoke(std::vector<std::string>& args)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_Makefile->AddDefinition("WRAP_TCL", cacheValue);
|
||||
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
See COPYRIGHT.txt for copyright details.
|
||||
|
||||
=========================================================================*/
|
||||
#include "cmClassFile.h"
|
||||
#include "cmSourceFile.h"
|
||||
#include "cmStandardIncludes.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
|
@ -23,10 +23,10 @@
|
|||
// 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
|
||||
// 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_ClassName = name;
|
||||
m_SourceName = name;
|
||||
std::string pathname = dir;
|
||||
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
|
||||
// as is without extensions added on.
|
||||
pathname += m_ClassName;
|
||||
pathname += m_SourceName;
|
||||
std::string hname = pathname;
|
||||
if(cmSystemTools::FileExists(hname.c_str()))
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ void cmClassFile::SetName(const char* name, const char* dir)
|
|||
hname += ".cxx";
|
||||
if(cmSystemTools::FileExists(hname.c_str()))
|
||||
{
|
||||
m_ClassExtension = "cxx";
|
||||
m_SourceExtension = "cxx";
|
||||
m_HeaderFileOnly = false;
|
||||
m_FullPath = hname;
|
||||
return;
|
||||
|
@ -60,7 +60,7 @@ void cmClassFile::SetName(const char* name, const char* dir)
|
|||
if(cmSystemTools::FileExists(hname.c_str()))
|
||||
{
|
||||
m_HeaderFileOnly = false;
|
||||
m_ClassExtension = "c";
|
||||
m_SourceExtension = "c";
|
||||
m_FullPath = hname;
|
||||
return;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ void cmClassFile::SetName(const char* name, const char* dir)
|
|||
if(cmSystemTools::FileExists(hname.c_str()))
|
||||
{
|
||||
m_HeaderFileOnly = false;
|
||||
m_ClassExtension = "txx";
|
||||
m_SourceExtension = "txx";
|
||||
m_FullPath = hname;
|
||||
return;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ void cmClassFile::SetName(const char* name, const char* dir)
|
|||
hname += ".h";
|
||||
if(cmSystemTools::FileExists(hname.c_str()))
|
||||
{
|
||||
m_ClassExtension = "h";
|
||||
m_SourceExtension = "h";
|
||||
m_FullPath = hname;
|
||||
return;
|
||||
}
|
||||
|
@ -86,24 +86,24 @@ void cmClassFile::SetName(const char* name, const char* dir)
|
|||
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)
|
||||
{
|
||||
m_HeaderFileOnly = hfo;
|
||||
m_ClassName = name;
|
||||
m_SourceName = name;
|
||||
std::string pathname = dir;
|
||||
if(pathname != "")
|
||||
{
|
||||
pathname += "/";
|
||||
}
|
||||
|
||||
pathname += m_ClassName + "." + ext;
|
||||
pathname += m_SourceName + "." + ext;
|
||||
m_FullPath = pathname;
|
||||
m_ClassExtension = ext;
|
||||
m_SourceExtension = ext;
|
||||
return;
|
||||
}
|
||||
|
||||
void cmClassFile::Print() const
|
||||
void cmSourceFile::Print() const
|
||||
{
|
||||
if(m_AbstractClass)
|
||||
{
|
||||
|
@ -121,5 +121,5 @@ void cmClassFile::Print() const
|
|||
{
|
||||
std::cout << "CXX file ";
|
||||
}
|
||||
std::cout << m_ClassName << std::endl;
|
||||
std::cout << m_SourceName << std::endl;
|
||||
}
|
|
@ -13,25 +13,25 @@
|
|||
See COPYRIGHT.txt for copyright details.
|
||||
|
||||
=========================================================================*/
|
||||
#ifndef cmClassFile_h
|
||||
#define cmClassFile_h
|
||||
#ifndef cmSourceFile_h
|
||||
#define cmSourceFile_h
|
||||
|
||||
#include "cmStandardIncludes.h"
|
||||
|
||||
/** \class cmClassFile
|
||||
/** \class cmSourceFile
|
||||
* \brief Represent a class loaded from a makefile.
|
||||
*
|
||||
* cmClassFile is represents a class loaded from
|
||||
* cmSourceFile is represents a class loaded from
|
||||
* a makefile.
|
||||
*/
|
||||
class cmClassFile
|
||||
class cmSourceFile
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct instance as a concrete class with both a
|
||||
* .h and .cxx file.
|
||||
*/
|
||||
cmClassFile()
|
||||
cmSourceFile()
|
||||
{
|
||||
m_AbstractClass = false;
|
||||
m_HeaderFileOnly = false;
|
||||
|
@ -61,38 +61,56 @@ public:
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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::string m_SourceName;
|
||||
std::string m_SourceExtension;
|
||||
std::vector<std::string> m_Depends;
|
||||
};
|
||||
|
|
@ -26,10 +26,10 @@ bool cmSourceFilesCommand::Invoke(std::vector<std::string>& args)
|
|||
for(std::vector<std::string>::iterator i = (args.begin() + 1);
|
||||
i != args.end(); ++i)
|
||||
{
|
||||
cmClassFile file;
|
||||
file.m_AbstractClass = false;
|
||||
cmSourceFile file;
|
||||
file.SetIsAnAbstractClass(false);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -18,11 +18,9 @@
|
|||
// cmSourceFilesRequireCommand
|
||||
bool cmSourceFilesRequireCommand::Invoke(std::vector<std::string>& args)
|
||||
{
|
||||
if(args.size() < 4 )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
}
|
||||
this->SetError(" deprecated - use SourceFiles command inside an If block ");
|
||||
return false;
|
||||
|
||||
std::vector<std::string>::iterator i = args.begin();
|
||||
// Search to the key word SOURCES_BEGIN is found
|
||||
// if one of the required defines is not there, then
|
||||
|
@ -46,10 +44,10 @@ bool cmSourceFilesRequireCommand::Invoke(std::vector<std::string>& args)
|
|||
++i;
|
||||
for(; i != args.end(); ++i)
|
||||
{
|
||||
cmClassFile file;
|
||||
file.m_AbstractClass = false;
|
||||
cmSourceFile file;
|
||||
file.SetIsAnAbstractClass(false);
|
||||
file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory());
|
||||
m_Makefile->AddClass(file, sname);
|
||||
m_Makefile->AddSource(file, sname);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "cmStandardIncludes.h"
|
||||
#include "cmCustomCommand.h"
|
||||
#include "cmSourceFile.h"
|
||||
|
||||
/** \class cmTarget
|
||||
* \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
|
||||
*/
|
||||
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;}
|
||||
|
||||
/**
|
||||
* 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:
|
||||
std::vector<cmCustomCommand> m_CustomCommands;
|
||||
std::vector<std::string> m_SourceLists;
|
||||
bool m_IsALibrary;
|
||||
std::vector<cmSourceFile> m_SourceFiles;
|
||||
};
|
||||
|
||||
typedef std::map<std::string,cmTarget> cmTargets;
|
||||
|
|
|
@ -25,11 +25,9 @@ cmUnixDefinesCommand::cmUnixDefinesCommand()
|
|||
// cmUNIXDefinesCommand
|
||||
bool cmUnixDefinesCommand::Invoke(std::vector<std::string>& args)
|
||||
{
|
||||
if(args.size() < 1 )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
}
|
||||
this->SetError(" deprecated - use AddDefinitions inside an If block ");
|
||||
return false;
|
||||
|
||||
for(std::vector<std::string>::iterator i = args.begin();
|
||||
i != args.end(); ++i)
|
||||
{
|
||||
|
|
|
@ -25,11 +25,9 @@ cmUnixLibrariesCommand::cmUnixLibrariesCommand()
|
|||
// cmUnixLibrariesCommand
|
||||
bool cmUnixLibrariesCommand::Invoke(std::vector<std::string>& args)
|
||||
{
|
||||
if(args.size() < 1 )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
}
|
||||
this->SetError(" deprecated - use LIBRARY command inside an IF block ");
|
||||
return false;
|
||||
|
||||
for(std::vector<std::string>::iterator i = args.begin();
|
||||
i != args.end(); ++i)
|
||||
{
|
||||
|
|
|
@ -94,38 +94,18 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
|||
for(cmTargets::const_iterator l = tgts.begin();
|
||||
l != tgts.end(); l++)
|
||||
{
|
||||
std::vector<cmClassFile> classes =
|
||||
m_Makefile->GetClassesFromSourceLists(l->second.GetSourceLists());
|
||||
std::vector<cmSourceFile> classes = l->second.GetSourceFiles();
|
||||
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++)
|
||||
{
|
||||
if(!i->m_HeaderFileOnly)
|
||||
if(!i->IsAHeaderFileOnly())
|
||||
{
|
||||
fout << "\\\n" << i->m_ClassName << ".o ";
|
||||
fout << "\\\n" << i->GetSourceName() << ".o ";
|
||||
}
|
||||
}
|
||||
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
|
||||
void cmUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout)
|
||||
{
|
||||
cmMakefile::ClassMap &Classes = m_Makefile->GetClasses();
|
||||
for(cmMakefile::ClassMap::iterator l = Classes.begin();
|
||||
l != Classes.end(); l++)
|
||||
cmMakefile::SourceMap &Sources = m_Makefile->GetSources();
|
||||
for(cmMakefile::SourceMap::iterator l = Sources.begin();
|
||||
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++)
|
||||
{
|
||||
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 =
|
||||
i->m_Depends.begin();
|
||||
j != i->m_Depends.end(); ++j)
|
||||
i->GetDepends().begin();
|
||||
j != i->GetDepends().end(); ++j)
|
||||
{
|
||||
if(j+1 == i->m_Depends.end())
|
||||
if(j+1 == i->GetDepends().end())
|
||||
{
|
||||
fout << *j << " \n";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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
|
|
@ -13,10 +13,10 @@
|
|||
See COPYRIGHT.txt for copyright details.
|
||||
|
||||
=========================================================================*/
|
||||
#include "cmWrapTclCommand.h"
|
||||
#include "cmVTKWrapTclCommand.h"
|
||||
|
||||
// cmWrapTclCommand
|
||||
bool cmWrapTclCommand::Invoke(std::vector<std::string>& args)
|
||||
// cmVTKWrapTclCommand
|
||||
bool cmVTKWrapTclCommand::Invoke(std::vector<std::string>& args)
|
||||
{
|
||||
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
|
||||
// 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;
|
||||
}
|
||||
|
||||
// add in a depend in the vtkWrapTcl executable
|
||||
// add in a depend in the vtkVTKWrapTcl executable
|
||||
m_Makefile->AddUtility("vtkWrapTcl");
|
||||
|
||||
// what is the current source dir
|
||||
|
@ -42,29 +42,29 @@ bool cmWrapTclCommand::Invoke(std::vector<std::string>& args)
|
|||
m_SourceList = args[1];
|
||||
|
||||
// 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);
|
||||
j != args.end(); ++j)
|
||||
{
|
||||
for(cmMakefile::ClassMap::iterator l = Classes.begin();
|
||||
for(cmMakefile::SourceMap::iterator l = Classes.begin();
|
||||
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++)
|
||||
{
|
||||
cmClassFile &curr = *i;
|
||||
cmSourceFile &curr = *i;
|
||||
// if we should wrap the class
|
||||
if (!curr.m_WrapExclude)
|
||||
if (!curr.GetWrapExclude())
|
||||
{
|
||||
cmClassFile file;
|
||||
file.m_AbstractClass = curr.m_AbstractClass;
|
||||
std::string newName = curr.m_ClassName + "Tcl";
|
||||
cmSourceFile file;
|
||||
file.SetIsAnAbstractClass(curr.IsAnAbstractClass());
|
||||
std::string newName = curr.GetSourceName() + "Tcl";
|
||||
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
|
||||
"cxx",false);
|
||||
std::string hname = cdir + "/" + curr.m_ClassName + ".h";
|
||||
std::string hname = cdir + "/" + curr.GetSourceName() + ".h";
|
||||
m_WrapHeaders.push_back(hname);
|
||||
// add starting depends
|
||||
file.m_Depends.push_back(hname);
|
||||
file.GetDepends().push_back(hname);
|
||||
m_WrapClasses.push_back(file);
|
||||
}
|
||||
}
|
||||
|
@ -74,13 +74,13 @@ bool cmWrapTclCommand::Invoke(std::vector<std::string>& args)
|
|||
return true;
|
||||
}
|
||||
|
||||
void cmWrapTclCommand::FinalPass()
|
||||
void cmVTKWrapTclCommand::FinalPass()
|
||||
{
|
||||
// first we add the rules for all the .h to Tcl.cxx files
|
||||
int lastClass = m_WrapClasses.size();
|
||||
std::vector<std::string> depends;
|
||||
std::string wtcl = "${WRAP_TCL_EXE}";
|
||||
std::string hints = "${WRAP_HINTS}";
|
||||
std::string wtcl = "${VTK_WRAP_TCL_EXE}";
|
||||
std::string hints = "${VTK_WRAP_HINTS}";
|
||||
|
||||
// Create the init file
|
||||
std::string res = m_LibraryName;
|
||||
|
@ -88,22 +88,22 @@ void cmWrapTclCommand::FinalPass()
|
|||
this->CreateInitFile(res);
|
||||
|
||||
// add the init file
|
||||
cmClassFile cfile;
|
||||
cfile.m_AbstractClass = false;
|
||||
cmSourceFile cfile;
|
||||
cfile.SetIsAnAbstractClass(false);
|
||||
std::string newName = m_LibraryName;
|
||||
newName += "Init";
|
||||
cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
|
||||
"cxx",false);
|
||||
m_Makefile->AddClass(cfile,m_SourceList.c_str());
|
||||
m_Makefile->AddSource(cfile,m_SourceList.c_str());
|
||||
|
||||
// wrap all the .h files
|
||||
depends.push_back(wtcl);
|
||||
for(int classNum = 0; classNum < lastClass; classNum++)
|
||||
{
|
||||
m_Makefile->AddClass(m_WrapClasses[classNum],m_SourceList.c_str());
|
||||
std::string res = m_WrapClasses[classNum].m_ClassName + ".cxx";
|
||||
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
|
||||
std::string res = m_WrapClasses[classNum].GetSourceName() + ".cxx";
|
||||
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(),
|
||||
cmd.c_str(), depends,
|
||||
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;
|
||||
|
||||
|
@ -131,7 +131,7 @@ bool cmWrapTclCommand::CreateInitFile(std::string& res)
|
|||
int classNum;
|
||||
for(classNum = 0; classNum < lastClass; classNum++)
|
||||
{
|
||||
if (!m_WrapClasses[classNum].m_AbstractClass)
|
||||
if (!m_WrapClasses[classNum].IsAnAbstractClass())
|
||||
{
|
||||
std::string cls = m_WrapHeaders[classNum];
|
||||
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 */
|
||||
bool cmWrapTclCommand::WriteInit(const char *kitName, std::string& outFileName,
|
||||
std::vector<std::string>& classes)
|
||||
bool cmVTKWrapTclCommand::WriteInit(const char *kitName,
|
||||
std::string& outFileName,
|
||||
std::vector<std::string>& classes)
|
||||
{
|
||||
unsigned int i;
|
||||
FILE *fout = fopen(outFileName.c_str(),"w");
|
|
@ -1,16 +1,16 @@
|
|||
#ifndef cmWrapTclCommand_h
|
||||
#define cmWrapTclCommand_h
|
||||
#ifndef cmVTKWrapTclCommand_h
|
||||
#define cmVTKWrapTclCommand_h
|
||||
|
||||
#include "cmStandardIncludes.h"
|
||||
#include "cmCommand.h"
|
||||
|
||||
/** \class cmWrapTclCommand
|
||||
/** \class cmVTKWrapTclCommand
|
||||
* \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.
|
||||
*/
|
||||
class cmWrapTclCommand : public cmCommand
|
||||
class cmVTKWrapTclCommand : public cmCommand
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -18,7 +18,7 @@ public:
|
|||
*/
|
||||
virtual cmCommand* Clone()
|
||||
{
|
||||
return new cmWrapTclCommand;
|
||||
return new cmVTKWrapTclCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,14 +45,14 @@ public:
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
virtual const char* GetTerseDocumentation()
|
||||
{
|
||||
return "Create Tcl Wrappers.";
|
||||
return "Create Tcl Wrappers for VTK classes.";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
virtual const char* GetFullDocumentation()
|
||||
{
|
||||
return
|
||||
"WRAP_TCL(resultingLibraryName SourceListName SourceLists ...)";
|
||||
"VTK_WRAP_TCL(resultingLibraryName SourceListName SourceLists ...)";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
std::vector<std::string>& classes);
|
||||
|
||||
private:
|
||||
std::vector<cmClassFile> m_WrapClasses;
|
||||
std::vector<cmSourceFile> m_WrapClasses;
|
||||
std::vector<std::string> m_WrapHeaders;
|
||||
std::string m_LibraryName;
|
||||
std::string m_SourceList;
|
|
@ -25,11 +25,9 @@ cmWin32DefinesCommand::cmWin32DefinesCommand()
|
|||
// cmWin32DefinesCommand
|
||||
bool cmWin32DefinesCommand::Invoke(std::vector<std::string>& args)
|
||||
{
|
||||
if(args.size() < 1 )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
}
|
||||
this->SetError(" deprecated - use AddDefinitions inside an If block ");
|
||||
return false;
|
||||
|
||||
for(std::vector<std::string>::iterator i = args.begin();
|
||||
i != args.end(); ++i)
|
||||
{
|
||||
|
|
|
@ -27,11 +27,9 @@ cmWin32IncludeDirectoryCommand::cmWin32IncludeDirectoryCommand()
|
|||
|
||||
bool cmWin32IncludeDirectoryCommand::Invoke(std::vector<std::string>& args)
|
||||
{
|
||||
if(args.size() < 1 )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
}
|
||||
this->SetError(" deprecated - use INCLUDE_DIRECTORIES command inside an if block ");
|
||||
return false;
|
||||
|
||||
for(std::vector<std::string>::iterator i = args.begin();
|
||||
i != args.end(); ++i)
|
||||
{
|
||||
|
|
|
@ -26,11 +26,9 @@ cmWin32LibrariesCommand::cmWin32LibrariesCommand()
|
|||
// cmWin32LibrariesCommand
|
||||
bool cmWin32LibrariesCommand::Invoke(std::vector<std::string>& args)
|
||||
{
|
||||
if(args.size() < 1 )
|
||||
{
|
||||
this->SetError("Called with incorrect number of arguments");
|
||||
return false;
|
||||
}
|
||||
this->SetError(" deprecated - use LIBRARY command inside an IF block ");
|
||||
return false;
|
||||
|
||||
for(std::vector<std::string>::iterator i = args.begin();
|
||||
i != args.end(); ++i)
|
||||
{
|
||||
|
|
|
@ -24,19 +24,19 @@ bool cmWrapExcludeFilesCommand::Invoke(std::vector<std::string>& args)
|
|||
return false;
|
||||
}
|
||||
|
||||
cmMakefile::ClassMap &Classes = m_Makefile->GetClasses();
|
||||
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
|
||||
for(std::vector<std::string>::iterator j = args.begin();
|
||||
j != args.end(); ++j)
|
||||
{
|
||||
for(cmMakefile::ClassMap::iterator l = Classes.begin();
|
||||
for(cmMakefile::SourceMap::iterator l = Classes.begin();
|
||||
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++)
|
||||
{
|
||||
if(i->m_ClassName == (*j))
|
||||
if(i->GetSourceName() == (*j))
|
||||
{
|
||||
i->m_WrapExclude = true;
|
||||
i->SetWrapExclude(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue