Merge topic 'ninja-cldeps-check-rc-result'
74d1c88 Ninja: cmcldeps needs absolute paths for RCs 1cdeef7 Ninja: readd quotes to src file path before patching it 84a18cb Ninja: also stop when .rc's .d file couldn't be generated
This commit is contained in:
commit
b5d9dba7b6
@ -143,16 +143,18 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
|
|||||||
this->LocalGenerator->AddCMP0018Flags(flags, this->Target,
|
this->LocalGenerator->AddCMP0018Flags(flags, this->Target,
|
||||||
language.c_str());
|
language.c_str());
|
||||||
|
|
||||||
// TODO: Handle response file.
|
|
||||||
// Add include directory flags.
|
// Add include directory flags.
|
||||||
{
|
{
|
||||||
std::vector<std::string> includes;
|
std::vector<std::string> includes;
|
||||||
this->LocalGenerator->GetIncludeDirectories(includes, this->Target,
|
this->LocalGenerator->GetIncludeDirectories(includes, this->Target,
|
||||||
language.c_str());
|
language.c_str());
|
||||||
std::string includeFlags =
|
std::string includeFlags =
|
||||||
this->LocalGenerator->GetIncludeFlags(includes, language.c_str(), false);
|
this->LocalGenerator->GetIncludeFlags(includes, language.c_str(),
|
||||||
|
language == "RC" ? true : false); // full include paths for RC
|
||||||
|
// needed by cmcldeps
|
||||||
if(cmGlobalNinjaGenerator::IsMinGW())
|
if(cmGlobalNinjaGenerator::IsMinGW())
|
||||||
cmSystemTools::ReplaceString(includeFlags, "\\", "/");
|
cmSystemTools::ReplaceString(includeFlags, "\\", "/");
|
||||||
|
|
||||||
this->LocalGenerator->AppendFlags(flags, includeFlags.c_str());
|
this->LocalGenerator->AppendFlags(flags, includeFlags.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,7 +469,7 @@ cmNinjaTargetGenerator
|
|||||||
cmNinjaDeps emptyDeps;
|
cmNinjaDeps emptyDeps;
|
||||||
|
|
||||||
std::string comment;
|
std::string comment;
|
||||||
const char* language = source->GetLanguage();
|
const std::string language = source->GetLanguage();
|
||||||
std::string rule = this->LanguageCompilerRule(language);
|
std::string rule = this->LanguageCompilerRule(language);
|
||||||
|
|
||||||
cmNinjaDeps outputs;
|
cmNinjaDeps outputs;
|
||||||
@ -477,7 +479,11 @@ cmNinjaTargetGenerator
|
|||||||
this->Objects.push_back(objectFileName);
|
this->Objects.push_back(objectFileName);
|
||||||
|
|
||||||
cmNinjaDeps explicitDeps;
|
cmNinjaDeps explicitDeps;
|
||||||
std::string sourceFileName = this->GetSourceFilePath(source);
|
std::string sourceFileName;
|
||||||
|
if (language == "RC")
|
||||||
|
sourceFileName = source->GetFullPath();
|
||||||
|
else
|
||||||
|
sourceFileName = this->GetSourceFilePath(source);
|
||||||
explicitDeps.push_back(sourceFileName);
|
explicitDeps.push_back(sourceFileName);
|
||||||
|
|
||||||
// Ensure that the target dependencies are built before any source file in
|
// Ensure that the target dependencies are built before any source file in
|
||||||
|
@ -206,7 +206,7 @@ static int process( const std::string& srcfilename,
|
|||||||
includes.push_back(inc);
|
includes.push_back(inc);
|
||||||
} else {
|
} else {
|
||||||
if (!isFirstLine || !startsWith(line, srcfilename)) {
|
if (!isFirstLine || !startsWith(line, srcfilename)) {
|
||||||
if (!quiet) {
|
if (!quiet || exit_code != 0) {
|
||||||
fprintf(stdout, "%s\n", line.c_str());
|
fprintf(stdout, "%s\n", line.c_str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -254,7 +254,10 @@ int main() {
|
|||||||
// rc: /fo x.dir\x.rc.res -> cl: /out:x.dir\x.rc.res.dep.obj
|
// rc: /fo x.dir\x.rc.res -> cl: /out:x.dir\x.rc.res.dep.obj
|
||||||
clrest = replace(clrest, "/fo", "/out:");
|
clrest = replace(clrest, "/fo", "/out:");
|
||||||
clrest = replace(clrest, objfile, objfile + ".dep.obj ");
|
clrest = replace(clrest, objfile, objfile + ".dep.obj ");
|
||||||
|
|
||||||
// rc: src\x\x.rc -> cl: /Tc src\x\x.rc
|
// rc: src\x\x.rc -> cl: /Tc src\x\x.rc
|
||||||
|
if (srcfile.find(" ") != std::string::npos)
|
||||||
|
srcfile = "\"" + srcfile + "\"";
|
||||||
clrest = replace(clrest, srcfile, "/Tc " + srcfile);
|
clrest = replace(clrest, srcfile, "/Tc " + srcfile);
|
||||||
|
|
||||||
cl = "\"" + cl + "\" /P /DRC_INVOKED ";
|
cl = "\"" + cl + "\" /P /DRC_INVOKED ";
|
||||||
@ -267,8 +270,11 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// extract dependencies with cl.exe
|
// extract dependencies with cl.exe
|
||||||
process(srcfilename, dfile, objfile,
|
int exit_code = process(srcfilename, dfile, objfile,
|
||||||
prefix, cl + nol + show + clrest, objdir, true);
|
prefix, cl + nol + show + clrest, objdir, true);
|
||||||
|
|
||||||
|
if (exit_code != 0)
|
||||||
|
return exit_code;
|
||||||
|
|
||||||
// compile rc file with rc.exe
|
// compile rc file with rc.exe
|
||||||
return process(srcfilename, "" , objfile, prefix, binpath + " " + rest);
|
return process(srcfilename, "" , objfile, prefix, binpath + " " + rest);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user