ENH: move utilities to targets from makefile, and add versioning to cache
This commit is contained in:
parent
5b4a11af80
commit
4f77d737c9
|
@ -147,7 +147,8 @@ BOOL CMakeSetupDialog::OnInitDialog()
|
|||
m_WhereSourceControl.LimitText(2048);
|
||||
// Set the version number
|
||||
char tmp[1024];
|
||||
sprintf(tmp,"Version %s", cmMakefile::GetVersion());
|
||||
sprintf(tmp,"Version %d.%d", cmMakefile::GetMajorVersion(),
|
||||
cmMakefile::GetMinorVersion());
|
||||
SetDlgItemText(IDC_CMAKE_VERSION, tmp);
|
||||
this->UpdateData(FALSE);
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
|
|
|
@ -79,7 +79,7 @@ void cmAddTestCommand::FinalPass()
|
|||
fname += "CMakeTestfile.txt";
|
||||
|
||||
// Open the output Testfile
|
||||
std::ofstream fout(fname.c_str(), std::ios_base::app);
|
||||
std::ofstream fout(fname.c_str(), std::ios::app);
|
||||
if (!fout)
|
||||
{
|
||||
cmSystemTools::Error("Error Writing ", fname.c_str());
|
||||
|
|
|
@ -78,24 +78,27 @@ bool cmCablePackageCommand::InitialPass(std::vector<std::string>& args)
|
|||
cMakeLists += "CMakeLists.txt";
|
||||
cMakeLists = cmSystemTools::EscapeSpaces(cMakeLists.c_str());
|
||||
|
||||
std::string command = "${CMAKE_COMMAND} "+cMakeLists;
|
||||
std::string command = "${CMAKE_COMMAND}";
|
||||
std::string commandArgs = cMakeLists;
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
command += " -DSP";
|
||||
commandArgs += " -DSP";
|
||||
#endif
|
||||
command += " -H\"";
|
||||
command += m_Makefile->GetHomeDirectory();
|
||||
command += "\" -S\"";
|
||||
command += m_Makefile->GetStartDirectory();
|
||||
command += "\" -O\"";
|
||||
command += m_Makefile->GetStartOutputDirectory();
|
||||
command += "\" -B\"";
|
||||
command += m_Makefile->GetHomeOutputDirectory();
|
||||
command += "\"";
|
||||
commandArgs += " -H\"";
|
||||
commandArgs += m_Makefile->GetHomeDirectory();
|
||||
commandArgs += "\" -S\"";
|
||||
commandArgs += m_Makefile->GetStartDirectory();
|
||||
commandArgs += "\" -O\"";
|
||||
commandArgs += m_Makefile->GetStartOutputDirectory();
|
||||
commandArgs += "\" -B\"";
|
||||
commandArgs += m_Makefile->GetHomeOutputDirectory();
|
||||
commandArgs += "\"";
|
||||
m_Makefile->ExpandVariablesInString(commandArgs);
|
||||
m_Makefile->ExpandVariablesInString(command);
|
||||
|
||||
std::vector<std::string> depends;
|
||||
m_Makefile->AddCustomCommand(cMakeLists.c_str(),
|
||||
command.c_str(),
|
||||
commandArgs.c_str(),
|
||||
depends,
|
||||
"cable_config.xml", args[1].c_str());
|
||||
}
|
||||
|
@ -112,9 +115,6 @@ bool cmCablePackageCommand::InitialPass(std::vector<std::string>& args)
|
|||
// this cmCablePackageCommand's WritePackageHeader().
|
||||
m_CableData->BeginPackage(this);
|
||||
|
||||
// Tell the makefile that it needs the "cable" utility.
|
||||
m_Makefile->AddUtility("cable");
|
||||
|
||||
// Add custom rules to the makefile to generate this package's source
|
||||
// files.
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ bool cmCablePackageCommand::InitialPass(std::vector<std::string>& args)
|
|||
m_Makefile->ExpandVariablesInString(command);
|
||||
std::vector<std::string> depends;
|
||||
depends.push_back(command);
|
||||
command = "\""+command+"\" cable_config.xml";
|
||||
std::string commandArgs = " cable_config.xml";
|
||||
|
||||
std::vector<std::string> outputs;
|
||||
outputs.push_back("Cxx/"+m_PackageName+"_cxx.cxx");
|
||||
|
@ -131,6 +131,7 @@ bool cmCablePackageCommand::InitialPass(std::vector<std::string>& args)
|
|||
// A rule for the package's source files.
|
||||
m_Makefile->AddCustomCommand("cable_config.xml",
|
||||
command.c_str(),
|
||||
commandArgs.c_str(),
|
||||
depends,
|
||||
outputs, m_TargetName.c_str());
|
||||
}
|
||||
|
@ -155,6 +156,7 @@ bool cmCablePackageCommand::InitialPass(std::vector<std::string>& args)
|
|||
// A rule for the package's source files.
|
||||
m_Makefile->AddCustomCommand(input.c_str(),
|
||||
command.c_str(),
|
||||
"",
|
||||
depends,
|
||||
outputs, m_TargetName.c_str());
|
||||
}
|
||||
|
|
|
@ -142,8 +142,8 @@ void cmCableWrapTclCommand::GenerateCableFiles() const
|
|||
m_Makefile->ExpandVariablesInString(command);
|
||||
std::vector<std::string> depends;
|
||||
depends.push_back(command);
|
||||
command = cmSystemTools::EscapeSpaces(command.c_str());
|
||||
command += " "+packageConfigName+" -tcl "+packageTclFullName+".cxx";
|
||||
std::string commandArgs = " "+packageConfigName+
|
||||
" -tcl "+packageTclFullName+".cxx";
|
||||
|
||||
depends.push_back(packageConfigName);
|
||||
|
||||
|
@ -152,6 +152,7 @@ void cmCableWrapTclCommand::GenerateCableFiles() const
|
|||
|
||||
m_Makefile->AddCustomCommand(packageConfigName.c_str(),
|
||||
command.c_str(),
|
||||
commandArgs.c_str(),
|
||||
depends,
|
||||
outputs, m_TargetName.c_str());
|
||||
}
|
||||
|
@ -264,9 +265,10 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name,
|
|||
|
||||
std::string defineFlags = m_Makefile->GetDefineFlags();
|
||||
std::string includeFlags = "-I";
|
||||
includeFlags += m_Makefile->GetStartDirectory();
|
||||
includeFlags += std::string("\"") + m_Makefile->GetStartDirectory() + "\"";
|
||||
|
||||
const std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
|
||||
const std::vector<std::string>& includes =
|
||||
m_Makefile->GetIncludeDirectories();
|
||||
for(std::vector<std::string>::const_iterator i = includes.begin();
|
||||
i != includes.end(); ++i)
|
||||
{
|
||||
|
@ -281,6 +283,7 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name,
|
|||
|
||||
m_Makefile->AddCustomCommand(classCxxName.c_str(),
|
||||
command.c_str(),
|
||||
"",
|
||||
depends,
|
||||
outputs, m_TargetName.c_str());
|
||||
}
|
||||
|
@ -291,8 +294,7 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name,
|
|||
m_Makefile->ExpandVariablesInString(command);
|
||||
std::vector<std::string> depends;
|
||||
depends.push_back(command);
|
||||
command = cmSystemTools::EscapeSpaces(command.c_str());
|
||||
command += " "+classConfigName+" -tcl "+classTclFullName+".cxx";
|
||||
std::string commandArgs = " "+classConfigName+" -tcl "+classTclFullName+".cxx";
|
||||
|
||||
depends.push_back(classConfigName);
|
||||
depends.push_back(classXmlName);
|
||||
|
@ -302,6 +304,7 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name,
|
|||
|
||||
m_Makefile->AddCustomCommand(classConfigName.c_str(),
|
||||
command.c_str(),
|
||||
commandArgs.c_str(),
|
||||
depends,
|
||||
outputs, m_TargetName.c_str());
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "cmCacheManager.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmRegularExpression.h"
|
||||
#include "stdio.h"
|
||||
|
||||
const char* cmCacheManagerTypes[] =
|
||||
{ "BOOL",
|
||||
|
@ -124,6 +125,8 @@ bool cmCacheManager::LoadCache(const char* path,
|
|||
char buffer[bsize];
|
||||
// input line is: key:type=value
|
||||
cmRegularExpression reg("^([^:]*):([^=]*)=(.*)$");
|
||||
// input line is: "key":type=value
|
||||
cmRegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*)$");
|
||||
while(fin)
|
||||
{
|
||||
// Format is key:type=value
|
||||
|
@ -143,7 +146,17 @@ bool cmCacheManager::LoadCache(const char* path,
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if(reg.find(buffer))
|
||||
if(regQuoted.find(buffer))
|
||||
{
|
||||
e.m_Type = cmCacheManager::StringToType(regQuoted.match(2).c_str());
|
||||
// only load internal values if internal is set
|
||||
if (internal || e.m_Type != INTERNAL)
|
||||
{
|
||||
e.m_Value = regQuoted.match(3);
|
||||
m_Cache[regQuoted.match(1)] = e;
|
||||
}
|
||||
}
|
||||
else if (reg.find(buffer))
|
||||
{
|
||||
e.m_Type = cmCacheManager::StringToType(reg.match(2).c_str());
|
||||
// only load internal values if internal is set
|
||||
|
@ -158,6 +171,18 @@ bool cmCacheManager::LoadCache(const char* path,
|
|||
cmSystemTools::Error("Parse error in cache file ", cacheFile.c_str());
|
||||
}
|
||||
}
|
||||
// if CMAKE version not found in the list file
|
||||
// add them as version 0.0
|
||||
if(!this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"))
|
||||
{
|
||||
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0",
|
||||
"Minor version of cmake used to create the "
|
||||
"current loaded cache", cmCacheManager::INTERNAL);
|
||||
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0",
|
||||
"Major version of cmake used to create the "
|
||||
"current loaded cache", cmCacheManager::INTERNAL);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -177,13 +202,13 @@ void cmCacheManager::DefineCache(cmMakefile *mf)
|
|||
}
|
||||
}
|
||||
|
||||
bool cmCacheManager::SaveCache(cmMakefile* mf) const
|
||||
bool cmCacheManager::SaveCache(cmMakefile* mf)
|
||||
{
|
||||
return this->SaveCache(mf->GetHomeOutputDirectory());
|
||||
}
|
||||
|
||||
|
||||
bool cmCacheManager::SaveCache(const char* path) const
|
||||
bool cmCacheManager::SaveCache(const char* path)
|
||||
{
|
||||
std::string cacheFile = path;
|
||||
cacheFile += "/CMakeCache.txt";
|
||||
|
@ -196,6 +221,17 @@ bool cmCacheManager::SaveCache(const char* path) const
|
|||
cacheFile.c_str());
|
||||
return false;
|
||||
}
|
||||
// before writting the cache, update the version numbers
|
||||
// to the
|
||||
char temp[1024];
|
||||
sprintf(temp, "%d", cmMakefile::GetMinorVersion());
|
||||
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp,
|
||||
"Minor version of cmake used to create the "
|
||||
"current loaded cache", cmCacheManager::INTERNAL);
|
||||
sprintf(temp, "%d", cmMakefile::GetMajorVersion());
|
||||
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp,
|
||||
"Major version of cmake used to create the "
|
||||
"current loaded cache", cmCacheManager::INTERNAL);
|
||||
fout << "# This is the CMakeCache file.\n"
|
||||
<< "# For build in directory: " << path << "\n"
|
||||
<< "# You can edit this file to change values found and used by cmake.\n"
|
||||
|
@ -221,7 +257,19 @@ bool cmCacheManager::SaveCache(const char* path) const
|
|||
{
|
||||
// Format is key:type=value
|
||||
cmCacheManager::OutputHelpString(fout, ce.m_HelpString);
|
||||
fout << (*i).first.c_str() << ":"
|
||||
std::string key;
|
||||
// support : in key name by double quoting
|
||||
if((*i).first.find(':') != std::string::npos)
|
||||
{
|
||||
key = "\"";
|
||||
key += i->first;
|
||||
key += "\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
key = i->first;
|
||||
}
|
||||
fout << key.c_str() << ":"
|
||||
<< cmCacheManagerTypes[t] << "="
|
||||
<< ce.m_Value << "\n\n";
|
||||
}
|
||||
|
@ -242,7 +290,19 @@ bool cmCacheManager::SaveCache(const char* path) const
|
|||
{
|
||||
// Format is key:type=value
|
||||
cmCacheManager::OutputHelpString(fout, ce.m_HelpString);
|
||||
fout << (*i).first.c_str() << ":"
|
||||
std::string key;
|
||||
// support : in key name by double quoting
|
||||
if((*i).first.find(':') != std::string::npos)
|
||||
{
|
||||
key = "\"";
|
||||
key += i->first;
|
||||
key += "\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
key = i->first;
|
||||
}
|
||||
fout << key.c_str() << ":"
|
||||
<< cmCacheManagerTypes[t] << "="
|
||||
<< ce.m_Value << "\n";
|
||||
}
|
||||
|
|
|
@ -84,9 +84,9 @@ public:
|
|||
void DefineCache(cmMakefile*);
|
||||
|
||||
//! Save cache for given makefile. Saves to ouput home CMakeCache.txt.
|
||||
bool SaveCache(cmMakefile*) const;
|
||||
bool SaveCache(cmMakefile*) ;
|
||||
//! Save cache for given makefile. Saves to ouput path/CMakeCache.txt
|
||||
bool SaveCache(const char* path) const;
|
||||
bool SaveCache(const char* path) ;
|
||||
|
||||
//! Add an entry into the cache
|
||||
void AddCacheEntry(const char* key, const char* value,
|
||||
|
|
|
@ -189,7 +189,7 @@ void cmDSWWriter::WriteProject(std::ostream& fout,
|
|||
const char* dspname,
|
||||
const char* dir,
|
||||
cmDSPWriter* project,
|
||||
const cmTarget &l
|
||||
const cmTarget& target
|
||||
)
|
||||
{
|
||||
fout << "#########################################################"
|
||||
|
@ -202,13 +202,13 @@ void cmDSWWriter::WriteProject(std::ostream& fout,
|
|||
|
||||
// insert Begin Project Dependency Project_Dep_Name project stuff here
|
||||
cmTarget::LinkLibraries::const_iterator j, jend;
|
||||
j = l.GetLinkLibraries().begin();
|
||||
jend = l.GetLinkLibraries().end();
|
||||
j = target.GetLinkLibraries().begin();
|
||||
jend = target.GetLinkLibraries().end();
|
||||
for(;j!= jend; ++j)
|
||||
{
|
||||
if(j->first != dspname)
|
||||
{
|
||||
if (!(l.GetType() == cmTarget::LIBRARY) ||
|
||||
if (!(target.GetType() == cmTarget::LIBRARY) ||
|
||||
project->GetLibraryBuildType() == cmDSPWriter::DLL)
|
||||
{
|
||||
// is the library part of this DSW ? If so add dependency
|
||||
|
@ -224,10 +224,10 @@ void cmDSWWriter::WriteProject(std::ostream& fout,
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<std::string>::iterator i, end;
|
||||
std::set<std::string>::const_iterator i, end;
|
||||
// write utility dependencies.
|
||||
i = project->GetMakefile()->GetUtilities().begin();
|
||||
end = project->GetMakefile()->GetUtilities().end();
|
||||
i = target.GetUtilities().begin();
|
||||
end = target.GetUtilities().end();
|
||||
for(;i!= end; ++i)
|
||||
{
|
||||
if(*i != dspname)
|
||||
|
|
|
@ -48,6 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "cmCommands.h"
|
||||
#include "cmCacheManager.h"
|
||||
#include "cmFunctionBlocker.h"
|
||||
#include "stdio.h"
|
||||
|
||||
// default is not to be building executables
|
||||
cmMakefile::cmMakefile()
|
||||
|
@ -66,6 +67,29 @@ cmMakefile::cmMakefile()
|
|||
cmCacheManager::GetInstance()->DefineCache(this);
|
||||
}
|
||||
|
||||
unsigned int cmMakefile::GetCacheMajorVersion()
|
||||
{
|
||||
if(!cmCacheManager::GetInstance()->
|
||||
GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return atoi(cmCacheManager::GetInstance()->
|
||||
GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"));
|
||||
}
|
||||
|
||||
unsigned int cmMakefile::GetCacheMinorVersion()
|
||||
{
|
||||
if(!cmCacheManager::GetInstance()->
|
||||
GetCacheValue("Cmake_Cache_MINOR_VERSION"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return atoi(cmCacheManager::GetInstance()->
|
||||
GetCacheValue("CMAKE_CACHE_MINOR_VERSION"));
|
||||
}
|
||||
|
||||
|
||||
void cmMakefile::AddDefaultCommands()
|
||||
{
|
||||
std::list<cmCommand*> commands;
|
||||
|
@ -171,11 +195,8 @@ void cmMakefile::Print() const
|
|||
m_cmHomeDirectory.c_str() << std::endl;
|
||||
std::cout << " m_ProjectName; " << m_ProjectName.c_str() << std::endl;
|
||||
this->PrintStringVector("m_SubDirectories ", m_SubDirectories);
|
||||
this->PrintStringVector("m_MakeVerbatim ", m_MakeVerbatim);
|
||||
this->PrintStringVector("m_IncludeDirectories;", m_IncludeDirectories);
|
||||
this->PrintStringVector("m_LinkDirectories", m_LinkDirectories);
|
||||
this->PrintStringVector("m_Utilities", m_Utilities);
|
||||
this->PrintStringVector("m_UtilityDirectories", m_UtilityDirectories);
|
||||
for( std::vector<cmSourceGroup>::const_iterator i = m_SourceGroups.begin();
|
||||
i != m_SourceGroups.end(); ++i)
|
||||
{
|
||||
|
@ -393,6 +414,7 @@ void cmMakefile::AddSource(cmSourceFile& cmfile, const char *srclist)
|
|||
|
||||
void cmMakefile::AddCustomCommand(const char* source,
|
||||
const char* command,
|
||||
const char* commandArgs,
|
||||
const std::vector<std::string>& depends,
|
||||
const std::vector<std::string>& outputs,
|
||||
const char *target)
|
||||
|
@ -400,20 +422,31 @@ void cmMakefile::AddCustomCommand(const char* source,
|
|||
// find the target,
|
||||
if (m_Targets.find(target) != m_Targets.end())
|
||||
{
|
||||
cmCustomCommand cc(source,command,depends,outputs);
|
||||
std::string c = cmSystemTools::EscapeSpaces(command);
|
||||
c += " ";
|
||||
c += commandArgs;
|
||||
cmCustomCommand cc(source,c.c_str(),depends,outputs);
|
||||
m_Targets[target].GetCustomCommands().push_back(cc);
|
||||
std::string cacheCommand = command;
|
||||
this->ExpandVariablesInString(cacheCommand);
|
||||
if(cmCacheManager::GetInstance()->GetCacheValue(cacheCommand.c_str()))
|
||||
{
|
||||
m_Targets[target].AddUtility(
|
||||
cmCacheManager::GetInstance()->GetCacheValue(cacheCommand.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cmMakefile::AddCustomCommand(const char* source,
|
||||
const char* command,
|
||||
const char* commandArgs,
|
||||
const std::vector<std::string>& depends,
|
||||
const char* output,
|
||||
const char *target)
|
||||
{
|
||||
std::vector<std::string> outputs;
|
||||
outputs.push_back(output);
|
||||
this->AddCustomCommand(source, command, depends, outputs, target);
|
||||
this->AddCustomCommand(source, command, commandArgs, depends, outputs, target);
|
||||
}
|
||||
|
||||
void cmMakefile::AddDefineFlag(const char* flag)
|
||||
|
@ -422,15 +455,6 @@ void cmMakefile::AddDefineFlag(const char* flag)
|
|||
m_DefineFlags += flag;
|
||||
}
|
||||
|
||||
void cmMakefile::AddUtility(const char* util)
|
||||
{
|
||||
m_Utilities.push_back(util);
|
||||
}
|
||||
|
||||
void cmMakefile::AddUtilityDirectory(const char* dir)
|
||||
{
|
||||
m_UtilityDirectories.push_back(dir);
|
||||
}
|
||||
|
||||
void cmMakefile::AddLinkLibrary(const char* lib, cmTarget::LinkLibraryType llt)
|
||||
{
|
||||
|
@ -796,10 +820,15 @@ cmMakefile::FindSubDirectoryCMakeListsFiles(std::vector<cmMakefile*>&
|
|||
void cmMakefile::AddDefaultDefinitions()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
this->AddDefinition("CMAKE_CFG_OUTDIR","$(OUTDIR)");
|
||||
this->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
|
||||
#else
|
||||
this->AddDefinition("CMAKE_CFG_OUTDIR",".");
|
||||
this->AddDefinition("CMAKE_CFG_INTDIR",".");
|
||||
#endif
|
||||
char temp[1024];
|
||||
sprintf(temp, "%d", cmMakefile::GetMinorVersion());
|
||||
this->AddDefinition("CMAKE_MINOR_VERSION", temp);
|
||||
sprintf(temp, "%d", cmMakefile::GetMajorVersion());
|
||||
this->AddDefinition("CMAKE_MAJOR_VERSION", temp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,9 +62,17 @@ class cmMakefile
|
|||
{
|
||||
public:
|
||||
/**
|
||||
* Return a string version number for CMake
|
||||
* Return major and minor version numbers for cmake.
|
||||
*/
|
||||
static const char *GetVersion() {return "0.1";}
|
||||
static unsigned int GetMajorVersion() { return 0;}
|
||||
static unsigned int GetMinorVersion() { return 1;}
|
||||
/**
|
||||
* Return the major and minor version of the cmake that
|
||||
* was used to write the currently loaded cache, note
|
||||
* this method will not work before the cache is loaded.
|
||||
*/
|
||||
static unsigned int GetCacheMajorVersion();
|
||||
static unsigned int GetCacheMinorVersion();
|
||||
|
||||
/**
|
||||
* Construct an empty makefile.
|
||||
|
@ -121,12 +129,14 @@ public:
|
|||
*/
|
||||
void AddCustomCommand(const char* source,
|
||||
const char* command,
|
||||
const char* commandArgs,
|
||||
const std::vector<std::string>& depends,
|
||||
const std::vector<std::string>& outputs,
|
||||
const char *target);
|
||||
|
||||
void AddCustomCommand(const char* source,
|
||||
const char* command,
|
||||
const char* commandArgs,
|
||||
const std::vector<std::string>& depends,
|
||||
const char* output,
|
||||
const char* target);
|
||||
|
@ -157,18 +167,6 @@ public:
|
|||
const std::vector<std::string> &depends,
|
||||
const std::vector<std::string> &outputs);
|
||||
|
||||
/**
|
||||
* Add a utility on which this project depends. A utility is an executable
|
||||
* name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
|
||||
* commands. It is not a full path nor does it have an extension.
|
||||
*/
|
||||
void AddUtility(const char*);
|
||||
|
||||
/**
|
||||
* Add a directory in which a utility may be built.
|
||||
*/
|
||||
void AddUtilityDirectory(const char*);
|
||||
|
||||
/**
|
||||
* Get a list of link libraries in the build.
|
||||
*/
|
||||
|
@ -377,22 +375,6 @@ public:
|
|||
return m_LinkDirectories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of utilities on which the project depends.
|
||||
*/
|
||||
std::vector<std::string>& GetUtilities()
|
||||
{
|
||||
return m_Utilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of directories that may contain the Utilities.
|
||||
*/
|
||||
std::vector<std::string>& GetUtilityDirectories()
|
||||
{
|
||||
return m_UtilityDirectories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of source files in this makefile.
|
||||
*/
|
||||
|
@ -407,12 +389,6 @@ public:
|
|||
std::vector<std::string>& GetAuxSourceDirectories()
|
||||
{return m_AuxSourceDirectories;}
|
||||
|
||||
/**
|
||||
* Do not use this.
|
||||
*/
|
||||
std::vector<std::string>& GetMakeVerbatim()
|
||||
{return m_MakeVerbatim;}
|
||||
|
||||
/**
|
||||
* Given a variable name, return its value (as a string).
|
||||
*/
|
||||
|
@ -504,11 +480,8 @@ protected:
|
|||
SourceMap m_Sources;
|
||||
|
||||
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_IncludeDirectories;
|
||||
std::vector<std::string> m_LinkDirectories;
|
||||
std::vector<std::string> m_Utilities;
|
||||
std::vector<std::string> m_UtilityDirectories;
|
||||
std::vector<std::string> m_ListFiles; // list of command files loaded
|
||||
|
||||
|
||||
|
|
|
@ -155,6 +155,12 @@ public:
|
|||
{
|
||||
return cmSystemTools::s_ErrorOccured;
|
||||
}
|
||||
|
||||
///! Set the error occured flag back to false
|
||||
static void ResetErrorOccuredFlag()
|
||||
{
|
||||
cmSystemTools::s_ErrorOccured = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the source file to the destination file only
|
||||
|
|
|
@ -119,6 +119,13 @@ public:
|
|||
*/
|
||||
void GenerateSourceFilesFromSourceLists(const cmMakefile &mf);
|
||||
|
||||
/** Add a utility on which this project depends. A utility is an executable
|
||||
* name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
|
||||
* commands. It is not a full path nor does it have an extension.
|
||||
*/
|
||||
void AddUtility(const char* u) { m_Utilities.insert(u);}
|
||||
///! Get the utilities used by this target
|
||||
std::set<std::string>const& GetUtilities() const { return m_Utilities; }
|
||||
private:
|
||||
std::vector<cmCustomCommand> m_CustomCommands;
|
||||
std::vector<std::string> m_SourceLists;
|
||||
|
@ -127,6 +134,7 @@ private:
|
|||
LinkLibraries m_LinkLibraries;
|
||||
bool m_InAll;
|
||||
std::string m_InstallPath;
|
||||
std::set<std::string> m_Utilities;
|
||||
};
|
||||
|
||||
typedef std::map<std::string,cmTarget> cmTargets;
|
||||
|
|
|
@ -457,30 +457,6 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
|
|||
<< "; make " << library.c_str() << "\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string>& utils = m_Makefile->GetUtilities();
|
||||
std::vector<std::string>& utildirs = m_Makefile->GetUtilityDirectories();
|
||||
std::vector<std::string>::iterator dir, util;
|
||||
// Search the list of utilities that may be used to generate code for
|
||||
// this project.
|
||||
for(util = utils.begin(); util != utils.end(); ++util)
|
||||
{
|
||||
bool found = false;
|
||||
// loop over the list of directories that the utilities might
|
||||
// be in, looking for an ADD_EXECUTABLE(util ...) line.
|
||||
for(dir = utildirs.begin(); dir != utildirs.end() && !found; ++dir)
|
||||
{
|
||||
std::string expression = "TARGETS =.*";
|
||||
expression += util->c_str();
|
||||
if(cmSystemTools::Grep(dir->c_str(), "Makefile",
|
||||
expression.c_str()))
|
||||
{
|
||||
fout << *util << " ";
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
fout << "\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -56,7 +56,10 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string>& args)
|
|||
const char* cacheValue =
|
||||
cmCacheManager::GetInstance()->GetCacheValue(cacheEntry.c_str());
|
||||
// If it exists already, we are done.
|
||||
if(cacheValue)
|
||||
// unless this is Major
|
||||
if(cacheValue &&
|
||||
(m_Makefile->GetCacheMajorVersion() != 0
|
||||
&& m_Makefile->GetCacheMinorVersion() != 0 ))
|
||||
{
|
||||
// Set the makefile's definition with the cache value.
|
||||
m_Makefile->AddDefinition(cacheEntry.c_str(), cacheValue);
|
||||
|
@ -86,12 +89,21 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string>& args)
|
|||
}
|
||||
|
||||
// The source exists.
|
||||
std::string cmakeCFGout = m_Makefile->GetDefinition("CMAKE_CFG_OUTDIR");
|
||||
std::string cmakeCFGout = m_Makefile->GetDefinition("CMAKE_CFG_INTDIR");
|
||||
std::string utilityDirectory = m_Makefile->GetCurrentOutputDirectory();
|
||||
utilityDirectory += "/"+relativeSource;
|
||||
|
||||
// Tell the makefile where to look for this utility.
|
||||
m_Makefile->AddUtilityDirectory(utilityDirectory.c_str());
|
||||
std::string exePath;
|
||||
if (m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"))
|
||||
{
|
||||
exePath = m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
|
||||
}
|
||||
if(exePath.size())
|
||||
{
|
||||
utilityDirectory = exePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
utilityDirectory += "/"+relativeSource;
|
||||
}
|
||||
|
||||
// Construct the cache entry for the executable's location.
|
||||
std::string utilityExecutable =
|
||||
|
@ -103,6 +115,13 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string>& args)
|
|||
utilityExecutable.c_str(),
|
||||
"Path to an internal program.",
|
||||
cmCacheManager::FILEPATH);
|
||||
// add a value into the cache that maps from the
|
||||
// full path to the name of the project
|
||||
cmSystemTools::ConvertToUnixSlashes(utilityExecutable);
|
||||
cmCacheManager::GetInstance()->AddCacheEntry(utilityExecutable.c_str(),
|
||||
utilityName.c_str(),
|
||||
"Executable to project name.",
|
||||
cmCacheManager::INTERNAL);
|
||||
|
||||
// Set the definition in the makefile.
|
||||
m_Makefile->AddDefinition(cacheEntry.c_str(), utilityExecutable.c_str());
|
||||
|
|
|
@ -56,10 +56,6 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string>& args)
|
|||
return true;
|
||||
}
|
||||
|
||||
// add in a depend in the vtkVTKWrapJava executable
|
||||
m_Makefile->AddUtility("vtkWrapJava");
|
||||
m_Makefile->AddUtility("vtkParseJava");
|
||||
|
||||
// what is the current source dir
|
||||
std::string cdir = m_Makefile->GetCurrentDirectory();
|
||||
|
||||
|
@ -123,16 +119,16 @@ void cmVTKWrapJavaCommand::FinalPass()
|
|||
std::string res2 = resultDirectory + "/" +
|
||||
m_OriginalNames[classNum] + ".java";
|
||||
|
||||
std::string cmd = wjava + " " + m_WrapHeaders[classNum] + " "
|
||||
std::string cmd = " " + 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,
|
||||
wjava.c_str(), cmd.c_str(), depends,
|
||||
res.c_str(), m_LibraryName.c_str());
|
||||
|
||||
cmd = pjava + " " + m_WrapHeaders[classNum] + " "
|
||||
cmd = " " + m_WrapHeaders[classNum] + " "
|
||||
+ hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + res2;
|
||||
m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
|
||||
cmd.c_str(), depends2,
|
||||
pjava.c_str(), cmd.c_str(), depends2,
|
||||
res2.c_str(), m_LibraryName.c_str());
|
||||
alldepends.push_back(res2);
|
||||
}
|
||||
|
|
|
@ -56,8 +56,6 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string>& args)
|
|||
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();
|
||||
|
@ -124,10 +122,10 @@ void cmVTKWrapPythonCommand::FinalPass()
|
|||
{
|
||||
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] + " "
|
||||
std::string cmd = 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,
|
||||
wpython.c_str(), cmd.c_str(), depends,
|
||||
res.c_str(), m_LibraryName.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -93,9 +93,6 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string>& args)
|
|||
// what is the current source dir
|
||||
std::string cdir = m_Makefile->GetCurrentDirectory();
|
||||
|
||||
// add in a depend in the vtkVTKWrapTcl executable
|
||||
m_Makefile->AddUtility("vtkWrapTcl");
|
||||
|
||||
// get the resulting source list name
|
||||
m_SourceList = sources[0];
|
||||
|
||||
|
@ -157,10 +154,10 @@ void cmVTKWrapTclCommand::FinalPass()
|
|||
{
|
||||
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] + " "
|
||||
std::string cmd = 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,
|
||||
wtcl.c_str(), cmd.c_str(), depends,
|
||||
res.c_str(), m_LibraryName.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
void cmake::Usage(const char* program)
|
||||
{
|
||||
std::cerr << "cmake version " << cmMakefile::GetVersion() << "\n";
|
||||
std::cerr << "cmake version " << cmMakefile::GetMajorVersion()
|
||||
<< "." << cmMakefile::GetMinorVersion() << "\n";
|
||||
std::cerr << "Usage: " << program << " srcdir \n"
|
||||
<< "Where cmake is run from the directory where you want the object files written\n";
|
||||
}
|
||||
|
@ -237,6 +238,7 @@ int cmake::Generate(const std::vector<std::string>& args)
|
|||
|
||||
if(cmSystemTools::GetErrorOccuredFlag())
|
||||
{
|
||||
cmSystemTools::ResetErrorOccuredFlag();
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#
|
||||
# CMakeLocal.make.in should be in the directory where you run configure
|
||||
# in, which need not be the source directory
|
||||
#
|
||||
# microsoft specific config file
|
||||
SET (WORDS_BIGENDIAN )
|
||||
SET (HAVE_LIMITS_H 1)
|
||||
SET (HAVE_UNISTD_H 1)
|
||||
SET (CXX VC++60 )
|
||||
SET (CMAKE_CXX_COMPILER VC++60 CACHE STRING
|
||||
"Name of C++ compiler used.")
|
||||
SET (CMAKE_CXX_FLAGS_RELEASE "/MD /O2" CACHE STRING
|
||||
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files)")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHDEBUGINFO "/MD /Zi /O2" CACHE STRING
|
||||
|
|
Loading…
Reference in New Issue