KiCad PCB EDA Suite
build_version.cpp File Reference
#include <wx/wx.h>
#include <config.h>
#include <boost/version.hpp>
#include <kiplatform/app.h>
#include <kicad_build_version.h>

Go to the source code of this file.

Macros

#define ON   wxT( "ON" ) << eol
 
#define OFF   wxT( "OFF" ) << eol
 

Functions

std::string GetKicadCurlVersion ()
 
std::string GetCurlLibVersion ()
 
wxString GetPlatformGetBitnessName ()
 
wxString GetBuildVersion ()
 Get the full KiCad version string. More...
 
wxString GetBuildDate ()
 Get the build date as a string. More...
 
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 GetVersionInfoData (const wxString &aTitle, bool aHtml, bool aBrief)
 Create a version info string for bug reports and the about dialog. More...
 

Macro Definition Documentation

◆ OFF

#define OFF   wxT( "OFF" ) << eol

◆ ON

#define ON   wxT( "ON" ) << eol

Function Documentation

◆ GetBuildDate()

wxString GetBuildDate ( )

Get the build date as a string.

Returns
the build date string

Definition at line 72 of file build_version.cpp.

73 {
74  wxString msg = wxString::Format( wxT( "%s %s" ), wxT( __DATE__ ), wxT( __TIME__ ) );
75  return msg;
76 }
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 65 of file build_version.cpp.

66 {
67  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_VERSION_FULL ) );
68  return msg;
69 }
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 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().

◆ GetCurlLibVersion()

std::string GetCurlLibVersion ( )

Definition at line 142 of file kicad_curl.cpp.

143 {
144  return LIBCURL_VERSION;
145 }

Referenced by GetVersionInfoData().

◆ GetKicadCurlVersion()

std::string GetKicadCurlVersion ( )

Definition at line 136 of file kicad_curl.cpp.

137 {
138  return KICAD_CURL::GetVersion();
139 }
static const char * GetVersion()
Wrapper for curl_version().
Definition: kicad_curl.h:87

References KICAD_CURL::GetVersion().

Referenced by GetVersionInfoData().

◆ 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 86 of file build_version.cpp.

87 {
88  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_MAJOR_MINOR_VERSION ) );
89  return msg;
90 }
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 EVT_MENU_RANGE(), GetKicadLockFilePath(), SETTINGS_MANAGER::GetSettingsVersion(), KICAD_MANAGER_FRAME::ProjectChanged(), and COMMON_CONTROL::ShowHelp().

◆ GetPlatformGetBitnessName()

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

Definition at line 53 of file build_version.cpp.

54 {
55  wxPlatformInfo platform;
56 // TODO (ISM): Read conditional once our wx fork and flatpaks are running released 3.1.5
57 #if 0 && wxCHECK_VERSION( 3, 1, 5 )
58  return platform.GetBitnessName();
59 #else
60  return platform.GetArchName();
61 #endif
62 }

Referenced by 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 79 of file build_version.cpp.

80 {
81  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_SEMANTIC_VERSION ) );
82  return msg;
83 }
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().

◆ 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 93 of file build_version.cpp.

