KiCad PCB EDA Suite
build_version.h File Reference
#include <tuple>

Go to the source code of this file.

Functions

wxString GetBuildVersion ()
 Get the full KiCad version string. More...
 
wxString GetPlatformGetBitnessName ()
 
wxString GetSemanticVersion ()
 Get the semantic version string for KiCad defined inside the KiCadVersion.cmake file in the variable KICAD_SEMANTIC_VERSION. More...
 
wxString GetMajorMinorVersion ()
 Get only the major and minor version in a string major.minor. More...
 
wxString GetMajorMinorPatchVersion ()
 Get the major, minor and patch version in a string major.minor.patch This is extracted by CMake from the KICAD_SEMANTIC_VERSION variable. More...
 
wxString GetBuildDate ()
 Get the build date as a string. More...
 
wxString GetCommitHash ()
 Get the commit hash as a string. More...
 
const std::tuple< int, int, int > & GetMajorMinorPatchTuple ()
 Get the build version numbers as a tuple. More...
 
bool IsNightlyVersion ()
 Check if the build is meant to be nightly. More...
 
wxString GetVersionInfoData (const wxString &aTitle, bool aHtml=false, bool aBrief=false)
 Create a version info string for bug reports and the about dialog. More...
 

Function Documentation

◆ GetBuildDate()

wxString GetBuildDate ( )

Get the build date as a string.

Returns
the build date string

Definition at line 84 of file build_version.cpp.

85{
86 wxString msg = wxString::Format( wxT( "%s %s" ), wxT( __DATE__ ), wxT( __TIME__ ) );
87 return msg;
88}
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format().

Referenced by buildKicadAboutBanner(), GetVersionInfoData(), and KICAD_CURL_EASY::KICAD_CURL_EASY().

◆ GetBuildVersion()

wxString GetBuildVersion ( )

Get the full KiCad version string.

This string contains platform-specific information added by the packagers. It is created by CMake in the KICAD_FULL_VERSION variable.

Returns
the full version string

Definition at line 77 of file build_version.cpp.

78{
79 wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_VERSION_FULL ) );
80 return msg;
81}

References Format().

Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONHeader(), DS_DRAW_ITEM_LIST::BuildFullText(), buildKicadAboutBanner(), CreateHeaderInfoData(), PCB_EDIT_FRAME::Export_IDF3(), PLACE_FILE_EXPORTER::GenPositionData(), PLACE_FILE_EXPORTER::GenReportData(), GetVersionInfoData(), KICAD_CURL_EASY::KICAD_CURL_EASY(), NETLIST_EXPORTER_XML::makeDesignHeader(), DSN::PARSER::PARSER(), GERBER_PLOTTER::StartPlot(), EXCELLON_WRITER::writeEXCELLONHeader(), PCB_CALCULATOR_DATAFILE::WriteHeader(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

◆ GetCommitHash()

wxString GetCommitHash ( )

Get the commit hash as a string.

Returns
the commit hash string

Definition at line 105 of file build_version.cpp.

106{
107 wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_COMMIT_HASH ) );
108 return msg;
109}

References Format().

Referenced by CLI::VERSION_COMMAND::doPerform().

◆ GetMajorMinorPatchTuple()

const std::tuple< int, int, int > & GetMajorMinorPatchTuple ( )

Get the build version numbers as a tuple.

Returns
A tuple with three ints for major/minor/patch revisions

Definition at line 118 of file build_version.cpp.

119{
120 static std::tuple<int, int, int> retval = KICAD_MAJOR_MINOR_PATCH_TUPLE;
121
122 return retval;
123}

◆ GetMajorMinorPatchVersion()

wxString GetMajorMinorPatchVersion ( )

Get the major, minor and patch version in a string major.minor.patch This is extracted by CMake from the KICAD_SEMANTIC_VERSION variable.

Returns
the major.minor.patch version as a string

Definition at line 112 of file build_version.cpp.

