mirror of
https://github.com/reactos/CMake.git
synced 2024-11-29 06:20:23 +00:00
Put custom commands in topological order for VS 10
Visual Studio 10 uses MSBuild to drive the build. Custom commands appear in MSBuild files inside CustomBuild elements, which appear inside ItemGroup elements. The Outputs and AdditionalInputs elements of each CustomBuild element are evaluated according to timestamps on disk. MSBuild does not use inputs/outputs to order CustomBuild steps within a single ItemGroup or across multiple ItemGroup elements. Instead we must put only unrelated CustomBuild elements in a single ItemGroup and order the item groups from top to bottom using a topological order of the custom command dependency graph. This fixes CustomCommand and ExternalProject test failures, so we remove the expectation of these failures.
This commit is contained in:
parent
4224513cce
commit
4e16813f63
@ -247,18 +247,38 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
|
||||
}
|
||||
|
||||
void cmVisualStudio10TargetGenerator::WriteCustomCommands()
|
||||
{
|
||||
this->WriteString("<ItemGroup>\n", 1);
|
||||
std::vector<cmSourceFile*>const & sources = this->Target->GetSourceFiles();
|
||||
{
|
||||
this->SourcesVisited.clear();
|
||||
std::vector<cmSourceFile*> const& sources = this->Target->GetSourceFiles();
|
||||
for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
|
||||
source != sources.end(); ++source)
|
||||
{
|
||||
if(cmCustomCommand const* command = (*source)->GetCustomCommand())
|
||||
cmSourceFile* sf = *source;
|
||||
this->WriteCustomCommand(sf);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf)
|
||||
{
|
||||
if(this->SourcesVisited.insert(sf).second)
|
||||
{
|
||||
if(std::vector<cmSourceFile*> const* depends =
|
||||
this->Target->GetSourceDepends(sf))
|
||||
{
|
||||
this->WriteCustomRule(*source, *command);
|
||||
for(std::vector<cmSourceFile*>::const_iterator di = depends->begin();
|
||||
di != depends->end(); ++di)
|
||||
{
|
||||
this->WriteCustomCommand(*di);
|
||||
}
|
||||
}
|
||||
}
|
||||
this->WriteString("</ItemGroup>\n", 1);
|
||||
if(cmCustomCommand const* command = sf->GetCustomCommand())
|
||||
{
|
||||
this->WriteString("<ItemGroup>\n", 1);
|
||||
this->WriteCustomRule(sf, *command);
|
||||
this->WriteString("</ItemGroup>\n", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -66,6 +66,7 @@ private:
|
||||
void WriteCustomRule(cmSourceFile* source,
|
||||
cmCustomCommand const & command);
|
||||
void WriteCustomCommands();
|
||||
void WriteCustomCommand(cmSourceFile* sf);
|
||||
void WriteGroups();
|
||||
void WriteProjectReferences();
|
||||
bool OutputSourceSpecificFlags(cmSourceFile* source);
|
||||
@ -89,6 +90,7 @@ private:
|
||||
cmGlobalVisualStudio7Generator* GlobalGenerator;
|
||||
cmGeneratedFileStream* BuildFileStream;
|
||||
cmLocalVisualStudio7Generator* LocalGenerator;
|
||||
std::set<cmSourceFile*> SourcesVisited;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -571,15 +571,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
|
||||
IF("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
|
||||
SET_TESTS_PROPERTIES(ExternalProject PROPERTIES TIMEOUT 1000)
|
||||
ENDIF("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
|
||||
# CustomCommand and ExternalProject fail because of this bug:
|
||||
# http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=473709
|
||||
# so for this version of the compiler with the IDE expect failure
|
||||
IF("${MSVC_VERSION}" EQUAL 1600
|
||||
AND "${CMAKE_TEST_GENERATOR}"
|
||||
MATCHES "Visual Studio 10" )
|
||||
SET_TESTS_PROPERTIES(ExternalProject PROPERTIES WILL_FAIL TRUE)
|
||||
SET_TESTS_PROPERTIES(CustomCommand PROPERTIES WILL_FAIL TRUE)
|
||||
ENDIF()
|
||||
|
||||
# do each of the tutorial steps
|
||||
FOREACH(STP RANGE 1 7)
|
||||
|
Loading…
Reference in New Issue
Block a user