mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
cmCxxModuleMapper: add source to handle module mapper contents
This will allow all generators to share an implementation for actually writing out the module map formats.
This commit is contained in:
@@ -197,6 +197,8 @@ set(SRCS
|
|||||||
cmCustomCommandLines.cxx
|
cmCustomCommandLines.cxx
|
||||||
cmCustomCommandLines.h
|
cmCustomCommandLines.h
|
||||||
cmCustomCommandTypes.h
|
cmCustomCommandTypes.h
|
||||||
|
cmCxxModuleMapper.cxx
|
||||||
|
cmCxxModuleMapper.h
|
||||||
cmDefinitions.cxx
|
cmDefinitions.cxx
|
||||||
cmDefinitions.h
|
cmDefinitions.h
|
||||||
cmDependencyProvider.h
|
cmDependencyProvider.h
|
||||||
|
|||||||
30
Source/cmCxxModuleMapper.cxx
Normal file
30
Source/cmCxxModuleMapper.cxx
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
|
#include "cmCxxModuleMapper.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "cmScanDepFormat.h"
|
||||||
|
|
||||||
|
cm::optional<std::string> CxxModuleLocations::BmiGeneratorPathForModule(
|
||||||
|
std::string const& logical_name) const
|
||||||
|
{
|
||||||
|
if (auto l = this->BmiLocationForModule(logical_name)) {
|
||||||
|
return this->PathForGenerator(*l);
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
cm::static_string_view CxxModuleMapExtension(
|
||||||
|
cm::optional<CxxModuleMapFormat> format)
|
||||||
|
{
|
||||||
|
return ".bmi"_s;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CxxModuleMapContent(CxxModuleMapFormat format,
|
||||||
|
CxxModuleLocations const& loc,
|
||||||
|
cmScanDepInfo const& obj)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
47
Source/cmCxxModuleMapper.h
Normal file
47
Source/cmCxxModuleMapper.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cmConfigure.h" // IWYU pragma: keep
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <cm/optional>
|
||||||
|
#include <cmext/string_view>
|
||||||
|
|
||||||
|
struct cmScanDepInfo;
|
||||||
|
|
||||||
|
enum class CxxModuleMapFormat
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CxxModuleLocations
|
||||||
|
{
|
||||||
|
// The path from which all relative paths should be computed. If
|
||||||
|
// this is relative, it is relative to the compiler's working
|
||||||
|
// directory.
|
||||||
|
std::string RootDirectory;
|
||||||
|
|
||||||
|
// A function to convert a full path to a path for the generator.
|
||||||
|
std::function<std::string(std::string const&)> PathForGenerator;
|
||||||
|
|
||||||
|
// Lookup the BMI location of a logical module name.
|
||||||
|
std::function<cm::optional<std::string>(std::string const&)>
|
||||||
|
BmiLocationForModule;
|
||||||
|
|
||||||
|
// Returns the generator path (if known) for the BMI given a
|
||||||
|
// logical module name.
|
||||||
|
cm::optional<std::string> BmiGeneratorPathForModule(
|
||||||
|
std::string const& logical_name) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Return the extension to use for a given modulemap format.
|
||||||
|
cm::static_string_view CxxModuleMapExtension(
|
||||||
|
cm::optional<CxxModuleMapFormat> format);
|
||||||
|
|
||||||
|
// Return the contents of the module map in the given format for the
|
||||||
|
// object file.
|
||||||
|
std::string CxxModuleMapContent(CxxModuleMapFormat format,
|
||||||
|
CxxModuleLocations const& loc,
|
||||||
|
cmScanDepInfo const& obj);
|
||||||
@@ -328,6 +328,7 @@ CMAKE_CXX_SOURCES="\
|
|||||||
cmCustomCommand \
|
cmCustomCommand \
|
||||||
cmCustomCommandGenerator \
|
cmCustomCommandGenerator \
|
||||||
cmCustomCommandLines \
|
cmCustomCommandLines \
|
||||||
|
cmCxxModuleMapper \
|
||||||
cmDefinePropertyCommand \
|
cmDefinePropertyCommand \
|
||||||
cmDefinitions \
|
cmDefinitions \
|
||||||
cmDocumentationFormatter \
|
cmDocumentationFormatter \
|
||||||
|
|||||||
Reference in New Issue
Block a user