-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add compiled version info (#2313)
This should help us detect when we're running with a mismatched header/shared lib combo, like can happen in the hack-build in Athena.
- Loading branch information
1 parent
dbcba62
commit 21cb496
Showing
4 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2023 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include "Acts/ActsVersion.hpp" | ||
|
||
#include <ostream> | ||
#include <string_view> | ||
|
||
namespace Acts { | ||
|
||
VersionInfo::VersionInfo(unsigned int majorIn, unsigned int minorIn, | ||
unsigned int patchIn, const char* const commitHashIn) | ||
: versionMajor(majorIn), | ||
versionMinor(minorIn), | ||
versionPatch(patchIn), | ||
commitHash(commitHashIn) {} | ||
|
||
VersionInfo VersionInfo::fromLibrary() { | ||
// this is filled by the Core shared library | ||
// while the constants below depend on the include | ||
return VersionInfo{VersionMajor, VersionMinor, VersionPatch, CommitHash}; | ||
} | ||
|
||
bool VersionInfo::operator==(const VersionInfo& other) const { | ||
return versionMajor == other.versionMajor && | ||
versionMinor == other.versionMinor && | ||
versionPatch == other.versionPatch && | ||
std::string_view{commitHash} == std::string_view{other.commitHash}; | ||
} | ||
|
||
std::ostream& operator<<(std::ostream& os, const VersionInfo& vi) { | ||
os << vi.versionMajor << "." << vi.versionMinor << "." << vi.versionPatch | ||
<< " (commit " << vi.commitHash << ")"; | ||
return os; | ||
} | ||
} // namespace Acts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters