Commit 73f04d14 authored by Ken Martin's avatar Ken Martin

many fixes and cleanup and features

parent b5746484
......@@ -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,18 +64,22 @@ 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;
CacheEntryMap m_Cache;
......
......@@ -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);