ENH: speed improvements
This commit is contained in:
parent
cdc65cfebf
commit
789267c949
|
@ -49,7 +49,7 @@ public:
|
||||||
* This determines if the command gets propagated down
|
* This determines if the command gets propagated down
|
||||||
* to makefiles located in subdirectories.
|
* to makefiles located in subdirectories.
|
||||||
*/
|
*/
|
||||||
virtual bool IsInherited() { return true; }
|
virtual bool IsInherited() { return false; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the command as specified in CMakeList.txt.
|
* The name of the command as specified in CMakeList.txt.
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
* This determines if the command gets propagated down
|
* This determines if the command gets propagated down
|
||||||
* to makefiles located in subdirectories.
|
* to makefiles located in subdirectories.
|
||||||
*/
|
*/
|
||||||
virtual bool IsInherited() {return true;}
|
virtual bool IsInherited() {return false;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the command as specified in CMakeList.txt.
|
* The name of the command as specified in CMakeList.txt.
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
* This determines if the command gets propagated down
|
* This determines if the command gets propagated down
|
||||||
* to makefiles located in subdirectories.
|
* to makefiles located in subdirectories.
|
||||||
*/
|
*/
|
||||||
virtual bool IsInherited() {return true;}
|
virtual bool IsInherited() {return false;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the command as specified in CMakeList.txt.
|
* The name of the command as specified in CMakeList.txt.
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
* This determines if the command gets propagated down
|
* This determines if the command gets propagated down
|
||||||
* to makefiles located in subdirectories.
|
* to makefiles located in subdirectories.
|
||||||
*/
|
*/
|
||||||
virtual bool IsInherited() { return true; }
|
virtual bool IsInherited() { return false; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the command as specified in CMakeList.txt.
|
* The name of the command as specified in CMakeList.txt.
|
||||||
|
|
|
@ -25,19 +25,21 @@ bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
this->SetError("called with wrong number of arguments. "
|
this->SetError("called with wrong number of arguments. "
|
||||||
"Include only takes one file.");
|
"Include only takes one file.");
|
||||||
}
|
}
|
||||||
bool exists = cmSystemTools::FileExists(args[0].c_str());
|
bool optional = false;
|
||||||
if(args.size() == 2 && args[1] == "OPTIONAL" && !exists)
|
if(args.size() == 2)
|
||||||
{
|
{
|
||||||
return true;
|
optional = args[1] == "OPTIONAL";
|
||||||
}
|
}
|
||||||
if(!exists)
|
|
||||||
|
bool readit = m_Makefile->ReadListFile( m_Makefile->GetCurrentListFile(),
|
||||||
|
args[0].c_str());
|
||||||
|
if(!optional && !readit)
|
||||||
{
|
{
|
||||||
std::string error = "Include file not found: " + args[0] + "\n";
|
std::string m = "Could not find include file:";
|
||||||
this->SetError(error.c_str());
|
m += args[0];
|
||||||
|
this->SetError(m.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_Makefile->ReadListFile( m_Makefile->GetCurrentListFile(),
|
|
||||||
args[0].c_str());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,15 @@ cmListFile* cmListFileCache::GetFileCache(const char* path)
|
||||||
|
|
||||||
bool cmListFileCache::CacheFile(const char* path)
|
bool cmListFileCache::CacheFile(const char* path)
|
||||||
{
|
{
|
||||||
|
if(!cmSystemTools::FileExists(path))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::ifstream fin(path);
|
std::ifstream fin(path);
|
||||||
if(!fin)
|
if(!fin)
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("error can not open file ", path);
|
cmSystemTools::Error("cmListFileCache: error can not open file ", path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
|
@ -323,7 +323,6 @@ bool cmMakefile::ReadListFile(const char* filename, const char* external)
|
||||||
cmListFileCache::GetInstance()->GetFileCache(filenametoread);
|
cmListFileCache::GetInstance()->GetFileCache(filenametoread);
|
||||||
if(!lf)
|
if(!lf)
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("error can not open file ", filenametoread);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// add this list file to the list of dependencies
|
// add this list file to the list of dependencies
|
||||||
|
|
|
@ -972,61 +972,14 @@ bool cmSystemTools::FilesDiffer(const char* source,
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const int buffer_length = 4096;
|
char* buffer1 = new char[statSource.st_size];
|
||||||
char bufferSource[buffer_length];
|
char* buffer2 = new char[statSource.st_size];
|
||||||
char bufferDest[buffer_length];
|
finSource.read(buffer1, statSource.st_size);
|
||||||
while(finSource && finDestination)
|
finDestination.read(buffer2, statSource.st_size);
|
||||||
{
|
int ret = memcmp(buffer1, buffer2, statSource.st_size);
|
||||||
if(finSource.getline(bufferSource, buffer_length, '\n')
|
delete [] buffer2;
|
||||||
|| finSource.gcount())
|
delete [] buffer1;
|
||||||
{
|
return ret != 0;
|
||||||
if(finDestination.getline(bufferDest, buffer_length, '\n')
|
|
||||||
|| finDestination.gcount())
|
|
||||||
{
|
|
||||||
// both if statements passed
|
|
||||||
if(finSource.eof())
|
|
||||||
{
|
|
||||||
if(!finDestination.eof())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(finSource.gcount() != finDestination.gcount())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(strncmp(bufferSource, bufferDest, finSource.gcount()) != 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(finSource.fail())
|
|
||||||
{
|
|
||||||
if(!finDestination.fail())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(strcmp(bufferSource, bufferDest) != 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
finSource.clear(finSource.rdstate() & ~std::ios::failbit);
|
|
||||||
finDestination.clear(finDestination.rdstate() & ~std::ios::failbit);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(strcmp(bufferSource, bufferDest) != 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -635,7 +635,7 @@ int main()
|
||||||
#ifndef REGISTRY_TEST_PATH
|
#ifndef REGISTRY_TEST_PATH
|
||||||
cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined.");
|
cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined.");
|
||||||
#else
|
#else
|
||||||
if(strcmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
||||||
{
|
{
|
||||||
cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ",
|
cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ",
|
||||||
REGISTRY_TEST_PATH);
|
REGISTRY_TEST_PATH);
|
||||||
|
|
|
@ -635,7 +635,7 @@ int main()
|
||||||
#ifndef REGISTRY_TEST_PATH
|
#ifndef REGISTRY_TEST_PATH
|
||||||
cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined.");
|
cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined.");
|
||||||
#else
|
#else
|
||||||
if(strcmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
||||||
{
|
{
|
||||||
cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ",
|
cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ",
|
||||||
REGISTRY_TEST_PATH);
|
REGISTRY_TEST_PATH);
|
||||||
|
|
|
@ -635,7 +635,7 @@ int main()
|
||||||
#ifndef REGISTRY_TEST_PATH
|
#ifndef REGISTRY_TEST_PATH
|
||||||
cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined.");
|
cmFailed("the CONFIGURE_FILE command is broken, REGISTRY_TEST_PATH is not defined.");
|
||||||
#else
|
#else
|
||||||
if(strcmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
if(stricmp(REGISTRY_TEST_PATH, BINARY_DIR "/registry_dir") != 0)
|
||||||
{
|
{
|
||||||
cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ",
|
cmFailed("the 'read registry value' function or CONFIGURE_FILE command is broken. REGISTRY_TEST_PATH == ",
|
||||||
REGISTRY_TEST_PATH);
|
REGISTRY_TEST_PATH);
|
||||||
|
|
Loading…
Reference in New Issue