2016-10-30 18:24:19 +01:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2021-09-14 00:13:48 +02:00
|
|
|
#pragma once
|
2011-01-16 11:35:12 +01:00
|
|
|
|
2017-07-20 19:35:53 +02:00
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
2016-10-30 18:24:19 +01:00
|
|
|
|
2021-09-14 00:13:48 +02:00
|
|
|
#include <functional>
|
|
|
|
#include <set>
|
2016-10-30 18:24:19 +01:00
|
|
|
#include <string>
|
2021-09-14 00:13:48 +02:00
|
|
|
#include <utility>
|
2016-10-30 18:24:19 +01:00
|
|
|
#include <vector>
|
2011-01-16 11:35:12 +01:00
|
|
|
|
2021-09-14 00:13:48 +02:00
|
|
|
#include <cm/optional>
|
|
|
|
|
2020-02-01 23:06:01 +01:00
|
|
|
#include "cmCustomCommandLines.h"
|
2021-09-14 00:13:48 +02:00
|
|
|
#include "cmListFileCache.h"
|
2020-02-01 23:06:01 +01:00
|
|
|
|
2011-01-16 11:35:12 +01:00
|
|
|
class cmCustomCommand;
|
2016-10-30 18:24:19 +01:00
|
|
|
class cmLocalGenerator;
|
2011-01-16 11:35:12 +01:00
|
|
|
|
|
|
|
class cmCustomCommandGenerator
|
|
|
|
{
|
2021-09-14 00:13:48 +02:00
|
|
|
std::string GetInternalDepfileName(const std::string&, const std::string&);
|
|
|
|
|
|
|
|
cmCustomCommand const* CC;
|
|
|
|
std::string OutputConfig;
|
|
|
|
std::string CommandConfig;
|
|
|
|
std::string Target;
|
2011-01-16 11:35:12 +01:00
|
|
|
cmLocalGenerator* LG;
|
|
|
|
bool OldStyle;
|
|
|
|
bool MakeVars;
|
2017-04-14 19:02:05 +02:00
|
|
|
cmCustomCommandLines CommandLines;
|
2019-11-11 23:01:05 +01:00
|
|
|
std::vector<std::vector<std::string>> EmulatorsWithArguments;
|
2021-09-14 00:13:48 +02:00
|
|
|
std::vector<std::string> Outputs;
|
2020-02-01 23:06:01 +01:00
|
|
|
std::vector<std::string> Byproducts;
|
2018-01-26 17:06:56 +01:00
|
|
|
std::vector<std::string> Depends;
|
2018-10-28 12:09:07 +01:00
|
|
|
std::string WorkingDirectory;
|
2021-09-14 00:13:48 +02:00
|
|
|
std::set<BT<std::pair<std::string, bool>>> Utilities;
|
|
|
|
std::function<std::string(const std::string&, const std::string&)>
|
|
|
|
ComputeInternalDepfile;
|
2017-04-14 19:02:05 +02:00
|
|
|
|
2019-11-11 23:01:05 +01:00
|
|
|
void FillEmulatorsWithArguments();
|
|
|
|
std::vector<std::string> GetCrossCompilingEmulator(unsigned int c) const;
|
2017-04-14 19:02:05 +02:00
|
|
|
const char* GetArgv0Location(unsigned int c) const;
|
2016-07-09 11:21:54 +02:00
|
|
|
|
2011-01-16 11:35:12 +01:00
|
|
|
public:
|
2021-09-14 00:13:48 +02:00
|
|
|
cmCustomCommandGenerator(
|
|
|
|
cmCustomCommand const& cc, std::string config, cmLocalGenerator* lg,
|
|
|
|
bool transformDepfile = true, cm::optional<std::string> crossConfig = {},
|
|
|
|
std::function<std::string(const std::string&, const std::string&)>
|
|
|
|
computeInternalDepfile = {});
|
2019-11-11 23:01:05 +01:00
|
|
|
cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete;
|
2021-09-14 00:13:48 +02:00
|
|
|
cmCustomCommandGenerator(cmCustomCommandGenerator&&) = default;
|
2019-11-11 23:01:05 +01:00
|
|
|
cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) =
|
|
|
|
delete;
|
2021-09-14 00:13:48 +02:00
|
|
|
cmCustomCommandGenerator& operator=(cmCustomCommandGenerator&&) = default;
|
|
|
|
cmCustomCommand const& GetCC() const { return *(this->CC); }
|
2011-01-16 11:35:12 +01:00
|
|
|
unsigned int GetNumberOfCommands() const;
|
|
|
|
std::string GetCommand(unsigned int c) const;
|
|
|
|
void AppendArguments(unsigned int c, std::string& cmd) const;
|
2023-05-23 16:38:00 +02:00
|
|
|
cm::optional<std::string> GetComment() const;
|
2015-04-27 22:25:09 +02:00
|
|
|
std::string GetWorkingDirectory() const;
|
|
|
|
std::vector<std::string> const& GetOutputs() const;
|
|
|
|
std::vector<std::string> const& GetByproducts() const;
|
|
|
|
std::vector<std::string> const& GetDepends() const;
|
2021-09-14 00:13:48 +02:00
|
|
|
std::set<BT<std::pair<std::string, bool>>> const& GetUtilities() const;
|
2018-01-26 17:06:56 +01:00
|
|
|
bool HasOnlyEmptyCommandLines() const;
|
2021-09-14 00:13:48 +02:00
|
|
|
std::string GetDepfile() const;
|
|
|
|
std::string GetFullDepfile() const;
|
|
|
|
std::string GetInternalDepfile() const;
|
2011-01-16 11:35:12 +01:00
|
|
|
|
2021-09-14 00:13:48 +02:00
|
|
|
const std::string& GetOutputConfig() const { return this->OutputConfig; }
|
|
|
|
const std::string& GetCommandConfig() const { return this->CommandConfig; }
|
|
|
|
};
|