Warning, /acts/Core/ActsVersion.hpp.in is written in an unsupported language. File is not indexed.
0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008
0009 #pragma once
0010
0011 // Caution: this is the only Acts header that is guaranteed
0012 // to change with every Acts release. Including this header
0013 // will cause a recompile every time a new Acts version is
0014 // used.
0015
0016 #include <iosfwd>
0017
0018 namespace Acts {
0019
0020 // clang-format does not like the CMake @...@ replacement variables
0021 // clang-format off
0022 constexpr unsigned int VersionMajor = @PROJECT_VERSION_MAJOR@u;
0023 constexpr unsigned int VersionMinor = @PROJECT_VERSION_MINOR@u;
0024 constexpr unsigned int VersionPatch = @PROJECT_VERSION_PATCH@u;
0025 // clang-format on
0026 constexpr unsigned int Version =
0027 10000u * VersionMajor + 100u * VersionMinor + VersionPatch;
0028 constexpr const char* const CommitHash = "@_acts_commit_hash@";
0029 constexpr const char* const CommitHashShort = "@_acts_commit_hash_short@";
0030
0031 struct VersionInfo {
0032 unsigned int versionMajor;
0033 unsigned int versionMinor;
0034 unsigned int versionPatch;
0035 const char* const commitHash;
0036
0037 VersionInfo() = delete;
0038
0039 static VersionInfo fromHeader() {
0040 return VersionInfo(VersionMajor, VersionMinor, VersionPatch, CommitHash);
0041 }
0042
0043 static VersionInfo fromLibrary();
0044
0045 bool operator==(const VersionInfo& other) const;
0046
0047 friend std::ostream& operator<<(std::ostream& os, const VersionInfo& vi);
0048
0049 private:
0050 VersionInfo(unsigned int majorIn, unsigned int minorIn, unsigned int patchIn,
0051 const char* const commitHashIn);
0052 };
0053
0054 } // namespace Acts