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)
Function Format outputs 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)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format().

Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONHeader(), WS_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)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format().

Referenced by GetKicadLockFilePath(), SETTINGS_MANAGER::GetSettingsVersion(), and KICAD_MANAGER_FRAME::ProjectChanged().

◆ 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)
Function Format outputs 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 << eol << eol;
100  aMsg << "Version: " << version << eol << eol;
101  aMsg << "Libraries:" << eol;
102 
103  aMsg << indent4 << wxGetLibraryVersionInfo().GetVersionString() << eol;
104 
105  if( !aBrief )
106  aMsg << indent4 << GetKicadCurlVersion() << eol;
107 
108  aMsg << eol;
109 
110  aMsg << "Platform: " << wxGetOsDescription() << ", "
111  << platform.GetArchName() << ", "
112  << platform.GetEndiannessName() << ", "
113  << platform.GetPortIdName();
114 
115 #ifdef __WXGTK__
116  aMsg << ", " << wxGetenv( "XDG_SESSION_DESKTOP" )
117  << ", " << wxGetenv( "XDG_SESSION_TYPE" );
118 #endif
119 
120  aMsg << eol << eol;
121 
122  if( !aBrief )
123  {
124  aMsg << "Build Info:" << eol;
125  aMsg << indent4 << "Date: " << GetBuildDate() << eol;
126  }
127 
128  aMsg << indent4 << "wxWidgets: " << wxVERSION_NUM_DOT_STRING << " (";
129  aMsg << __WX_BO_UNICODE __WX_BO_STL __WX_BO_WXWIN_COMPAT_2_8 ")";
130 
131  // Get the GTK+ version where possible.
132 #ifdef __WXGTK__
133  int major, minor;
134 
135  major = wxPlatformInfo().Get().GetToolkitMajorVersion();
136  minor = wxPlatformInfo().Get().GetToolkitMinorVersion();
137  aMsg << " GTK+ " << major << "." << minor;
138 #endif
139 
140  aMsg << eol;
141 
142  aMsg << indent4 << "Boost: " << ( BOOST_VERSION / 100000 ) << wxT( "." )
143  << ( BOOST_VERSION / 100 % 1000 ) << wxT( "." )
144  << ( BOOST_VERSION % 100 ) << eol;
145 
146 #ifdef KICAD_USE_OCC
147  aMsg << indent4 << "OCC: " << OCC_VERSION_COMPLETE << eol;
148 #endif
149 
150 #ifdef KICAD_USE_OCE
151  aMsg << indent4 << "OCE: " << OCC_VERSION_COMPLETE << eol;
152 #endif
153 
154  aMsg << indent4 << "Curl: " << GetCurlLibVersion() << eol;
155 
156 #if defined( KICAD_SPICE )
157 #if defined( NGSPICE_BUILD_VERSION )
158  aMsg << indent4 << "ngspice: " << NGSPICE_BUILD_VERSION << eol;
159 #elif defined( NGSPICE_HAVE_CONFIG_H )
160  #undef HAVE_STRNCASECMP /* is redefined in ngspice/config.h */
161  #include <ngspice/config.h>
162  aMsg << indent4 << "ngspice: " << PACKAGE_VERSION << eol;
163 #else
164  aMsg << indent4 << "ngspice: " << "unknown" << eol;
165 #endif
166 #endif
167 
168  aMsg << indent4 << "Compiler: ";
169 #if defined(__clang__)
170  aMsg << "Clang " << __clang_major__ << "." << __clang_minor__ << "." << __clang_patchlevel__;
171 #elif defined(__GNUG__)
172  aMsg << "GCC " << __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__;
173 #elif defined(_MSC_VER)
174  aMsg << "Visual C++ " << _MSC_VER;
175 #elif defined(__INTEL_COMPILER)
176  aMsg << "Intel C++ " << __INTEL_COMPILER;
177 #else
178  aMsg << "Other Compiler ";
179 #endif
180 
181 #if defined(__GXX_ABI_VERSION)
182  aMsg << " with C++ ABI " << __GXX_ABI_VERSION << eol;
183 #else
184  aMsg << " without C++ ABI" << eol;
185 #endif
186 
187  aMsg << eol;
188 
189  // Add build settings config (build options):
190  aMsg << "Build settings:" << eol;
191 
192  aMsg << indent4 << "KICAD_SCRIPTING=";
193 #ifdef KICAD_SCRIPTING
194  aMsg << ON;
195 #else
196  aMsg << OFF;
197 #endif
198 
199  aMsg << indent4 << "KICAD_SCRIPTING_MODULES=";
200 #ifdef KICAD_SCRIPTING_MODULES
201  aMsg << ON;
202 #else
203  aMsg << OFF;
204 #endif
205 
206  aMsg << indent4 << "KICAD_SCRIPTING_PYTHON3=";
207 #ifdef KICAD_SCRIPTING_PYTHON3
208  aMsg << ON;
209 #else
210  aMsg << OFF;
211 #endif
212 
213  aMsg << indent4 << "KICAD_SCRIPTING_WXPYTHON=";
214 #ifdef KICAD_SCRIPTING_WXPYTHON
215  aMsg << ON;
216 #else
217  aMsg << OFF;
218 #endif
219 
220  aMsg << indent4 << "KICAD_SCRIPTING_WXPYTHON_PHOENIX=";
221 #ifdef KICAD_SCRIPTING_WXPYTHON_PHOENIX
222  aMsg << ON;
223 #else
224  aMsg << OFF;
225 #endif
226 
227  aMsg << indent4 << "KICAD_SCRIPTING_ACTION_MENU=";
228 #ifdef KICAD_SCRIPTING_ACTION_MENU
229  aMsg << ON;
230 #else
231  aMsg << OFF;
232 #endif
233 
234 #ifdef KICAD_USE_OCE
235  aMsg << indent4 << "KICAD_USE_OCE=" << ON;
236 #endif
237 
238 #ifdef KICAD_USE_OCC
239  aMsg << indent4 << "KICAD_USE_OCC=" << ON;
240 #endif
241 
242 #ifdef KICAD_USE_EGL
243  aMsg << indent4 << "KICAD_USE_EGL=" << ON;
244 #endif
245 
246  aMsg << indent4 << "KICAD_SPICE=";
247 #ifdef KICAD_SPICE
248  aMsg << ON;
249 #else
250  aMsg << OFF;
251 #endif
252 
253 #ifndef NDEBUG
254  aMsg << indent4 << "KICAD_STDLIB_DEBUG=";
255 #ifdef KICAD_STDLIB_DEBUG
256  aMsg << ON;
257 #else
258  aMsg << OFF;
259  aMsg << indent4 << "KICAD_STDLIB_LIGHT_DEBUG=";
260 #ifdef KICAD_STDLIB_LIGHT_DEBUG
261  aMsg << ON;
262 #else
263  aMsg << OFF;
264 #endif
265 #endif
266 
267  aMsg << indent4 << "KICAD_SANITIZE=";
268 #ifdef KICAD_SANITIZE
269  aMsg << ON;
270 #else
271  aMsg << OFF;
272 #endif
273 #endif
274 
275  return aMsg;
276 }
#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().