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

Go to the source code of this file.

Macros

#define ON   "ON" << eol
 
#define OFF   "OFF" << eol
 

Functions

std::string GetKicadCurlVersion ()
 
std::string GetCurlLibVersion ()
 
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   "OFF" << eol

◆ ON

#define ON   "ON" << eol

Function Documentation

◆ GetBuildDate()

wxString GetBuildDate ( )

Get the build date as a string.

Returns
the build date string

Definition at line 55 of file build_version.cpp.

56 {
57  wxString msg = wxString::Format( wxT( "%s %s" ), wxT( __DATE__ ), wxT( __TIME__ ) );
58  return msg;
59 }
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(), and GetVersionInfoData().

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

49 {
50  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_VERSION_FULL ) );
51  return msg;
52 }
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(), EVT_MENU_RANGE(), PCB_EDIT_FRAME::Export_IDF3(), PLACE_FILE_EXPORTER::GenPositionData(), PLACE_FILE_EXPORTER::GenReportData(), GetVersionInfoData(), NETLIST_EXPORTER_XML::makeDesignHeader(), DSN::PARSER::PARSER(), GERBER_PLOTTER::StartPlot(), EXCELLON_WRITER::writeEXCELLONHeader(), PCB_CALCULATOR_DATAFILE::WriteHeader(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), and GBR_TO_PCB_EXPORTER::writePcbHeader().

◆ GetCurlLibVersion()

std::string GetCurlLibVersion ( )

Definition at line 244 of file kicad_curl.cpp.

245 {
246  return LIBCURL_VERSION;
247 }

Referenced by GetVersionInfoData().

◆ GetKicadCurlVersion()

std::string GetKicadCurlVersion ( )

Definition at line 239 of file kicad_curl.cpp.

240 {
241  return KICAD_CURL::GetVersion();
242 }
static const char * GetVersion()
Function GetVersion wrapper for curl_version().
Definition: kicad_curl.h:93

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

70 {
71  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_MAJOR_MINOR_VERSION ) );
72  return msg;
73 }
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 GetKicadLockFilePath(), SETTINGS_MANAGER::GetSettingsVersion(), KICAD_MANAGER_FRAME::ProjectChanged(), and COMMON_CONTROL::ShowHelp().

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

63 {
64  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_SEMANTIC_VERSION ) );
65  return msg;
66 }
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 76 of file build_version.cpp.