113{
114 wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_MAJOR_MINOR_PATCH_VERSION ) );
115 return msg;
116}

References Format().

Referenced by CLI::VERSION_COMMAND::doPerform().

◆ GetMajorMinorVersion()

wxString GetMajorMinorVersion ( )

Get only the major and minor version in a string major.minor.

This is extracted by CMake from the KICAD_SEMANTIC_VERSION variable.

Returns
the major and minor version as a string

Definition at line 98 of file build_version.cpp.

99{
100 wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_MAJOR_MINOR_VERSION ) );
101 return msg;
102}

References Format().

Referenced by EVT_MENU_RANGE(), GetKicadLockFilePath(), SETTINGS_MANAGER::GetSettingsVersion(), HTML_MESSAGE_BOX::OnHTMLLinkClicked(), PLUGIN_CONTENT_MANAGER::PLUGIN_CONTENT_MANAGER(), KICAD_MANAGER_FRAME::ProjectChanged(), and COMMON_CONTROL::ShowHelp().

◆ GetPlatformGetBitnessName()

wxString GetPlatformGetBitnessName ( )
Returns
the bitness name string (like "Little endian")

Definition at line 55 of file build_version.cpp.

56{
57 wxPlatformInfo platform;
58// TODO (ISM): Read conditional once our wx fork and flatpaks are running released 3.1.5
59// On Windows, use GetBitnessName if exists
60// I (J-PC) hope 3.1.6 has no problem
61#if defined( __WINDOWS__ ) && wxCHECK_VERSION( 3, 1, 5 )
62 return platform.GetBitnessName();
63#elif wxCHECK_VERSION( 3, 1, 6 )
64 return platform.GetBitnessName();
65#else
66 return platform.GetArchName();
67#endif
68}

Referenced by buildKicadAboutBanner(), GetVersionInfoData(), and KICAD_CURL_EASY::KICAD_CURL_EASY().

◆ GetSemanticVersion()

wxString GetSemanticVersion ( )

Get the semantic version string for KiCad defined inside the KiCadVersion.cmake file in the variable KICAD_SEMANTIC_VERSION.

Returns
the semantic version string

Definition at line 91 of file build_version.cpp.

92{
93 wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_SEMANTIC_VERSION ) );
94 return msg;
95}

References Format().

◆ GetVersionInfoData()

wxString GetVersionInfoData ( const wxString &  aTitle,
bool  aHtml = false,
bool  aBrief = false 
)

Create a version info string for bug reports and the about dialog.

Parameters
aTitleis the application title to include at the top of the report
aBrief= true to condense information for the bug report URL
aHtml= true to use a minimal HTML format, false for plan text
Returns
the version info string

Definition at line 126 of file build_version.cpp.