94 {
95  wxString aMsg;
96  // DO NOT translate information in the msg_version string
97 
98  wxString eol = aHtml ? wxT( "<br>" ) : wxT( "\n" );
99 
100  // Tabs instead of spaces for the plaintext version for shorter string length
101  wxString indent4 = aHtml ? wxT( "&nbsp;&nbsp;&nbsp;&nbsp;" ) : wxT( "\t" );
102 
103 #define ON wxT( "ON" ) << eol
104 #define OFF wxT( "OFF" ) << eol
105 
106  wxString version;
107  version << ( KIPLATFORM::APP::IsOperatingSystemUnsupported() ? wxT( "(UNSUPPORTED)" )
108  : GetBuildVersion() )
109 #ifdef DEBUG
110  << wxT( ", debug" )
111 #else
112  << wxT( ", release" )
113 #endif
114  << wxT( " build" );
115 
116  wxPlatformInfo platform;
117  aMsg << wxT( "Application: " ) << aTitle;
118 
119  #if defined( KICAD_BUILD_ARCH_X64 )
120  aMsg << wxT( " (64-bit)" );
121  #elif defined( KICAD_BUILD_ARCH_X86 )
122  aMsg << wxT( " (32-bit)" );
123  #elif defined( KICAD_BUILD_ARCH_ARM )
124  aMsg << wxT( " (ARM 32-bit)" );
125  #elif defined( KICAD_BUILD_ARCH_ARM64 )
126  aMsg << wxT( " (ARM 64-bit)" );
127  #endif
128 
129  aMsg << eol << eol;
130 
131 
132  aMsg << wxT( "Version: " ) << version << eol << eol;
133  aMsg << wxT( "Libraries:" ) << eol;
134 
135  aMsg << indent4 << wxGetLibraryVersionInfo().GetVersionString() << eol;
136 
137  if( !aBrief )
138  aMsg << indent4 << GetKicadCurlVersion() << eol;
139 
140  aMsg << eol;
141 
142  aMsg << wxT( "Platform: " ) << wxGetOsDescription() << wxT( ", " )
143  << GetPlatformGetBitnessName() << wxT( ", " )
144  << platform.GetEndiannessName() << wxT( ", " )
145  << platform.GetPortIdName();
146 
147 #ifdef __WXGTK__
148  aMsg << wxT( ", " ) << wxGetenv( wxT( "XDG_SESSION_DESKTOP" ) )
149  << wxT( ", " ) << wxGetenv( wxT( "XDG_SESSION_TYPE" ) );
150 #endif
151 
152  aMsg << eol << eol;
153 
154  if( !aBrief )
155  {
156  aMsg << wxT( "Build Info:" ) << eol;
157  aMsg << indent4 << wxT( "Date: " ) << GetBuildDate() << eol;
158  }
159 
160  aMsg << indent4 << wxT( "wxWidgets: " ) << wxVERSION_NUM_DOT_STRING << wxT( " (" );
161  aMsg << __WX_BO_UNICODE __WX_BO_STL __WX_BO_WXWIN_COMPAT_2_8 wxT( ")" );
162 
163  // Get the GTK+ version where possible.
164 #ifdef __WXGTK__
165  int major, minor;
166 
167  major = wxPlatformInfo().Get().GetToolkitMajorVersion();
168  minor = wxPlatformInfo().Get().GetToolkitMinorVersion();
169  aMsg << wxT( " GTK+ " ) << major << wxT( "." ) << minor;
170 #endif
171 
172  aMsg << eol;
173 
174  aMsg << indent4 << wxT( "Boost: " ) << ( BOOST_VERSION / 100000 ) << wxT( "." )
175  << ( BOOST_VERSION / 100 % 1000 ) << wxT( "." )
176  << ( BOOST_VERSION % 100 ) << eol;
177 
178 #ifdef KICAD_USE_OCC
179  aMsg << indent4 << wxT( "OCC: " ) << OCC_VERSION_COMPLETE << eol;
180 #endif
181 
182  aMsg << indent4 << wxT( "Curl: " ) << GetCurlLibVersion() << eol;
183 
184 #if defined( KICAD_SPICE )
185 #if defined( NGSPICE_BUILD_VERSION )
186  aMsg << indent4 << wxT( "ngspice: " ) << NGSPICE_BUILD_VERSION << eol;
187 #elif defined( NGSPICE_HAVE_CONFIG_H )
188  #undef HAVE_STRNCASECMP /* is redefined in ngspice/config.h */
189  #include <ngspice/config.h>
190  aMsg << indent4 << wxT( "ngspice: " ) << PACKAGE_VERSION << eol;
191 #elif defined( NGSPICE_PACKAGE_VERSION )
192  aMsg << indent4 << wxT( "ngspice: " ) << NGSPICE_PACKAGE_VERSION << eol;
193 #else
194  aMsg << indent4 << wxT( "ngspice: " ) << wxT( "unknown" ) << eol;
195 #endif
196 #endif
197 
198  aMsg << indent4 << wxT( "Compiler: " );
199 #if defined(__clang__)
200  aMsg << wxT( "Clang " ) << __clang_major__ << wxT( "." ) << __clang_minor__ << wxT( "." ) << __clang_patchlevel__;
201 #elif defined(__GNUG__)
202  aMsg << wxT( "GCC " ) << __GNUC__ << wxT( "." ) << __GNUC_MINOR__ << wxT( "." ) << __GNUC_PATCHLEVEL__;
203 #elif defined(_MSC_VER)
204  aMsg << wxT( "Visual C++ " ) << _MSC_VER;
205 #elif defined(__INTEL_COMPILER)
206  aMsg << wxT( "Intel C++ " ) << __INTEL_COMPILER;
207 #else
208  aMsg << wxT( "Other Compiler " );
209 #endif
210 
211 #if defined(__GXX_ABI_VERSION)
212  aMsg << wxT( " with C++ ABI " ) << __GXX_ABI_VERSION << eol;
213 #else
214  aMsg << wxT( " without C++ ABI" ) << eol;
215 #endif
216 
217  aMsg << eol;
218 
219  // Add build settings config (build options):
220  aMsg << wxT( "Build settings:" ) << eol;
221 
222 #ifdef KICAD_USE_OCC
223  aMsg << indent4 << wxT( "KICAD_USE_OCC=" ) << ON;
224 #endif
225 
226 #ifdef KICAD_USE_EGL
227  aMsg << indent4 << wxT( "KICAD_USE_EGL=" ) << ON;
228 #endif
229 
230  aMsg << indent4 << wxT( "KICAD_SPICE=" );
231 #ifdef KICAD_SPICE
232  aMsg << ON;
233 #else
234  aMsg << OFF;
235 #endif
236 
237 #ifndef NDEBUG
238  aMsg << indent4 << wxT( "KICAD_STDLIB_DEBUG=" );
239 #ifdef KICAD_STDLIB_DEBUG
240  aMsg << ON;
241 #else
242  aMsg << OFF;
243  aMsg << indent4 << wxT( "KICAD_STDLIB_LIGHT_DEBUG=" );
244 #ifdef KICAD_STDLIB_LIGHT_DEBUG
245  aMsg << ON;
246 #else
247  aMsg << OFF;
248 #endif
249 #endif
250 
251  aMsg << indent4 << wxT( "KICAD_SANITIZE_ADDRESS=" );
252 #ifdef KICAD_SANITIZE_ADDRESS
253  aMsg << ON;
254 #else
255  aMsg << OFF;
256 #endif
257 
258  aMsg << indent4 << wxT( "KICAD_SANITIZE_THREADS=" );
259 #ifdef KICAD_SANITIZE_THREADS
260  aMsg << ON;
261 #else
262  aMsg << OFF;
263 #endif
264 #endif
265 
266  return aMsg;
267 }
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:73
#define ON
std::string GetCurlLibVersion()
Definition: kicad_curl.cpp:142
wxString GetBuildVersion()
Get the full KiCad version string.
wxString GetPlatformGetBitnessName()
#define OFF
wxString GetBuildDate()
Get the build date as a string.
std::string GetKicadCurlVersion()
Definition: kicad_curl.cpp:136

References GetBuildDate(), GetBuildVersion(), GetCurlLibVersion(), GetKicadCurlVersion(), GetPlatformGetBitnessName(), KIPLATFORM::APP::IsOperatingSystemUnsupported(), OFF, and ON.

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