1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-20 04:24:36 +08:00

cmake: Print configure/generate time

This commit is contained in:
Kyle Edwards
2023-01-17 16:11:46 -05:00
parent 43c4faaf48
commit 5f0c5ec49b
10 changed files with 37 additions and 20 deletions

View File

@@ -4,11 +4,13 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <chrono>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <functional> #include <functional>
#include <initializer_list> #include <initializer_list>
#include <iomanip>
#include <iterator> #include <iterator>
#include <sstream> #include <sstream>
#include <utility> #include <utility>
@@ -1303,6 +1305,8 @@ void cmGlobalGenerator::CreateLocalGenerators()
void cmGlobalGenerator::Configure() void cmGlobalGenerator::Configure()
{ {
auto startTime = std::chrono::steady_clock::now();
this->FirstTimeProgress = 0.0f; this->FirstTimeProgress = 0.0f;
this->ClearGeneratorMembers(); this->ClearGeneratorMembers();
this->NextDeferId = 0; this->NextDeferId = 0;
@@ -1350,6 +1354,8 @@ void cmGlobalGenerator::Configure()
"number of local generators", "number of local generators",
cmStateEnums::INTERNAL); cmStateEnums::INTERNAL);
auto endTime = std::chrono::steady_clock::now();
if (this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE) { if (this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE) {
std::ostringstream msg; std::ostringstream msg;
if (cmSystemTools::GetErrorOccurredFlag()) { if (cmSystemTools::GetErrorOccurredFlag()) {
@@ -1363,7 +1369,10 @@ void cmGlobalGenerator::Configure()
} }
} }
} else { } else {
msg << "Configuring done"; auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
endTime - startTime);
msg << "Configuring done (" << std::fixed << std::setprecision(1)
<< ms.count() / 1000.0L << "s)";
} }
this->CMakeInstance->UpdateProgress(msg.str(), -1); this->CMakeInstance->UpdateProgress(msg.str(), -1);
} }
@@ -1606,6 +1615,8 @@ bool cmGlobalGenerator::Compute()
void cmGlobalGenerator::Generate() void cmGlobalGenerator::Generate()
{ {
auto startTime = std::chrono::steady_clock::now();
// Create a map from local generator to the complete set of targets // Create a map from local generator to the complete set of targets
// it builds by default. // it builds by default.
this->InitializeProgressMarks(); this->InitializeProgressMarks();
@@ -1688,7 +1699,13 @@ void cmGlobalGenerator::Generate()
w.str()); w.str());
} }
this->CMakeInstance->UpdateProgress("Generating done", -1); auto endTime = std::chrono::steady_clock::now();
auto ms =
std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
std::ostringstream msg;
msg << "Generating done (" << std::fixed << std::setprecision(1)
<< ms.count() / 1000.0L << "s)";
this->CMakeInstance->UpdateProgress(msg.str(), -1);
} }
bool cmGlobalGenerator::ComputeTargetDepends() bool cmGlobalGenerator::ComputeTargetDepends()

View File

@@ -1,2 +1,2 @@
-- Configuring done -- Configuring done \([0-9]+\.[0-9]s\)
-- Generating done -- Generating done \([0-9]+\.[0-9]s\)

View File

@@ -1,4 +1,4 @@
-- Detecting C compiler ABI info -- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done.* -- Detecting C compiler ABI info - done.*
-- Configuring done -- Configuring done \([0-9]+\.[0-9]s\)
-- Generating done -- Generating done \([0-9]+\.[0-9]s\)

View File

@@ -1,4 +1,4 @@
-- Configuring done -- Configuring done \([0-9]+\.[0-9]s\)
-- Generating done -- Generating done \([0-9]+\.[0-9]s\)
-- Build files have been written to: [^ -- Build files have been written to: [^
]*/Tests/RunCMake/NinjaMultiConfig/Simple-build ]*/Tests/RunCMake/NinjaMultiConfig/Simple-build

View File

@@ -1,4 +1,4 @@
-- Configuring done -- Configuring done \([0-9]+\.[0-9]s\)
-- Generating done -- Generating done \([0-9]+\.[0-9]s\)
-- Build files have been written to: [^ -- Build files have been written to: [^
]*/Tests/RunCMake/NinjaMultiConfig/Simple-build ]*/Tests/RunCMake/NinjaMultiConfig/Simple-build

View File

@@ -1,3 +1,3 @@
-- Configuring done -- Configuring done \([0-9]+\.[0-9]s\)
-- Generating done -- Generating done \([0-9]+\.[0-9]s\)
-- Build files have been written to: .*/Tests/RunCMake/configure_file/RerunCMake-build -- Build files have been written to: .*/Tests/RunCMake/configure_file/RerunCMake-build

View File

@@ -1,3 +1,3 @@
-- Configuring done -- Configuring done \([0-9]+\.[0-9]s\)
-- Generating done -- Generating done \([0-9]+\.[0-9]s\)
-- Build files have been written to: .*/Tests/RunCMake/configure_file/RerunCMake-build -- Build files have been written to: .*/Tests/RunCMake/configure_file/RerunCMake-build

View File

@@ -1,5 +1,5 @@
Running CMake on RerunCMake Running CMake on RerunCMake
FALSE FALSE
-- Configuring done -- Configuring done \([0-9]+\.[0-9]s\)
-- Generating done -- Generating done \([0-9]+\.[0-9]s\)
-- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build -- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build

View File

@@ -1,3 +1,3 @@
-- Configuring done -- Configuring done \([0-9]+\.[0-9]s\)
-- Generating done -- Generating done \([0-9]+\.[0-9]s\)
-- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build -- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build

View File

@@ -1,3 +1,3 @@
-- Configuring done -- Configuring done \([0-9]+\.[0-9]s\)
-- Generating done -- Generating done \([0-9]+\.[0-9]s\)
-- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build -- Build files have been written to: .*/Tests/RunCMake/try_compile/RerunCMake-build