mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
Every link rule referenced `$PRE_LINK` and `$POST_BUILD`. For a target with no pre-link or post-build steps both expand to a no-op, but they still make the rule a list of commands. On Windows such a rule runs under `cmd.exe /C`, so every link, including the link step of every `try_compile` during configure, started one more process. The link rule is specific to one target and configuration, so decide from the target's command lists whether it needs the variables. Do not decide from the expanded lines of the build statement: under Ninja Multi-Config a cross-config statement can skip the target's custom commands but shares the rule.
68 lines
2.9 KiB
C++
68 lines
2.9 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file LICENSE.rst or https://cmake.org/licensing for details. */
|
|
#pragma once
|
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "cmGeneratorTarget.h"
|
|
#include "cmNinjaTargetGenerator.h"
|
|
|
|
class cmNinjaNormalTargetGenerator : public cmNinjaTargetGenerator
|
|
{
|
|
public:
|
|
cmNinjaNormalTargetGenerator(cmGeneratorTarget* target);
|
|
~cmNinjaNormalTargetGenerator() override;
|
|
|
|
void Generate(std::string const& config) override;
|
|
|
|
private:
|
|
std::string LanguageLinkerRule(std::string const& config) const;
|
|
std::string LanguageLinkerDeviceRule(std::string const& config) const;
|
|
std::string LanguageLinkerCudaDeviceRule(std::string const& config) const;
|
|
std::string LanguageLinkerCudaDeviceCompileRule(
|
|
std::string const& config) const;
|
|
std::string LanguageLinkerCudaFatbinaryRule(std::string const& config) const;
|
|
std::string TextStubsGeneratorRule(std::string const& config) const;
|
|
bool CheckUseResponseFileForLibraries(std::string const& config) const;
|
|
char const* GetVisibleTypeName() const;
|
|
void WriteLanguagesRules(std::string const& config);
|
|
|
|
void WriteLinkRule(bool useResponseFile, std::string const& config,
|
|
std::vector<std::string> const& preLinkComments,
|
|
std::vector<std::string> const& postBuildComments,
|
|
bool hasPreLink, bool hasPostBuild);
|
|
void WriteDeviceLinkRules(std::string const& config);
|
|
void WriteDriverDeviceLinkRule(bool useResponseFile,
|
|
std::string const& config);
|
|
|
|
void WriteLinkStatement(std::string const& config,
|
|
std::string const& fileConfig, bool firstForConfig);
|
|
void WriteDeviceLinkStatement(std::string const& config,
|
|
std::string const& fileConfig,
|
|
bool firstForConfig);
|
|
void WriteDeviceLinkStatements(std::string const& config,
|
|
std::vector<std::string> const& architectures,
|
|
std::string const& output);
|
|
void WriteDriverDeviceLinkStatement(std::string const& config,
|
|
std::string const& fileConfig,
|
|
std::string const& outputDir,
|
|
std::string const& output);
|
|
|
|
void WriteObjectLibStatement(std::string const& config);
|
|
void WriteCxxModuleLibraryStatement(std::string const& config,
|
|
std::string const& fileConfig,
|
|
bool firstForConfig);
|
|
|
|
std::vector<std::string> ComputeLinkCmd(std::string const& config);
|
|
std::vector<std::string> ComputeDeviceLinkCmd();
|
|
|
|
// Target name info.
|
|
cmGeneratorTarget::Names TargetNames(std::string const& config) const;
|
|
std::string TargetLinkLanguage(std::string const& config) const;
|
|
std::string DeviceLinkObject;
|
|
std::string DeviceLinkLanguage;
|
|
};
|