77 {
78  wxString aMsg;
79  // DO NOT translate information in the msg_version string
80 
81  wxString eol = aHtml ? "<br>" : "\n";
82 
83  // Tabs instead of spaces for the plaintext version for shorter string length
84  wxString indent4 = aHtml ? "&nbsp;&nbsp;&nbsp;&nbsp;" : "\t";
85 
86 #define ON "ON" << eol
87 #define OFF "OFF" << eol
88 
89  wxString version;
90  version << GetBuildVersion()
91 #ifdef DEBUG
92  << ", debug"
93 #else
94  << ", release"
95 #endif
96  << " build";
97 
98  wxPlatformInfo platform;
99  aMsg << "Application: " << aTitle;
100 
101  #if defined( KICAD_BUILD_ARCH_X64 )
102  aMsg << " (64-bit)";
103  #elif defined( KICAD_BUILD_ARCH_X86 )
104  aMsg << " (32-bit)";
105  #elif defined( KICAD_BUILD_ARCH_ARM )
106  aMsg << " (ARM 32-bit)";
107  #elif defined( KICAD_BUILD_ARCH_ARM64 )
108  aMsg << " (ARM 64-bit)";
109  #endif
110 
111  aMsg << eol << eol;
112 
113 
114  aMsg << "Version: " << version << eol << eol;
115  aMsg << "Libraries:" << eol;
116 
117  aMsg << indent4 << wxGetLibraryVersionInfo().GetVersionString() << eol;
118 
119  if( !aBrief )
120  aMsg << indent4 << GetKicadCurlVersion() << eol;
121 
122  aMsg << eol;
123 
124  aMsg << "Platform: " << wxGetOsDescription() << ", "
125 // TODO (ISM): Readd conditional once our wx fork and flatpaks are running released 3.1.5
126 #if 0 && wxCHECK_VERSION( 3, 1, 5 )
127  << platform.GetBitnessName() << ", "
128 #else
129  << platform.GetArchName() << ", "
130 #endif
131  << platform.GetEndiannessName() << ", "
132  << platform.GetPortIdName();
133 
134 #ifdef __WXGTK__
135  aMsg << ", " << wxGetenv( "XDG_SESSION_DESKTOP" )
136  << ", " << wxGetenv( "XDG_SESSION_TYPE" );
137 #endif
138 
139  aMsg << eol << eol;
140 
141  if( !aBrief )
142  {
143  aMsg << "Build Info:" << eol;
144  aMsg << indent4 << "Date: " << GetBuildDate() << eol;
145  }
146 
147  aMsg << indent4 << "wxWidgets: " << wxVERSION_NUM_DOT_STRING << " (";
148  aMsg << __WX_BO_UNICODE __WX_BO_STL __WX_BO_WXWIN_COMPAT_2_8 ")";
149 
150  // Get the GTK+ version where possible.
151 #ifdef __WXGTK__
152  int major, minor;
153 
154  major = wxPlatformInfo().Get().GetToolkitMajorVersion();
155  minor = wxPlatformInfo().Get().GetToolkitMinorVersion();
156  aMsg << " GTK+ " << major << "." << minor;
157 #endif
158 
159  aMsg << eol;
160 
161  aMsg << indent4 << "Boost: " << ( BOOST_VERSION / 100000 ) << wxT( "." )
162  << ( BOOST_VERSION / 100 % 1000 ) << wxT( "." )
163  << ( BOOST_VERSION % 100 ) << eol;
164 
165 #ifdef KICAD_USE_OCC
166  aMsg << indent4 << "OCC: " << OCC_VERSION_COMPLETE << eol;
167 #endif
168 
169 #ifdef KICAD_USE_OCE
170  aMsg << indent4 << "OCE: " << OCC_VERSION_COMPLETE << eol;
171 #endif
172 
173  aMsg << indent4 << "Curl: " << GetCurlLibVersion() << eol;
174 
175 #if defined( KICAD_SPICE )
176 #if defined( NGSPICE_BUILD_VERSION )
177  aMsg << indent4 << "ngspice: " << NGSPICE_BUILD_VERSION << eol;
178 #elif defined( NGSPICE_HAVE_CONFIG_H )
179  #undef HAVE_STRNCASECMP /* is redefined in ngspice/config.h */
180  #include <ngspice/config.h>
181  aMsg << indent4 << "ngspice: " << PACKAGE_VERSION << eol;
182 #else
183  aMsg << indent4 << "ngspice: " << "unknown" << eol;
184 #endif
185 #endif
186 
187  aMsg << indent4 << "Compiler: ";
188 #if defined(__clang__)
189  aMsg << "Clang " << __clang_major__ << "." << __clang_minor__ << "." << __clang_patchlevel__;
190 #elif defined(__GNUG__)
191  aMsg << "GCC " << __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__;
192 #elif defined(_MSC_VER)
193  aMsg << "Visual C++ " << _MSC_VER;
194 #elif defined(__INTEL_COMPILER)
195  aMsg << "Intel C++ " << __INTEL_COMPILER;
196 #else
197  aMsg << "Other Compiler ";
198 #endif
199 
200 #if defined(__GXX_ABI_VERSION)
201  aMsg << " with C++ ABI " << __GXX_ABI_VERSION << eol;
202 #else
203  aMsg << " without C++ ABI" << eol;
204 #endif
205 
206  aMsg << eol;
207 
208  // Add build settings config (build options):
209  aMsg << "Build settings:" << eol;
210 
211  aMsg << indent4 << "KICAD_SCRIPTING=";
212 #ifdef KICAD_SCRIPTING
213  aMsg << ON;
214 #else
215  aMsg << OFF;
216 #endif
217 
218  aMsg << indent4 << "KICAD_SCRIPTING_MODULES=";
219 #ifdef KICAD_SCRIPTING_MODULES
220  aMsg << ON;
221 #else
222  aMsg << OFF;
223 #endif
224 
225  aMsg << indent4 << "KICAD_SCRIPTING_PYTHON3=";
226 #ifdef KICAD_SCRIPTING_PYTHON3
227  aMsg << ON;
228 #else
229  aMsg << OFF;
230 #endif
231 
232  aMsg << indent4 << "KICAD_SCRIPTING_WXPYTHON=";
233 #ifdef KICAD_SCRIPTING_WXPYTHON
234  aMsg << ON;
235 #else
236  aMsg << OFF;
237 #endif
238 
239  aMsg << indent4 << "KICAD_SCRIPTING_WXPYTHON_PHOENIX=";
240 #ifdef KICAD_SCRIPTING_WXPYTHON_PHOENIX
241  aMsg << ON;
242 #else
243  aMsg << OFF;
244 #endif
245 
246  aMsg << indent4 << "KICAD_SCRIPTING_ACTION_MENU=";
247 #ifdef KICAD_SCRIPTING_ACTION_MENU
248  aMsg << ON;
249 #else
250  aMsg << OFF;
251 #endif
252 
253 #ifdef KICAD_USE_OCE
254  aMsg << indent4 << "KICAD_USE_OCE=" << ON;
255 #endif
256 
257 #ifdef KICAD_USE_OCC
258  aMsg << indent4 << "KICAD_USE_OCC=" << ON;
259 #endif
260 
261 #ifdef KICAD_USE_EGL
262  aMsg << indent4 << "KICAD_USE_EGL=" << ON;
263 #endif
264 
265  aMsg << indent4 << "KICAD_SPICE=";
266 #ifdef KICAD_SPICE
267  aMsg << ON;
268 #else
269  aMsg << OFF;
270 #endif
271 
272 #ifndef NDEBUG
273  aMsg << indent4 << "KICAD_STDLIB_DEBUG=";
274 #ifdef KICAD_STDLIB_DEBUG
275  aMsg << ON;
276 #else
277  aMsg << OFF;
278  aMsg << indent4 << "KICAD_STDLIB_LIGHT_DEBUG=";
279 #ifdef KICAD_STDLIB_LIGHT_DEBUG
280  aMsg << ON;
281 #else
282  aMsg << OFF;
283 #endif
284 #endif
285 
286  aMsg << indent4 << "KICAD_SANITIZE_ADDRESS=";
287 #ifdef KICAD_SANITIZE_ADDRESS
288  aMsg << ON;
289 #else
290  aMsg << OFF;
291 #endif
292 
293  aMsg << indent4 << "KICAD_SANITIZE_THREADS=";
294 #ifdef KICAD_SANITIZE_THREADS
295  aMsg << ON;
296 #else
297  aMsg << OFF;
298 #endif
299 #endif
300 
301  return aMsg;
302 }
#define ON
std::string GetCurlLibVersion()
Definition: kicad_curl.cpp:244
wxString GetBuildVersion()
Get the full KiCad version string.
#define OFF
wxString GetBuildDate()
Get the build date as a string.
std::string GetKicadCurlVersion()
Definition: kicad_curl.cpp:239

References GetBuildDate(), GetBuildVersion(), GetCurlLibVersion(), GetKicadCurlVersion(), OFF, and ON.

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