-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
147 additions
and
136 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
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,121 @@ | ||
// This file was generated by VersionString.cmake | ||
|
||
#pragma once | ||
|
||
#include <ostream> | ||
|
||
constexpr const char k@VAR_PREFIX@ProjectName[] = "@PROJECT_NAME@"; | ||
constexpr const char k@VAR_PREFIX@VersionNumber[] = "@PROJECT_VERSION@"; | ||
constexpr int k@VAR_PREFIX@BuildNumber = @BUILD_NUMBER@; | ||
constexpr const char k@VAR_PREFIX@RevisionGitTag[] = "@REVISION_GIT_TAGREF@"; | ||
constexpr const char k@VAR_PREFIX@RevisionDate[] = "@REVISION_DATE_TIME@"; | ||
|
||
#ifndef VERSION_INFO_DEFINED | ||
#define VERSION_INFO_DEFINED 1 | ||
|
||
namespace version_info_v1_1 | ||
{ | ||
|
||
class version_info_base | ||
{ | ||
public: | ||
static void write_version_string(std::ostream &os, bool verbose) | ||
{ | ||
auto s_main = registered_main(); | ||
if (s_main != nullptr) | ||
s_main->write(os, verbose); | ||
|
||
if (verbose) | ||
{ | ||
for (auto lib = registered_libraries(); lib != nullptr; lib = lib->m_next) | ||
{ | ||
os << "-\n"; | ||
lib->write(os, verbose); | ||
} | ||
} | ||
} | ||
|
||
protected: | ||
version_info_base(const char *name, const char *version, int build_number, const char *git_tag, const char *revision_date, bool is_main) | ||
: m_name(name) | ||
, m_version(version) | ||
, m_build_number(build_number) | ||
, m_git_tag(git_tag) | ||
, m_revision_date(revision_date) | ||
{ | ||
if (is_main) | ||
registered_main() = this; | ||
else | ||
{ | ||
auto &s_head = registered_libraries(); | ||
m_next = s_head; | ||
s_head = this; | ||
} | ||
} | ||
|
||
void write(std::ostream &os, bool verbose) | ||
{ | ||
os << m_name << " version " << m_version << '\n'; | ||
|
||
if (verbose) | ||
{ | ||
if (m_build_number != 0) | ||
{ | ||
os << "build: " << m_build_number << ' ' << m_revision_date << '\n'; | ||
if (m_git_tag[0] != 0) | ||
os << "git tag: " << m_git_tag << '\n'; | ||
} | ||
} | ||
} | ||
|
||
using version_info_ptr = version_info_base *; | ||
|
||
static version_info_ptr ®istered_main() | ||
{ | ||
static version_info_ptr s_main = nullptr; | ||
return s_main; | ||
} | ||
|
||
static version_info_ptr ®istered_libraries() | ||
{ | ||
static version_info_ptr s_head = nullptr; | ||
return s_head; | ||
} | ||
|
||
const char *m_name; | ||
const char *m_version; | ||
int m_build_number; | ||
const char *m_git_tag; | ||
const char *m_revision_date; | ||
version_info_base *m_next = nullptr; | ||
}; | ||
|
||
template <typename T> | ||
class version_info : public version_info_base | ||
{ | ||
public: | ||
using implementation_type = T; | ||
|
||
version_info(const char *name, const char *version, int build_number, const char *git_tag, const char *revision_date, bool is_main) | ||
: version_info_base(name, version, build_number, git_tag, revision_date, is_main) | ||
{ | ||
} | ||
}; | ||
|
||
} // namespace version_info_v1_1 | ||
|
||
inline void write_version_string(std::ostream &os, bool verbose) | ||
{ | ||
version_info_v1_1::version_info_base::write_version_string(os, verbose); | ||
} | ||
|
||
#endif | ||
|
||
const class version_info_@IDENT_PREFIX@impl : public version_info_v1_1::version_info<version_info_@IDENT_PREFIX@impl> | ||
{ | ||
public: | ||
version_info_@IDENT_PREFIX@impl() | ||
: version_info(k@VAR_PREFIX@ProjectName, k@VAR_PREFIX@VersionNumber, k@VAR_PREFIX@BuildNumber, k@VAR_PREFIX@RevisionGitTag, k@VAR_PREFIX@RevisionDate, @BOOL_IS_MAIN@) | ||
{ | ||
} | ||
} s_version_info_@IDENT_PREFIX@instance; |
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