From b7e6c418e3d7de531f6d2b5e0de154d955dc98c8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 10 Dec 2024 11:20:40 -0500 Subject: cmLocalUnixMakefileGenerator3: Simplify progress command generation --- Source/cmLocalUnixMakefileGenerator3.cxx | 38 ++++++++++++-------------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 4a776b4..d5d86b6 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -6,7 +6,6 @@ #include #include #include -#include #include #include @@ -1733,33 +1732,24 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( depends.emplace_back("cmake_check_build_system"); } - std::string progressDir = - cmStrCat(this->GetBinaryDirectory(), "/CMakeFiles"); - { - std::ostringstream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; - progCmd << this->ConvertToOutputFormat(progressDir, - cmOutputConverter::SHELL); - - std::string progressFile = "/CMakeFiles/progress.marks"; - std::string progressFileNameFull = this->ConvertToFullPath(progressFile); - progCmd << " " - << this->ConvertToOutputFormat(progressFileNameFull, - cmOutputConverter::SHELL); - commands.push_back(progCmd.str()); - } + std::string const progressDir = this->ConvertToOutputFormat( + cmStrCat(this->GetBinaryDirectory(), "/CMakeFiles"), + cmOutputConverter::SHELL); + std::string const progressMarks = this->ConvertToOutputFormat( + this->ConvertToFullPath("/CMakeFiles/progress.marks"), + cmOutputConverter::SHELL); + std::string const progressStartCommand = + cmStrCat("$(CMAKE_COMMAND) -E cmake_progress_start ", progressDir, ' ', + progressMarks); + std::string const progressFinishCommand = + cmStrCat("$(CMAKE_COMMAND) -E cmake_progress_start ", progressDir, " 0"); + + commands.emplace_back(progressStartCommand); std::string mf2Dir = "CMakeFiles/Makefile2"; commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); - { - std::ostringstream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 - progCmd << this->ConvertToOutputFormat(progressDir, - cmOutputConverter::SHELL); - progCmd << " 0"; - commands.push_back(progCmd.str()); - } + commands.emplace_back(progressFinishCommand); this->WriteMakeRule(ruleFileStream, "The main all target", "all", depends, commands, true); -- cgit v0.12 From af2b340a2e1043805a56a51f317c030d32e3a3e8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 10 Dec 2024 10:57:54 -0500 Subject: Makefile: Fix per-directory codegen target Issue: #26517 --- Source/cmLocalUnixMakefileGenerator3.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index d5d86b6..d6f1233 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1762,6 +1762,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( depends.emplace_back("cmake_check_build_system"); } commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget)); + this->CreateCDCommand(commands, this->GetBinaryDirectory(), + this->GetCurrentBinaryDirectory()); AppendEcho(commands, "Finished generating code", cmLocalUnixMakefileGenerator3::EchoColor::EchoGenerate); this->WriteMakeRule(ruleFileStream, "The main codegen target", "codegen", -- cgit v0.12 From 25b43a5b7fdc6216278f45fc6e7e65e0f50ed3b2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 10 Dec 2024 11:26:54 -0500 Subject: Makefile: Enable progress messages for codegen target This was left out of commit 197cb419d1 (add_custom_command: Add CODEGEN support, 2024-05-27, v3.31.0-rc1~394^2). --- Source/cmGlobalUnixMakefileGenerator3.cxx | 4 ++++ Source/cmLocalUnixMakefileGenerator3.cxx | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 38cc4f6..32c2a20 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -777,6 +777,10 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( makeTargetName = cmStrCat(localName, "/codegen"); commands.push_back( lg.GetRecursiveMakeCall(makefileName, makeTargetName)); + if (targetMessages) { + lg.AppendEcho(commands, "Finished codegen for target " + name, + cmLocalUnixMakefileGenerator3::EchoNormal, &progress); + } this->AppendCodegenTargetDepends(depends, gtarget.get()); rootLG.WriteMakeRule(ruleFileStream, "codegen rule for target.", makeTargetName, depends, commands, true); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index d6f1233..1e58f0b 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1761,11 +1761,11 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( if (regenerate) { depends.emplace_back("cmake_check_build_system"); } + commands.emplace_back(progressStartCommand); commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); - AppendEcho(commands, "Finished generating code", - cmLocalUnixMakefileGenerator3::EchoColor::EchoGenerate); + commands.emplace_back(progressFinishCommand); this->WriteMakeRule(ruleFileStream, "The main codegen target", "codegen", depends, commands, true); } -- cgit v0.12