KiCad PCB EDA Suite
build_version.cpp File Reference
#include <fctsys.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 54 of file build_version.cpp.

55 {
56  wxString msg = wxString::Format( wxT( "%s %s" ), wxT( __DATE__ ), wxT( __TIME__ ) );
57  return msg;
58 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201

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

48 {
49  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_VERSION_FULL ) );
50  return msg;
51 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201

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_GENERIC::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 68 of file build_version.cpp.

69 {
70  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_MAJOR_MINOR_VERSION ) );
71  return msg;
72 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201

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

62 {
63  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_SEMANTIC_VERSION ) );
64  return msg;
65 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201

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

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