[Cmake-commits] CMake branch, master, updated. v3.14.4-1162-ga6a04cc
Kitware Robot
kwrobot at kitware.com
Thu May 30 10:03:05 EDT 2019
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, master has been updated
via a6a04cc446e67017e74e294a4aef84e9e8da4323 (commit)
via 6e8acc51a57e60aff307e4730c8a2314e5cf737a (commit)
via 9dad42d21a67592040d1100882147eed77753392 (commit)
via 4fe34b2d29ca67ea91b2545b223dad8abbcad282 (commit)
via 57cedb18c097a7231223b8a4279534216cad1b93 (commit)
via 6136ab5e179b33ddd659ad458ad8efd773ec8db8 (commit)
via 6a23fbce47294e746c15ee851dc3460a3a17da2b (commit)
from 05af1770a05e00d67f12f4e3ef294360d8d6480d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6a04cc446e67017e74e294a4aef84e9e8da4323
commit a6a04cc446e67017e74e294a4aef84e9e8da4323
Merge: 6e8acc5 4fe34b2
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu May 30 13:55:22 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu May 30 09:58:37 2019 -0400
Merge topic 'fix-clang-warnings'
4fe34b2d29 Fixing warnings generated by clang 8.0 on Windows
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !3396
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e8acc51a57e60aff307e4730c8a2314e5cf737a
commit 6e8acc51a57e60aff307e4730c8a2314e5cf737a
Merge: 9dad42d 57cedb1
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu May 30 13:53:04 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu May 30 09:57:11 2019 -0400
Merge topic 'string-tar'
57cedb18c0 cmSystemTools: std::string parameters for tar functions
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !3392
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9dad42d21a67592040d1100882147eed77753392
commit 9dad42d21a67592040d1100882147eed77753392
Merge: 05af177 6136ab5
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu May 30 13:52:50 2019 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu May 30 09:53:09 2019 -0400
Merge topic 'ninja_rule_class'
6136ab5e17 Ninja: Use cmNinjaRule as sole parameter in the WriteRule and AddRule methods
6a23fbce47 Ninja: Add cmNinjaRule class
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !3393
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4fe34b2d29ca67ea91b2545b223dad8abbcad282
commit 4fe34b2d29ca67ea91b2545b223dad8abbcad282
Author: Zsolt Parragi <zsolt.parragi at cancellar.hu>
AuthorDate: Wed May 29 18:03:34 2019 +0200
Commit: Zsolt Parragi <zsolt.parragi at cancellar.hu>
CommitDate: Wed May 29 18:18:09 2019 +0200
Fixing warnings generated by clang 8.0 on Windows
* Deprecation removals previously specific to MSVC/Intel now also used
by clang
* String literals were assigned to non const pointers. These are stored
in mutable arrays now
* An implicit function pointer to pointer conversion is a Microsoft
extension warning is suppressed by an explicit reinterpret_cast
* The MSVC specific deprecation macro for jsoncpp was moved after the
clang macro to avoid redefinition warnings. This is consistent with
how jsoncpp fixed the issue in 36d8cfd7
diff --git a/CompileFlags.cmake b/CompileFlags.cmake
index c231ede..91f2adf 100644
--- a/CompileFlags.cmake
+++ b/CompileFlags.cmake
@@ -8,11 +8,16 @@ if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel")
set(_INTEL_WINDOWS 1)
endif()
+if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Clang"
+ AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(_CLANG_MSVC_WINDOWS 1)
+endif()
+
# Disable deprecation warnings for standard C functions.
# really only needed for newer versions of VS, but should
# not hurt other versions, and this will work into the
# future
-if(MSVC OR _INTEL_WINDOWS)
+if(MSVC OR _INTEL_WINDOWS OR _CLANG_MSVC_WINDOWS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
else()
endif()
@@ -21,9 +26,7 @@ if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stack:10000000")
endif()
-if(CMAKE_CXX_COMPILER_ID STREQUAL Clang
- AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
- AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+if(_CLANG_MSVC_WINDOWS AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -stack:20000000")
endif()
diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx
index 2f6cf64..f7a2244 100644
--- a/Source/cmCallVisualStudioMacro.cxx
+++ b/Source/cmCallVisualStudioMacro.cxx
@@ -61,7 +61,8 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro,
if (0 != vsIDE) {
DISPID dispid = (DISPID)-1;
- OLECHAR* name = L"ExecuteCommand";
+ wchar_t execute_command[] = L"ExecuteCommand";
+ OLECHAR* name = execute_command;
hr =
vsIDE->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid);
@@ -119,7 +120,8 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro,
}
oss << " dwHelpContext: " << excep.dwHelpContext << std::endl;
oss << " pvReserved: " << excep.pvReserved << std::endl;
- oss << " pfnDeferredFillIn: " << excep.pfnDeferredFillIn << std::endl;
+ oss << " pfnDeferredFillIn: "
+ << reinterpret_cast<void*>(excep.pfnDeferredFillIn) << std::endl;
oss << " scode: " << excep.scode << std::endl;
}
@@ -140,7 +142,8 @@ HRESULT GetSolutionObject(IDispatch* vsIDE, IDispatchPtr& vsSolution)
if (0 != vsIDE) {
DISPID dispid = (DISPID)-1;
- OLECHAR* name = L"Solution";
+ wchar_t solution[] = L"Solution";
+ OLECHAR* name = solution;
hr =
vsIDE->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid);
@@ -183,7 +186,8 @@ HRESULT GetSolutionFullName(IDispatch* vsSolution, std::string& fullName)
if (0 != vsSolution) {
DISPID dispid = (DISPID)-1;
- OLECHAR* name = L"FullName";
+ wchar_t full_name[] = L"FullName";
+ OLECHAR* name = full_name;
hr = vsSolution->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
&dispid);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3495f2a..26886f5 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -535,11 +535,22 @@ void cmGlobalGenerator::EnableLanguage(
# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning(push)
-# pragma warning(disable : 4996)
+# ifdef __INTEL_COMPILER
+# pragma warning(disable : 1478)
+# elif defined __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wdeprecated-declarations"
+# else
+# pragma warning(disable : 4996)
+# endif
# endif
GetVersionExW((OSVERSIONINFOW*)&osviex);
# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
-# pragma warning(pop)
+# ifdef __clang__
+# pragma clang diagnostic pop
+# else
+# pragma warning(pop)
+# endif
# endif
std::ostringstream windowsVersionString;
windowsVersionString << osviex.dwMajorVersion << "."
diff --git a/Utilities/cmjsoncpp/include/json/config.h b/Utilities/cmjsoncpp/include/json/config.h
index 34f7314..2cc8462 100644
--- a/Utilities/cmjsoncpp/include/json/config.h
+++ b/Utilities/cmjsoncpp/include/json/config.h
@@ -79,11 +79,6 @@
# pragma warning(disable : 4786)
# endif // MSVC 6
-# if _MSC_VER >= 1500 // MSVC 2008
- /// Indicates that the following function is deprecated.
-# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
-# endif
-
#endif // defined(_MSC_VER)
// In c++11 the override keyword allows you to explicity define that a function
@@ -137,7 +132,10 @@
# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
# endif // GNUC version
-#endif // __clang__ || __GNUC__
+#elif defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
+ /// Indicates that the following function is deprecated.
+# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
+#endif // __clang__ || __GNUC__ || _MSC_VER
#undef JSONCPP_DEPRECATED // no deprecations in CMake copy
#if !defined(JSONCPP_DEPRECATED)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57cedb18c097a7231223b8a4279534216cad1b93
commit 57cedb18c097a7231223b8a4279534216cad1b93
Author: Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Wed May 29 08:15:40 2019 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed May 29 09:56:08 2019 -0400
cmSystemTools: std::string parameters for tar functions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 071ff56..d1226c3 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1611,8 +1611,8 @@ std::string cmCTest::Base64GzipEncodeFile(std::string const& file)
std::vector<std::string> files;
files.push_back(file);
- if (!cmSystemTools::CreateTar(tarFile.c_str(), files,
- cmSystemTools::TarCompressGZip, false)) {
+ if (!cmSystemTools::CreateTar(tarFile, files, cmSystemTools::TarCompressGZip,
+ false)) {
cmCTestLog(this, ERROR_MESSAGE,
"Error creating tar while "
"encoding file: "
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 2453aea..ef29217 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1529,7 +1529,7 @@ bool cmSystemTools::IsPathToFramework(const std::string& path)
cmHasLiteralSuffix(path, ".framework"));
}
-bool cmSystemTools::CreateTar(const char* outFileName,
+bool cmSystemTools::CreateTar(const std::string& outFileName,
const std::vector<std::string>& files,
cmTarCompression compressType, bool verbose,
std::string const& mtime,
@@ -1537,7 +1537,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- cmsys::ofstream fout(outFileName, std::ios::out | std::ios::binary);
+ cmsys::ofstream fout(outFileName.c_str(), std::ios::out | std::ios::binary);
if (!fout) {
std::string e = "Cannot open output file \"";
e += outFileName;
@@ -1757,7 +1757,7 @@ bool copy_data(struct archive* ar, struct archive* aw)
# endif
}
-bool extract_tar(const char* outFileName,
+bool extract_tar(const std::string& outFileName,
const std::vector<std::string>& files, bool verbose,
bool extract)
{
@@ -1783,7 +1783,7 @@ bool extract_tar(const char* outFileName,
}
}
- int r = cm_archive_read_open_file(a, outFileName, 10240);
+ int r = cm_archive_read_open_file(a, outFileName.c_str(), 10240);
if (r) {
ArchiveError("Problem with archive_read_open_file(): ", a);
archive_write_free(ext);
@@ -1878,7 +1878,7 @@ bool extract_tar(const char* outFileName,
}
#endif
-bool cmSystemTools::ExtractTar(const char* outFileName,
+bool cmSystemTools::ExtractTar(const std::string& outFileName,
const std::vector<std::string>& files,
bool verbose)
{
@@ -1892,7 +1892,7 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
#endif
}
-bool cmSystemTools::ListTar(const char* outFileName,
+bool cmSystemTools::ListTar(const std::string& outFileName,
const std::vector<std::string>& files,
bool verbose)
{
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 09a4d13..7fb369e 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -450,14 +450,14 @@ public:
TarCompressNone
};
- static bool ListTar(const char* outFileName,
+ static bool ListTar(const std::string& outFileName,
const std::vector<std::string>& files, bool verbose);
- static bool CreateTar(const char* outFileName,
+ static bool CreateTar(const std::string& outFileName,
const std::vector<std::string>& files,
cmTarCompression compressType, bool verbose,
std::string const& mtime = std::string(),
std::string const& format = std::string());
- static bool ExtractTar(const char* inFileName,
+ static bool ExtractTar(const std::string& inFileName,
const std::vector<std::string>& files, bool verbose);
// This should be called first thing in main
// it will keep child processes from inheriting the
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 4ddfddd..8f416a4 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1127,7 +1127,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 1;
}
if (action == cmSystemTools::TarActionList) {
- if (!cmSystemTools::ListTar(outFile.c_str(), files, verbose)) {
+ if (!cmSystemTools::ListTar(outFile, files, verbose)) {
cmSystemTools::Error("Problem listing tar: " + outFile);
return 1;
}
@@ -1136,13 +1136,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
cmSystemTools::Message("tar: No files or directories specified",
"Warning");
}
- if (!cmSystemTools::CreateTar(outFile.c_str(), files, compress,
- verbose, mtime, format)) {
+ if (!cmSystemTools::CreateTar(outFile, files, compress, verbose, mtime,
+ format)) {
cmSystemTools::Error("Problem creating tar: " + outFile);
return 1;
}
} else if (action == cmSystemTools::TarActionExtract) {
- if (!cmSystemTools::ExtractTar(outFile.c_str(), files, verbose)) {
+ if (!cmSystemTools::ExtractTar(outFile, files, verbose)) {
cmSystemTools::Error("Problem extracting tar: " + outFile);
return 1;
}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6136ab5e179b33ddd659ad458ad8efd773ec8db8
commit 6136ab5e179b33ddd659ad458ad8efd773ec8db8
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed May 29 13:04:52 2019 +0200
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Wed May 29 13:04:52 2019 +0200
Ninja: Use cmNinjaRule as sole parameter in the WriteRule and AddRule methods
Instead of passing multiple strings to the `WriteRule` and `AddRule` methods
of `cmGlobalNinjaGenerator`, pass only a `cmNinjaRule` instance reference,
that is set up beforehand.
Adapt calls to `WriteRule` and `AddRule` in multiple places.
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index ea65a77..4abccd7 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -238,14 +238,11 @@ void cmGlobalNinjaGenerator::WritePhonyBuild(
void cmGlobalNinjaGenerator::AddCustomCommandRule()
{
- this->AddRule("CUSTOM_COMMAND", "$COMMAND", "$DESC",
- "Rule for running custom commands.",
- /*depfile*/ "",
- /*deptype*/ "",
- /*rspfile*/ "",
- /*rspcontent*/ "",
- /*restat*/ "", // bound on each build statement as needed
- /*generator*/ false);
+ cmNinjaRule rule("CUSTOM_COMMAND");
+ rule.Command = "$COMMAND";
+ rule.Description = "$DESC";
+ rule.Comment = "Rule for running custom commands.";
+ this->AddRule(rule);
}
void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
@@ -293,15 +290,11 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
void cmGlobalNinjaGenerator::AddMacOSXContentRule()
{
- this->AddRule("COPY_OSX_CONTENT", CMakeCmd() + " -E copy $in $out",
- "Copying OS X Content $out",
- "Rule for copying OS X bundle content file.",
- /*depfile*/ "",
- /*deptype*/ "",
- /*rspfile*/ "",
- /*rspcontent*/ "",
- /*restat*/ "",
- /*generator*/ false);
+ cmNinjaRule rule("COPY_OSX_CONTENT");
+ rule.Command = CMakeCmd() + " -E copy $in $out";
+ rule.Description = "Copying OS X Content $out";
+ rule.Comment = "Rule for copying OS X bundle content file.";
+ this->AddRule(rule);
}
void cmGlobalNinjaGenerator::WriteMacOSXContentBuild(const std::string& input,
@@ -320,40 +313,36 @@ void cmGlobalNinjaGenerator::WriteMacOSXContentBuild(const std::string& input,
cmNinjaDeps(), cmNinjaVars());
}
-void cmGlobalNinjaGenerator::WriteRule(
- std::ostream& os, const std::string& name, const std::string& command,
- const std::string& description, const std::string& comment,
- const std::string& depfile, const std::string& deptype,
- const std::string& rspfile, const std::string& rspcontent,
- const std::string& restat, bool generator)
+void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
+ cmNinjaRule const& rule)
{
// -- Parameter checks
// Make sure the rule has a name.
- if (name.empty()) {
+ if (rule.Name.empty()) {
cmSystemTools::Error("No name given for WriteRule! called with comment: " +
- comment);
+ rule.Comment);
return;
}
// Make sure a command is given.
- if (command.empty()) {
+ if (rule.Command.empty()) {
cmSystemTools::Error(
- "No command given for WriteRule! called with comment: " + comment);
+ "No command given for WriteRule! called with comment: " + rule.Comment);
return;
}
// Make sure response file content is given
- if (!rspfile.empty() && rspcontent.empty()) {
+ if (!rule.RspFile.empty() && rule.RspContent.empty()) {
cmSystemTools::Error("rspfile but no rspfile_content given for WriteRule! "
"called with comment: " +
- comment);
+ rule.Comment);
return;
}
// -- Write rule
// Write rule intro
- cmGlobalNinjaGenerator::WriteComment(os, comment);
- os << "rule " << name << '\n';
+ cmGlobalNinjaGenerator::WriteComment(os, rule.Comment);
+ os << "rule " << rule.Name << '\n';
// Write rule key/value pairs
auto writeKV = [&os](const char* key, std::string const& value) {
@@ -363,16 +352,16 @@ void cmGlobalNinjaGenerator::WriteRule(
}
};
- writeKV("depfile", depfile);
- writeKV("deps", deptype);
- writeKV("command", command);
- writeKV("description", description);
- if (!rspfile.empty()) {
- writeKV("rspfile", rspfile);
- writeKV("rspfile_content", rspcontent);
+ writeKV("depfile", rule.DepFile);
+ writeKV("deps", rule.DepType);
+ writeKV("command", rule.Command);
+ writeKV("description", rule.Description);
+ if (!rule.RspFile.empty()) {
+ writeKV("rspfile", rule.RspFile);
+ writeKV("rspfile_content", rule.RspContent);
}
- writeKV("restat", restat);
- if (generator) {
+ writeKV("restat", rule.Restat);
+ if (rule.Generator) {
writeKV("generator", "1");
}
@@ -690,23 +679,16 @@ cmGlobalNinjaGenerator::GenerateBuildCommand(
// Non-virtual public methods.
-void cmGlobalNinjaGenerator::AddRule(
- const std::string& name, const std::string& command,
- const std::string& description, const std::string& comment,
- const std::string& depfile, const std::string& deptype,
- const std::string& rspfile, const std::string& rspcontent,
- const std::string& restat, bool generator)
+void cmGlobalNinjaGenerator::AddRule(cmNinjaRule const& rule)
{
// Do not add the same rule twice.
- if (!this->Rules.insert(name).second) {
+ if (!this->Rules.insert(rule.Name).second) {
return;
}
// Store command length
- this->RuleCmdLength[name] = static_cast<int>(command.size());
+ this->RuleCmdLength[rule.Name] = static_cast<int>(rule.Command.size());
// Write rule
- cmGlobalNinjaGenerator::WriteRule(*this->RulesFileStream, name, command,
- description, comment, depfile, deptype,
- rspfile, rspcontent, restat, generator);
+ cmGlobalNinjaGenerator::WriteRule(*this->RulesFileStream, rule);
}
bool cmGlobalNinjaGenerator::HasRule(const std::string& name)
@@ -1322,21 +1304,18 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmLocalGenerator* lg = this->LocalGenerators[0];
{
- std::string cmd = CMakeCmd();
- cmd += " -S";
- cmd += lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
- cmOutputConverter::SHELL);
- cmd += " -B";
- cmd += lg->ConvertToOutputFormat(lg->GetBinaryDirectory(),
- cmOutputConverter::SHELL);
- WriteRule(*this->RulesFileStream, "RERUN_CMAKE", cmd,
- "Re-running CMake...", "Rule for re-running cmake.",
- /*depfile=*/"",
- /*deptype=*/"",
- /*rspfile=*/"",
- /*rspcontent*/ "",
- /*restat=*/"",
- /*generator=*/true);
+ cmNinjaRule rule("RERUN_CMAKE");
+ rule.Command = CMakeCmd();
+ rule.Command += " -S";
+ rule.Command += lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
+ cmOutputConverter::SHELL);
+ rule.Command += " -B";
+ rule.Command += lg->ConvertToOutputFormat(lg->GetBinaryDirectory(),
+ cmOutputConverter::SHELL);
+ rule.Description = "Re-running CMake...";
+ rule.Comment = "Rule for re-running cmake.";
+ rule.Generator = true;
+ WriteRule(*this->RulesFileStream, rule);
}
cmNinjaDeps implicitDeps;
@@ -1358,20 +1337,15 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmake* cm = this->GetCMakeInstance();
if (this->SupportsManifestRestat() && cm->DoWriteGlobVerifyTarget()) {
{
- std::string cmd = CMakeCmd();
- cmd += " -P ";
- cmd += lg->ConvertToOutputFormat(cm->GetGlobVerifyScript(),
- cmOutputConverter::SHELL);
-
- WriteRule(*this->RulesFileStream, "VERIFY_GLOBS", cmd,
- "Re-checking globbed directories...",
- "Rule for re-checking globbed directories.",
- /*depfile=*/"",
- /*deptype=*/"",
- /*rspfile=*/"",
- /*rspcontent*/ "",
- /*restat=*/"",
- /*generator=*/true);
+ cmNinjaRule rule("VERIFY_GLOBS");
+ rule.Command = CMakeCmd();
+ rule.Command += " -P ";
+ rule.Command += lg->ConvertToOutputFormat(cm->GetGlobVerifyScript(),
+ cmOutputConverter::SHELL);
+ rule.Description = "Re-checking globbed directories...";
+ rule.Comment = "Rule for re-checking globbed directories.";
+ rule.Generator = true;
+ this->WriteRule(*this->RulesFileStream, rule);
}
std::string verifyForce = cm->GetGlobVerifyScript() + "_force";
@@ -1507,19 +1481,14 @@ bool cmGlobalNinjaGenerator::WriteTargetCleanAdditional(std::ostream& os)
// Write rule
{
- std::string cmd = CMakeCmd();
- cmd += " -P ";
- cmd += lgr->ConvertToOutputFormat(this->NinjaOutputPath(cleanScriptRel),
- cmOutputConverter::SHELL);
- WriteRule(*this->RulesFileStream, "CLEAN_ADDITIONAL", cmd,
- "Cleaning additional files...",
- "Rule for cleaning additional files.",
- /*depfile=*/"",
- /*deptype=*/"",
- /*rspfile=*/"",
- /*rspcontent*/ "",
- /*restat=*/"",
- /*generator=*/false);
+ cmNinjaRule rule("CLEAN_ADDITIONAL");
+ rule.Command = CMakeCmd();
+ rule.Command += " -P ";
+ rule.Command += lgr->ConvertToOutputFormat(
+ this->NinjaOutputPath(cleanScriptRel), cmOutputConverter::SHELL);
+ rule.Description = "Cleaning additional files...";
+ rule.Comment = "Rule for cleaning additional files.";
+ WriteRule(*this->RulesFileStream, rule);
}
// Write build
@@ -1546,15 +1515,13 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
// -- Default clean target
// Write rule
- WriteRule(*this->RulesFileStream, "CLEAN", NinjaCmd() + " -t clean",
- "Cleaning all built files...",
- "Rule for cleaning all built files.",
- /*depfile=*/"",
- /*deptype=*/"",
- /*rspfile=*/"",
- /*rspcontent*/ "",
- /*restat=*/"",
- /*generator=*/false);
+ {
+ cmNinjaRule rule("CLEAN");
+ rule.Command = NinjaCmd() + " -t clean";
+ rule.Description = "Cleaning all built files...";
+ rule.Comment = "Rule for cleaning all built files.";
+ WriteRule(*this->RulesFileStream, rule);
+ }
// Write build
{
@@ -1577,15 +1544,13 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
{
- WriteRule(*this->RulesFileStream, "HELP", NinjaCmd() + " -t targets",
- "All primary targets available:",
- "Rule for printing all primary targets available.",
- /*depfile=*/"",
- /*deptype=*/"",
- /*rspfile=*/"",
- /*rspcontent*/ "",
- /*restat=*/"",
- /*generator=*/false);
+ {
+ cmNinjaRule rule("HELP");
+ rule.Command = NinjaCmd() + " -t targets";
+ rule.Description = "All primary targets available:";
+ rule.Comment = "Rule for printing all primary targets available.";
+ WriteRule(*this->RulesFileStream, rule);
+ }
WriteBuild(os, "Print all primary targets available.", "HELP",
/*outputs=*/cmNinjaDeps(1, this->NinjaOutputPath("help")),
/*implicitOuts=*/cmNinjaDeps(),
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 47685c2..dcc358b 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -138,18 +138,10 @@ public:
const std::string& output);
/**
- * Write a rule statement named @a name to @a os with the @a comment,
- * the mandatory @a command, the @a depfile and the @a description.
- * It also writes the variables bound to this rule statement.
+ * Write a rule statement to @a os.
* @warning no escaping of any kind is done here.
*/
- static void WriteRule(std::ostream& os, const std::string& name,
- const std::string& command,
- const std::string& description,
- const std::string& comment, const std::string& depfile,
- const std::string& deptype, const std::string& rspfile,
- const std::string& rspcontent,
- const std::string& restat, bool generator);
+ static void WriteRule(std::ostream& os, cmNinjaRule const& rule);
/**
* Write a variable named @a name to @a os with value @a value and an
@@ -273,11 +265,7 @@ public:
* Call WriteRule() behind the scene but perform some check before like:
* - Do not add twice the same rule.
*/
- void AddRule(const std::string& name, const std::string& command,
- const std::string& description, const std::string& comment,
- const std::string& depfile, const std::string& deptype,
- const std::string& rspfile, const std::string& rspcontent,
- const std::string& restat, bool generator);
+ void AddRule(cmNinjaRule const& rule);
bool HasRule(const std::string& name);
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 77af45e..6e9e112 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -162,13 +162,8 @@ struct cmNinjaRemoveNoOpCommands
void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
{
- cmStateEnums::TargetType targetType = this->GetGeneratorTarget()->GetType();
- std::string ruleName = this->LanguageLinkerDeviceRule();
- // Select whether to use a response file for objects.
- std::string rspfile;
- std::string rspcontent;
-
- if (!this->GetGlobalGenerator()->HasRule(ruleName)) {
+ cmNinjaRule rule(this->LanguageLinkerDeviceRule());
+ if (!this->GetGlobalGenerator()->HasRule(rule.Name)) {
cmRulePlaceholderExpander::RuleVariables vars;
vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
vars.CMTargetType =
@@ -192,16 +187,16 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
} else {
responseFlag = "@";
}
- rspfile = "$RSP_FILE";
- responseFlag += rspfile;
+ rule.RspFile = "$RSP_FILE";
+ responseFlag += rule.RspFile;
// build response file content
if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
- rspcontent = "$in";
+ rule.RspContent = "$in";
} else {
- rspcontent = "$in_newline";
+ rule.RspContent = "$in_newline";
}
- rspcontent += " $LINK_LIBRARIES";
+ rule.RspContent += " $LINK_LIBRARIES";
vars.Objects = responseFlag.c_str();
vars.LinkLibraries = "";
}
@@ -220,7 +215,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
vars.Manifests = "$MANIFESTS";
std::string langFlags;
- if (targetType != cmStateEnums::EXECUTABLE) {
+ if (this->GetGeneratorTarget()->GetType() != cmStateEnums::EXECUTABLE) {
langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS";
vars.LanguageCompileFlags = langFlags.c_str();
}
@@ -247,39 +242,35 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
// If there is no ranlib the command will be ":". Skip it.
cmEraseIf(linkCmds, cmNinjaRemoveNoOpCommands());
- std::string linkCmd =
- this->GetLocalGenerator()->BuildCommandLine(linkCmds);
+ rule.Command = this->GetLocalGenerator()->BuildCommandLine(linkCmds);
// Write the linker rule with response file if needed.
- std::ostringstream comment;
- comment << "Rule for linking " << this->TargetLinkLanguage << " "
- << this->GetVisibleTypeName() << ".";
- std::ostringstream description;
- description << "Linking " << this->TargetLinkLanguage << " "
- << this->GetVisibleTypeName() << " $TARGET_FILE";
- this->GetGlobalGenerator()->AddRule(ruleName, linkCmd, description.str(),
- comment.str(),
- /*depfile*/ "",
- /*deptype*/ "", rspfile, rspcontent,
- /*restat*/ "$RESTAT",
- /*generator*/ false);
+ rule.Comment = "Rule for linking ";
+ rule.Comment += this->TargetLinkLanguage;
+ rule.Comment += " ";
+ rule.Comment += this->GetVisibleTypeName();
+ rule.Comment += ".";
+ rule.Description = "Linking ";
+ rule.Description += this->TargetLinkLanguage;
+ rule.Description += " ";
+ rule.Description += this->GetVisibleTypeName();
+ rule.Description += " $TARGET_FILE";
+ rule.Restat = "$RESTAT";
+
+ this->GetGlobalGenerator()->AddRule(rule);
}
}
void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
{
cmStateEnums::TargetType targetType = this->GetGeneratorTarget()->GetType();
- std::string ruleName = this->LanguageLinkerRule();
- // Select whether to use a response file for objects.
- std::string rspfile;
- std::string rspcontent;
-
- if (!this->GetGlobalGenerator()->HasRule(ruleName)) {
+ std::string linkRuleName = this->LanguageLinkerRule();
+ if (!this->GetGlobalGenerator()->HasRule(linkRuleName)) {
+ cmNinjaRule rule(std::move(linkRuleName));
cmRulePlaceholderExpander::RuleVariables vars;
vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
- vars.CMTargetType =
- cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType());
+ vars.CMTargetType = cmState::GetTargetTypeName(targetType);
vars.Language = this->TargetLinkLanguage.c_str();
@@ -311,16 +302,16 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
} else {
responseFlag = "@";
}
- rspfile = "$RSP_FILE";
- responseFlag += rspfile;
+ rule.RspFile = "$RSP_FILE";
+ responseFlag += rule.RspFile;
// build response file content
if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
- rspcontent = "$in";
+ rule.RspContent = "$in";
} else {
- rspcontent = "$in_newline";
+ rule.RspContent = "$in_newline";
}
- rspcontent += " $LINK_PATH $LINK_LIBRARIES";
+ rule.RspContent += " $LINK_PATH $LINK_LIBRARIES";
if (this->TargetLinkLanguage == "Swift") {
vars.SwiftSources = responseFlag.c_str();
} else {
@@ -389,22 +380,21 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
linkCmds.insert(linkCmds.begin(), "$PRE_LINK");
linkCmds.emplace_back("$POST_BUILD");
- std::string linkCmd =
- this->GetLocalGenerator()->BuildCommandLine(linkCmds);
+ rule.Command = this->GetLocalGenerator()->BuildCommandLine(linkCmds);
// Write the linker rule with response file if needed.
- std::ostringstream comment;
- comment << "Rule for linking " << this->TargetLinkLanguage << " "
- << this->GetVisibleTypeName() << ".";
- std::ostringstream description;
- description << "Linking " << this->TargetLinkLanguage << " "
- << this->GetVisibleTypeName() << " $TARGET_FILE";
- this->GetGlobalGenerator()->AddRule(ruleName, linkCmd, description.str(),
- comment.str(),
- /*depfile*/ "",
- /*deptype*/ "", rspfile, rspcontent,
- /*restat*/ "$RESTAT",
- /*generator*/ false);
+ rule.Comment = "Rule for linking ";
+ rule.Comment += this->TargetLinkLanguage;
+ rule.Comment += " ";
+ rule.Comment += this->GetVisibleTypeName();
+ rule.Comment += ".";
+ rule.Description = "Linking ";
+ rule.Description += this->TargetLinkLanguage;
+ rule.Description += " ";
+ rule.Description += this->GetVisibleTypeName();
+ rule.Description += " $TARGET_FILE";
+ rule.Restat = "$RESTAT";
+ this->GetGlobalGenerator()->AddRule(rule);
}
if (this->TargetNames.Output != this->TargetNames.Real &&
@@ -413,41 +403,28 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
if (targetType == cmStateEnums::EXECUTABLE) {
- std::vector<std::string> commandLines;
- commandLines.push_back(cmakeCommand +
- " -E cmake_symlink_executable $in $out");
- commandLines.emplace_back("$POST_BUILD");
-
- this->GetGlobalGenerator()->AddRule(
- "CMAKE_SYMLINK_EXECUTABLE",
- this->GetLocalGenerator()->BuildCommandLine(commandLines),
- "Creating executable symlink $out",
- "Rule for creating "
- "executable symlink.",
- /*depfile*/ "",
- /*deptype*/ "",
- /*rspfile*/ "",
- /*rspcontent*/ "",
- /*restat*/ "",
- /*generator*/ false);
+ cmNinjaRule rule("CMAKE_SYMLINK_EXECUTABLE");
+ {
+ std::vector<std::string> cmd;
+ cmd.push_back(cmakeCommand + " -E cmake_symlink_executable $in $out");
+ cmd.emplace_back("$POST_BUILD");
+ rule.Command = this->GetLocalGenerator()->BuildCommandLine(cmd);
+ }
+ rule.Description = "Creating executable symlink $out";
+ rule.Comment = "Rule for creating executable symlink.";
+ this->GetGlobalGenerator()->AddRule(rule);
} else {
- std::vector<std::string> commandLines;
- commandLines.push_back(cmakeCommand +
- " -E cmake_symlink_library $in $SONAME $out");
- commandLines.emplace_back("$POST_BUILD");
-
- this->GetGlobalGenerator()->AddRule(
- "CMAKE_SYMLINK_LIBRARY",
- this->GetLocalGenerator()->BuildCommandLine(commandLines),
- "Creating library symlink $out",
- "Rule for creating "
- "library symlink.",
- /*depfile*/ "",
- /*deptype*/ "",
- /*rspfile*/ "",
- /*rspcontent*/ "",
- /*restat*/ "",
- /*generator*/ false);
+ cmNinjaRule rule("CMAKE_SYMLINK_LIBRARY");
+ {
+ std::vector<std::string> cmd;
+ cmd.push_back(cmakeCommand +
+ " -E cmake_symlink_library $in $SONAME $out");
+ cmd.emplace_back("$POST_BUILD");
+ rule.Command = this->GetLocalGenerator()->BuildCommandLine(cmd);
+ }
+ rule.Description = "Creating library symlink $out";
+ rule.Comment = "Rule for creating library symlink.";
+ this->GetGlobalGenerator()->AddRule(rule);
}
}
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 9652a51..5b8ed90 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -495,9 +495,10 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
if (explicitPP) {
+ cmNinjaRule rule(this->LanguagePreprocessRule(lang));
// Explicit preprocessing always uses a depfile.
- std::string const ppDeptype; // no deps= for multiple outputs
- std::string const ppDepfile = "$DEP_FILE";
+ rule.DepType = ""; // no deps= for multiple outputs
+ rule.DepFile = "$DEP_FILE";
cmRulePlaceholderExpander::RuleVariables ppVars;
ppVars.CMTargetName = vars.CMTargetName;
@@ -505,7 +506,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
ppVars.Language = vars.Language;
ppVars.Object = "$out"; // for RULE_LAUNCH_COMPILE
ppVars.PreprocessedSource = "$out";
- ppVars.DependencyFile = ppDepfile.c_str();
+ ppVars.DependencyFile = rule.DepFile.c_str();
// Preprocessing uses the original source,
// compilation uses preprocessed output.
@@ -524,17 +525,15 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
ppVars.Includes = vars.Includes;
// If using a response file, move defines, includes, and flags into it.
- std::string ppRspFile;
- std::string ppRspContent;
if (!responseFlag.empty()) {
- ppRspFile = "$RSP_FILE";
- ppRspContent = " ";
- ppRspContent += ppVars.Defines;
- ppRspContent += " ";
- ppRspContent += ppVars.Includes;
- ppRspContent += " ";
- ppRspContent += ppFlags;
- ppFlags = responseFlag + ppRspFile;
+ rule.RspFile = "$RSP_FILE";
+ rule.RspContent = " ";
+ rule.RspContent += ppVars.Defines;
+ rule.RspContent += " ";
+ rule.RspContent += ppVars.Includes;
+ rule.RspContent += " ";
+ rule.RspContent += ppFlags;
+ ppFlags = responseFlag + rule.RspFile;
ppVars.Defines = "";
ppVars.Includes = "";
}
@@ -570,31 +569,25 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
}
ppCmds.emplace_back(std::move(ccmd));
}
- std::string const ppCmdLine =
- this->GetLocalGenerator()->BuildCommandLine(ppCmds);
+ rule.Command = this->GetLocalGenerator()->BuildCommandLine(ppCmds);
// Write the rule for preprocessing file of the given language.
- std::string ppComment = "Rule for preprocessing ";
- ppComment += lang;
- ppComment += " files.";
- std::string ppDesc = "Building ";
- ppDesc += lang;
- ppDesc += " preprocessed $out";
- this->GetGlobalGenerator()->AddRule(
- this->LanguagePreprocessRule(lang), ppCmdLine, ppDesc, ppComment,
- ppDepfile, ppDeptype, ppRspFile, ppRspContent,
- /*restat*/ "",
- /*generator*/ false);
+ rule.Comment = "Rule for preprocessing ";
+ rule.Comment += lang;
+ rule.Comment += " files.";
+ rule.Description = "Building ";
+ rule.Description += lang;
+ rule.Description += " preprocessed $out";
+ this->GetGlobalGenerator()->AddRule(rule);
}
if (needDyndep) {
// Write the rule for ninja dyndep file generation.
-
+ cmNinjaRule rule(this->LanguageDyndepRule(lang));
// Command line length is almost always limited -> use response file for
// dyndep rules
- std::string ddRspFile = "$out.rsp";
- std::string ddRspContent = "$in";
- std::string ddCmdLine;
+ rule.RspFile = "$out.rsp";
+ rule.RspContent = "$in";
// Run CMake dependency scanner on the source file (using the preprocessed
// source if that was performed).
@@ -608,53 +601,49 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
ccmd += lang;
ccmd += " --dd=$out ";
ccmd += "@";
- ccmd += ddRspFile;
+ ccmd += rule.RspFile;
ddCmds.emplace_back(std::move(ccmd));
}
- ddCmdLine = this->GetLocalGenerator()->BuildCommandLine(ddCmds);
+ rule.Command = this->GetLocalGenerator()->BuildCommandLine(ddCmds);
}
- std::string ddComment = "Rule to generate ninja dyndep files for ";
- ddComment += lang;
- ddComment += ".";
- std::string ddDesc = "Generating ";
- ddDesc += lang;
- ddDesc += " dyndep file $out";
- this->GetGlobalGenerator()->AddRule(this->LanguageDyndepRule(lang),
- ddCmdLine, ddDesc, ddComment,
- /*depfile*/ "",
- /*deps*/ "", ddRspFile, ddRspContent,
- /*restat*/ "",
- /*generator*/ false);
+ rule.Comment = "Rule to generate ninja dyndep files for ";
+ rule.Comment += lang;
+ rule.Comment += ".";
+ rule.Description = "Generating ";
+ rule.Description += lang;
+ rule.Description += " dyndep file $out";
+ this->GetGlobalGenerator()->AddRule(rule);
}
+ cmNinjaRule rule(this->LanguageCompilerRule(lang));
// If using a response file, move defines, includes, and flags into it.
- std::string rspfile;
- std::string rspcontent;
if (!responseFlag.empty()) {
- rspfile = "$RSP_FILE";
- rspcontent =
- std::string(" ") + vars.Defines + " " + vars.Includes + " " + flags;
- flags = responseFlag + rspfile;
+ rule.RspFile = "$RSP_FILE";
+ rule.RspContent = " ";
+ rule.RspContent += vars.Defines;
+ rule.RspContent += " ";
+ rule.RspContent += vars.Includes;
+ rule.RspContent += " ";
+ rule.RspContent += flags;
+ flags = responseFlag + rule.RspFile;
vars.Defines = "";
vars.Includes = "";
}
// Tell ninja dependency format so all deps can be loaded into a database
- std::string deptype;
- std::string depfile;
std::string cldeps;
if (explicitPP) {
// The explicit preprocessing step will handle dependency scanning.
} else if (this->NeedDepTypeMSVC(lang)) {
- deptype = "msvc";
- depfile.clear();
+ rule.DepType = "msvc";
+ rule.DepFile.clear();
flags += " /showIncludes";
} else if (mf->IsOn("CMAKE_NINJA_CMCLDEPS_" + lang)) {
// For the MS resource compiler we need cmcldeps, but skip dependencies
// for source-file try_compile cases because they are always fresh.
if (!mf->GetIsSourceFileTryCompile()) {
- deptype = "gcc";
- depfile = "$DEP_FILE";
+ rule.DepType = "gcc";
+ rule.DepFile = "$DEP_FILE";
const std::string cl = mf->GetDefinition("CMAKE_C_COMPILER")
? mf->GetSafeDefinition("CMAKE_C_COMPILER")
: mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
@@ -665,8 +654,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
cldeps += "\" \"" + cl + "\" ";
}
} else {
- deptype = "gcc";
- depfile = "$DEP_FILE";
+ rule.DepType = "gcc";
+ rule.DepFile = "$DEP_FILE";
const std::string flagsName = "CMAKE_DEPFILE_FLAGS_" + lang;
std::string depfileFlags = mf->GetSafeDefinition(flagsName);
if (!depfileFlags.empty()) {
@@ -679,7 +668,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
}
vars.Flags = flags.c_str();
- vars.DependencyFile = depfile.c_str();
+ vars.DependencyFile = rule.DepFile.c_str();
// Rule for compiling object file.
std::vector<std::string> compileCmds;
@@ -784,21 +773,16 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars);
}
- std::string cmdLine =
- this->GetLocalGenerator()->BuildCommandLine(compileCmds);
+ rule.Command = this->GetLocalGenerator()->BuildCommandLine(compileCmds);
// Write the rule for compiling file of the given language.
- std::string comment = "Rule for compiling ";
- comment += lang;
- comment += " files.";
- std::string description = "Building ";
- description += lang;
- description += " object $out";
- this->GetGlobalGenerator()->AddRule(this->LanguageCompilerRule(lang),
- cmdLine, description, comment, depfile,
- deptype, rspfile, rspcontent,
- /*restat*/ "",
- /*generator*/ false);
+ rule.Comment = "Rule for compiling ";
+ rule.Comment += lang;
+ rule.Comment += " files.";
+ rule.Description = "Building ";
+ rule.Description += lang;
+ rule.Description += " object $out";
+ this->GetGlobalGenerator()->AddRule(rule);
}
void cmNinjaTargetGenerator::WriteObjectBuildStatements()
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a23fbce47294e746c15ee851dc3460a3a17da2b
commit 6a23fbce47294e746c15ee851dc3460a3a17da2b
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed May 29 11:48:22 2019 +0200
Commit: Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Wed May 29 12:59:31 2019 +0200
Ninja: Add cmNinjaRule class
diff --git a/Source/cmNinjaTypes.h b/Source/cmNinjaTypes.h
index 9e962f1..78f3917 100644
--- a/Source/cmNinjaTypes.h
+++ b/Source/cmNinjaTypes.h
@@ -8,6 +8,7 @@
#include <map>
#include <set>
#include <string>
+#include <utility>
#include <vector>
enum cmNinjaTargetDepends
@@ -20,4 +21,24 @@ typedef std::vector<std::string> cmNinjaDeps;
typedef std::set<std::string> cmNinjaOuts;
typedef std::map<std::string, std::string> cmNinjaVars;
+class cmNinjaRule
+{
+public:
+ cmNinjaRule(std::string name)
+ : Name(std::move(name))
+ {
+ }
+
+ std::string Name;
+ std::string Command;
+ std::string Description;
+ std::string Comment;
+ std::string DepFile;
+ std::string DepType;
+ std::string RspFile;
+ std::string RspContent;
+ std::string Restat;
+ bool Generator = false;
+};
+
#endif // ! cmNinjaTypes_h
-----------------------------------------------------------------------
Summary of changes:
CompileFlags.cmake | 11 +-
Source/cmCTest.cxx | 4 +-
Source/cmCallVisualStudioMacro.cxx | 12 +-
Source/cmGlobalGenerator.cxx | 15 ++-
Source/cmGlobalNinjaGenerator.cxx | 187 ++++++++++++------------------
Source/cmGlobalNinjaGenerator.h | 18 +--
Source/cmNinjaNormalTargetGenerator.cxx | 153 +++++++++++-------------
Source/cmNinjaTargetGenerator.cxx | 128 +++++++++-----------
Source/cmNinjaTypes.h | 21 ++++
Source/cmSystemTools.cxx | 12 +-
Source/cmSystemTools.h | 6 +-
Source/cmcmd.cxx | 8 +-
Utilities/cmjsoncpp/include/json/config.h | 10 +-
13 files changed, 268 insertions(+), 317 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list