summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-16 14:52:01 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-01-16 14:52:10 (GMT)
commite2c39e05732409d60e7921b45a70dd8b9aa24b5a (patch)
tree64b744921c74ae0e079dabb553914b8d1c0e204a /Source
parente44cc45530b002546bae11a34e77a3a730fd14e4 (diff)
parentb90e6134a7af7d6f81a410fac52f17c7585509eb (diff)
downloadCMake-e2c39e05732409d60e7921b45a70dd8b9aa24b5a.zip
CMake-e2c39e05732409d60e7921b45a70dd8b9aa24b5a.tar.gz
CMake-e2c39e05732409d60e7921b45a70dd8b9aa24b5a.tar.bz2
Merge topic 'swift'
b90e6134a7 Ninja: add new placeholder `SWIFT_AUXILIARY_SOURCES` Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Cristian Hancila <chancila@gmail.com> Acked-by: Aaron Dierking <aarondierking7@gmail.com> Merge-request: !2797
Diffstat (limited to 'Source')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx18
-rw-r--r--Source/cmRulePlaceholderExpander.cxx5
-rw-r--r--Source/cmRulePlaceholderExpander.h1
3 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 1ef12d0..5013be5 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
+#include "cmListFileCache.h" // for BT
#include "cmLocalGenerator.h"
#include "cmLocalNinjaGenerator.h"
#include "cmMakefile.h"
@@ -430,6 +431,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars.TargetCompilePDB = "$TARGET_COMPILE_PDB";
vars.ObjectDir = "$OBJECT_DIR";
vars.ObjectFileDir = "$OBJECT_FILE_DIR";
+ if (lang == "Swift") {
+ vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES";
+ }
// For some cases we do an explicit preprocessor invocation.
bool const explicitPP = this->NeedExplicitPreprocessing(lang);
@@ -900,6 +904,20 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language);
vars["INCLUDES"] = this->ComputeIncludes(source, language);
+ // The swift compiler needs all the sources besides the one being compiled in
+ // order to do the type checking. List all these "auxiliary" sources.
+ if (language == "Swift") {
+ std::string aux_sources;
+ cmGeneratorTarget::KindedSources const& sources =
+ this->GeneratorTarget->GetKindedSources(this->GetConfigName());
+ for (cmGeneratorTarget::SourceAndKind const& src : sources.Sources) {
+ if (src.Source.Value == source) {
+ continue;
+ }
+ aux_sources += " " + this->GetSourceFilePath(src.Source.Value);
+ }
+ vars["SWIFT_AUXILIARY_SOURCES"] = aux_sources;
+ }
if (!this->NeedDepTypeMSVC(language)) {
bool replaceExt(false);
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index 0dfb797..4b74ff0 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -162,6 +162,11 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
}
}
}
+ if (replaceValues.SwiftAuxiliarySources) {
+ if (variable == "SWIFT_AUXILIARY_SOURCES") {
+ return replaceValues.SwiftAuxiliarySources;
+ }
+ }
if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
variable == "TARGET_INSTALLNAME_DIR") {
// All these variables depend on TargetSOName
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index a7d8cee..a936747 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -58,6 +58,7 @@ public:
const char* Includes;
const char* DependencyFile;
const char* FilterPrefix;
+ const char* SwiftAuxiliarySources;
};
// Expand rule variables in CMake of the type found in language rules