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

57 {
58  wxString msg = wxString::Format( wxT( "%s %s" ), wxT( __DATE__ ), wxT( __TIME__ ) );
59  return msg;
60 }
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 49 of file build_version.cpp.

50 {
51  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_VERSION_FULL ) );
52  return msg;
53 }
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(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

◆ GetCurlLibVersion()

std::string GetCurlLibVersion ( )

Definition at line 140 of file kicad_curl.cpp.

141 {
142  return LIBCURL_VERSION;
143 }

Referenced by GetVersionInfoData().

◆ GetKicadCurlVersion()

std::string GetKicadCurlVersion ( )

Definition at line 135 of file kicad_curl.cpp.

136 {
137  return KICAD_CURL::GetVersion();
138 }
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 70 of file build_version.cpp.

71 {
72  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_MAJOR_MINOR_VERSION ) );
73  return msg;
74 }
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 63 of file build_version.cpp.

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

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

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

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