aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2017-06-19 11:51:37 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2017-06-20 10:53:44 +0000
commitbf1f4dddb148bd71922d0d47d70e6255e97253d1 (patch)
tree8aeec5f73f486cde7e2d008cab288cfe2bd585ce
parent0b112fa0b27f996fd71c5a0b63132b47b21d7b3e (diff)
Do not create copies of precompiled header source files on MSVC
We used to create copies of cpp_pch_src and c_pch_src files in the MSVC compiler rule to create an unambiguous file name that can be used in later calls to the compiler rule. This hack is not necessary anymore. We can inspect the artifacts of the product in the compiler rule. Change-Id: I40ff119e2507cae3210c52c82fd38cfd83cf261c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/modules/cpp/msvc.js25
-rw-r--r--share/qbs/modules/cpp/windows-msvc.qbs9
2 files changed, 12 insertions, 22 deletions
diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js
index c2c85aa92..67559c07d 100644
--- a/share/qbs/modules/cpp/msvc.js
+++ b/share/qbs/modules/cpp/msvc.js
@@ -165,21 +165,20 @@ function prepareCompiler(project, product, inputs, outputs, input, output) {
args.push("/Fp" + FileInfo.toWindowsSeparators(pchOutput.filePath));
args.push("/Fo" + FileInfo.toWindowsSeparators(objOutput.filePath));
args.push(FileInfo.toWindowsSeparators(input.filePath));
- var copyCmd = new JavaScriptCommand();
- copyCmd.tag = tag;
- copyCmd.silent = true;
- copyCmd.sourceCode = function() {
- File.copy(input.filePath, outputs[tag + "_pch_copy"][0].filePath);
- };
- commands.push(copyCmd);
} else {
// use PCH
- var pchHeaderFilePath = ".obj/" + product.name + '_' + tag + '.pch_copy';
- var pchFilePath = FileInfo.toWindowsSeparators(product.buildDirectory
- + "\\.obj\\" + product.name + "_" + tag + ".pch");
- args.push("/FI" + pchHeaderFilePath);
- args.push("/Yu" + pchHeaderFilePath);
- args.push("/Fp" + pchFilePath);
+ var pchSourceArtifacts = product.artifacts[tag + "_pch_src"];
+ if (pchSourceArtifacts && pchSourceArtifacts.length > 0) {
+ var pchSourceFilePath = pchSourceArtifacts[0].filePath;
+ var pchFilePath = FileInfo.toWindowsSeparators(product.buildDirectory
+ + "\\.obj\\" + product.name + "_" + tag + ".pch");
+ args.push("/FI" + pchSourceFilePath);
+ args.push("/Yu" + pchSourceFilePath);
+ args.push("/Fp" + pchFilePath);
+ } else {
+ console.warning("products." + product.name + ".usePrecompiledHeader is true, "
+ + "but there is no " + tag + "_pch_src artifact.");
+ }
}
}
diff --git a/share/qbs/modules/cpp/windows-msvc.qbs b/share/qbs/modules/cpp/windows-msvc.qbs
index 277b167e2..d0d009ceb 100644
--- a/share/qbs/modules/cpp/windows-msvc.qbs
+++ b/share/qbs/modules/cpp/windows-msvc.qbs
@@ -132,10 +132,6 @@ CppModule {
fileTags: ['c_pch']
filePath: ".obj/" + product.name + '_c.pch'
}
- Artifact {
- fileTags: ['c_pch_copy']
- filePath: ".obj/" + product.name + '_c.pch_copy'
- }
prepare: {
return MSVC.prepareCompiler.apply(MSVC, arguments);
}
@@ -154,11 +150,6 @@ CppModule {
fileTags: ['cpp_pch']
filePath: ".obj/" + product.name + '_cpp.pch'
}
- Artifact {
- fileTags: ['cpp_pch_copy']
- filePath: ".obj/" + product.name + '_cpp.pch_copy'
- }
-
prepare: {
return MSVC.prepareCompiler.apply(MSVC, arguments);
}