2 * Copyright (C) 2014-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "CompileInfo.h"
10 #include "addons/AddonRepoInfo.h"
11 #include "utils/StringUtils.h"
17 int CCompileInfo::GetMajor()
19 return @APP_VERSION_MAJOR@
;
22 int CCompileInfo::GetMinor()
24 return @APP_VERSION_MINOR@
;
27 const char* CCompileInfo::GetPackage()
29 return "@APP_PACKAGE@";
32 const char* CCompileInfo::GetClass()
34 static std::string s_classname
;
36 if (s_classname
.empty())
38 s_classname
= CCompileInfo::GetPackage();
39 std::replace(s_classname
.begin(), s_classname
.end(), '.', '/');
41 return s_classname
.c_str();
44 const char* CCompileInfo::GetAppName()
49 const char* CCompileInfo::GetSuffix()
51 return "@APP_VERSION_TAG@";
54 const char* CCompileInfo::GetSCMID()
59 std::string
CCompileInfo::GetSharedLibrarySuffix()
61 return "@APP_SHARED_LIBRARY_SUFFIX@";
64 const char* CCompileInfo::GetCopyrightYears()
66 return "@APP_COPYRIGHT_YEARS@";
69 std::string
CCompileInfo::GetBuildDate()
71 const std::string bdate
= "@APP_BUILD_DATE@";
74 std::string datestamp
= bdate
.substr(0, 4) + "-" + bdate
.substr(4, 2) + "-" + bdate
.substr(6, 2);
80 const char* CCompileInfo::GetVersionCode()
82 return "@APP_VERSION_CODE@";
85 std::vector
<ADDON::RepoInfo
> CCompileInfo::LoadOfficialRepoInfos()
87 const std::vector
<std::string
> officialAddonRepos
=
88 StringUtils::Split("@APP_ADDON_REPOS@", ',');
90 std::vector
<ADDON::RepoInfo
> officialRepoInfos
;
91 ADDON::RepoInfo newRepoInfo
;
93 for (const auto& addonRepo
: officialAddonRepos
)
95 const std::vector
<std::string
> tmpRepoInfo
= StringUtils::Split(addonRepo
, '|');
96 newRepoInfo
.m_repoId
= tmpRepoInfo
.front();
97 newRepoInfo
.m_origin
= tmpRepoInfo
.back();
98 officialRepoInfos
.emplace_back(newRepoInfo
);
101 return officialRepoInfos
;
104 std::vector
<std::string
> CCompileInfo::GetAvailableWindowSystems()
106 return StringUtils::Split("@CORE_PLATFORM_NAME_LC@", ' ');
109 std::vector
<std::string
> CCompileInfo::GetAvailableAudioBackends()
111 return StringUtils::Split("@AUDIO_BACKENDS@", ' ');
114 std::vector
<std::string
> CCompileInfo::GetAvailableGlInterfaces()
116 return StringUtils::Split("@GL_INTERFACES@", ' ');
119 // Return version of python built against as format MAJOR.MINOR
120 std::string
CCompileInfo::GetPythonVersion()
122 return "@PYTHON_VERSION@";
125 std::vector
<std::string
> CCompileInfo::GetWebserverExtraWhitelist()
127 return StringUtils::Split("@KODI_WEBSERVER_EXTRA_WHITELIST@", ',');