127{
128 wxString aMsg;
129 // DO NOT translate information in the msg_version string
130
131 wxString eol = aHtml ? "<br>" : "\n";
132
133 // Tabs instead of spaces for the plaintext version for shorter string length
134 wxString indent4 = aHtml ? "&nbsp;&nbsp;&nbsp;&nbsp;" : "\t";
135
136#define ON "ON" << eol
137#define OFF "OFF" << eol
138
139 wxString version;
140 version << ( KIPLATFORM::APP::IsOperatingSystemUnsupported() ? wxString( wxS( "(UNSUPPORTED)" ) )
141 : GetBuildVersion() )
142#ifdef DEBUG
143 << ", debug"
144#else
145 << ", release"
146#endif
147 << " build";
148
149 wxPlatformInfo platform;
150 aMsg << "Application: " << aTitle;
151 #if wxCHECK_VERSION( 3, 1, 6 )
152 aMsg << " " << wxGetCpuArchitectureName() << " on " << wxGetNativeCpuArchitectureName();
153 #elif defined( KICAD_BUILD_ARCH_X64 )
154 aMsg << " (64-bit)";
155 #elif defined( KICAD_BUILD_ARCH_X86 )
156 aMsg << " (32-bit)";
157 #elif defined( KICAD_BUILD_ARCH_ARM )
158 aMsg << " (ARM 32-bit)";
159 #elif defined( KICAD_BUILD_ARCH_ARM64 )
160 aMsg << " (ARM 64-bit)";
161 #endif
162
163 aMsg << eol << eol;
164
165
166 aMsg << "Version: " << version << eol << eol;
167 aMsg << "Libraries:" << eol;
168
169 aMsg << indent4 << wxGetLibraryVersionInfo().GetVersionString() << eol;
170
171 aMsg << indent4 << "FreeType " << KIFONT::OUTLINE_FONT::FreeTypeVersion() << eol;
172 aMsg << indent4 << "HarfBuzz " << KIFONT::OUTLINE_FONT::HarfBuzzVersion() << eol;
173 aMsg << indent4 << "FontConfig " << KIFONT::OUTLINE_FONT::FontConfigVersion() << eol;
174
175 if( !aBrief )
176 aMsg << indent4 << GetKicadCurlVersion() << eol;
177
178 aMsg << eol;
179
180 aMsg << "Platform: "
181#if __LINUX__
182 << wxGetLinuxDistributionInfo().Description << ", "
183#else
184 << wxGetOsDescription() << ", "
185#endif
186 << GetPlatformGetBitnessName() << ", "
187 << platform.GetEndiannessName() << ", "
188 << platform.GetPortIdName();
189
190#ifdef __WXGTK__
191 aMsg << ", " << wxGetenv( "XDG_SESSION_DESKTOP" )
192 << ", " << wxGetenv( "XDG_SESSION_TYPE" );
193#endif
194
195 aMsg << eol << eol;
196
197 if( !aBrief )
198 {
199 aMsg << "Build Info:" << eol;
200 aMsg << indent4 << "Date: " << GetBuildDate() << eol;
201 }
202
203 aMsg << indent4 << "wxWidgets: " << wxVERSION_NUM_DOT_STRING << " (";
204 aMsg << __WX_BO_UNICODE __WX_BO_STL __WX_BO_WXWIN_COMPAT_2_8 ")";
205
206 // Get the GTK+ version where possible.
207#ifdef __WXGTK__
208 int major, minor;
209
210 major = wxPlatformInfo().Get().GetToolkitMajorVersion();
211 minor = wxPlatformInfo().Get().GetToolkitMinorVersion();
212 aMsg << " GTK+ " << major << "." << minor;
213#endif
214
215 aMsg << eol;
216
217 aMsg << indent4 << "Boost: " << ( BOOST_VERSION / 100000 ) << wxT( "." )
218 << ( BOOST_VERSION / 100 % 1000 ) << wxT( "." )
219 << ( BOOST_VERSION % 100 ) << eol;
220
221 aMsg << indent4 << "OCC: " << OCC_VERSION_COMPLETE << eol;
222 aMsg << indent4 << "Curl: " << GetCurlLibVersion() << eol;
223
224#if defined( KICAD_SPICE )
225#if defined( NGSPICE_BUILD_VERSION )
226 aMsg << indent4 << "ngspice: " << NGSPICE_BUILD_VERSION << eol;
227#elif defined( NGSPICE_HAVE_CONFIG_H )
228 #undef HAVE_STRNCASECMP /* is redefined in ngspice/config.h */
229 #include <ngspice/config.h>
230 aMsg << indent4 << "ngspice: " << PACKAGE_VERSION << eol;
231#elif defined( NGSPICE_PACKAGE_VERSION )
232 aMsg << indent4 << "ngspice: " << NGSPICE_PACKAGE_VERSION << eol;
233#else
234 aMsg << indent4 << "ngspice: " << "unknown" << eol;
235#endif
236#endif
237
238 aMsg << indent4 << "Compiler: ";
239#if defined(__clang__)
240 aMsg << "Clang " << __clang_major__ << "." << __clang_minor__ << "." << __clang_patchlevel__;
241#elif defined(__GNUG__)
242 aMsg << "GCC " << __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__;
243#elif defined(_MSC_VER)
244 aMsg << "Visual C++ " << _MSC_VER;
245#elif defined(__INTEL_COMPILER)
246 aMsg << "Intel C++ " << __INTEL_COMPILER;
247#else
248 aMsg << "Other Compiler ";
249#endif
250
251#if defined(__GXX_ABI_VERSION)
252 aMsg << " with C++ ABI " << __GXX_ABI_VERSION << eol;
253#else
254 aMsg << " without C++ ABI" << eol;
255#endif
256
257 aMsg << eol;
258
259 // Add build settings config (build options):
260 aMsg << "Build settings:" << eol;
261
262#ifdef KICAD_USE_EGL
263 aMsg << indent4 << "KICAD_USE_EGL=" << ON;
264#endif
265
266 aMsg << indent4 << "KICAD_SPICE=";
267#ifdef KICAD_SPICE
268 aMsg << ON;
269#else
270 aMsg << OFF;
271#endif
272
273#ifndef NDEBUG
274 aMsg << indent4 << "KICAD_STDLIB_DEBUG=";
275#ifdef KICAD_STDLIB_DEBUG
276 aMsg << ON;
277#else
278 aMsg << OFF;
279 aMsg << indent4 << "KICAD_STDLIB_LIGHT_DEBUG=";
280#ifdef KICAD_STDLIB_LIGHT_DEBUG
281 aMsg << ON;
282#else
283 aMsg << OFF;
284#endif
285#endif
286
287 aMsg << indent4 << "KICAD_SANITIZE_ADDRESS=";
288#ifdef KICAD_SANITIZE_ADDRESS
289 aMsg << ON;
290#else
291 aMsg << OFF;
292#endif
293
294 aMsg << indent4 << "KICAD_SANITIZE_THREADS=";
295#ifdef KICAD_SANITIZE_THREADS
296 aMsg << ON;
297#else
298 aMsg << OFF;
299#endif
300#endif
301
302 return aMsg;
303}
#define OFF
std::string GetCurlLibVersion()
Definition: kicad_curl.cpp:142
std::string GetKicadCurlVersion()
Definition: kicad_curl.cpp:136
wxString GetBuildVersion()
Get the full KiCad version string.
wxString GetPlatformGetBitnessName()
#define ON
wxString GetBuildDate()
Get the build date as a string.
static wxString FreeTypeVersion()
static wxString FontConfigVersion()
static wxString HarfBuzzVersion()
bool IsOperatingSystemUnsupported()
Checks if the Operating System is explicitly unsupported and we want to prevent users from sending bu...
Definition: gtk/app.cpp:51
< Package version metadata Package metadata
Definition: pcm_data.h:74

References KIFONT::OUTLINE_FONT::FontConfigVersion(), KIFONT::OUTLINE_FONT::FreeTypeVersion(), GetBuildDate(), GetBuildVersion(), GetCurlLibVersion(), GetKicadCurlVersion(), GetPlatformGetBitnessName(), KIFONT::OUTLINE_FONT::HarfBuzzVersion(), KIPLATFORM::APP::IsOperatingSystemUnsupported(), OFF, and ON.

Referenced by DIALOG_ABOUT::createNotebooks(), CLI::VERSION_COMMAND::doPerform(), DIALOG_ABOUT::onCopyVersionInfo(), and COMMON_CONTROL::ReportBug().

◆ IsNightlyVersion()

bool IsNightlyVersion ( )

Check if the build is meant to be nightly.

Returns
true if running nightly build

Definition at line 71 of file build_version.cpp.

72{
73 return !!KICAD_IS_NIGHTLY;
74}

Referenced by DIALOG_ABOUT::DIALOG_ABOUT(), and EVT_MENU_RANGE().