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

61 {
62  wxString msg = wxString::Format( wxT( "%s %s" ), wxT( __DATE__ ), wxT( __TIME__ ) );
63  return msg;
64 }
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 53 of file build_version.cpp.

54 {
55  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_VERSION_FULL ) );
56  return msg;
57 }
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(), 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 74 of file build_version.cpp.

75 {
76  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_MAJOR_MINOR_VERSION ) );
77  return msg;
78 }
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 67 of file build_version.cpp.

68 {
69  wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_SEMANTIC_VERSION ) );
70  return msg;
71 }
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 81 of file build_version.cpp.

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

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

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