From 159585967a0e4ab99f39de4eec311bac7d0ee0d0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 2 Feb 2023 15:54:43 -0500 Subject: cmGeneratorTarget: classify BMI-only C++ module sources --- Source/cmFileAPICodemodel.cxx | 1 + Source/cmGeneratorTarget.cxx | 10 ++++++++++ Source/cmGeneratorTarget.h | 3 +++ Source/cmVisualStudio10TargetGenerator.cxx | 1 + 4 files changed, 15 insertions(+) diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 812b1b5..3c1bc14 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -1678,6 +1678,7 @@ Json::Value Target::DumpSource(cmGeneratorTarget::SourceAndKind const& sk, } switch (sk.Kind) { + case cmGeneratorTarget::SourceKindCxxModuleSource: case cmGeneratorTarget::SourceKindObjectSource: { source["compileGroupIndex"] = this->AddSourceCompileGroup(sk.Source.Value, si); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index c6b2718..c15db5b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1071,6 +1071,12 @@ void cmGeneratorTarget::GetHeaderSources( IMPLEMENT_VISIT(SourceKindHeader); } +void cmGeneratorTarget::GetCxxModuleSources( + std::vector& data, const std::string& config) const +{ + IMPLEMENT_VISIT(SourceKindCxxModuleSource); +} + void cmGeneratorTarget::GetExtraSources(std::vector& data, const std::string& config) const { @@ -1953,8 +1959,12 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, // Compute the kind (classification) of this source file. SourceKind kind; std::string ext = cmSystemTools::LowerCase(sf->GetExtension()); + cmFileSet const* fs = this->GetFileSetForSource(config, sf); if (sf->GetCustomCommand()) { kind = SourceKindCustomCommand; + } else if (!this->Target->IsNormal() && !this->Target->IsImported() && + fs && (fs->GetType() == "CXX_MODULES"_s)) { + kind = SourceKindCxxModuleSource; } else if (this->Target->GetType() == cmStateEnums::UTILITY || this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165 diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 844454f..3adf5b8 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -116,6 +116,7 @@ public: SourceKindCertificate, SourceKindCustomCommand, SourceKindExternalObject, + SourceKindCxxModuleSource, SourceKindExtra, SourceKindHeader, SourceKindIDL, @@ -186,6 +187,8 @@ public: const std::string& config) const; void GetHeaderSources(std::vector&, const std::string& config) const; + void GetCxxModuleSources(std::vector&, + const std::string& config) const; void GetExtraSources(std::vector&, const std::string& config) const; void GetCustomCommands(std::vector&, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 48f3197..1bd4c57 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2517,6 +2517,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) case cmGeneratorTarget::SourceKindModuleDefinition: tool = "None"; break; + case cmGeneratorTarget::SourceKindCxxModuleSource: case cmGeneratorTarget::SourceKindUnityBatched: case cmGeneratorTarget::SourceKindObjectSource: { const std::string& lang = si.Source->GetLanguage(); -- cgit v0.12