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:205

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:205

References Format().

Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONHeader(), WS_DRAW_ITEM_LIST::BuildFullText(), buildKicadAboutBanner(), CreateHeaderInfoData(), EVT_MENU_RANGE(), PCB_EDIT_FRAME::Export_IDF3(), SCH_SEXPR_PLUGIN::Format(), PLACE_FILE_EXPORTER::GenPositionData(), PLACE_FILE_EXPORTER::GenReportData(), GetVersionInfoData(), NETLIST_EXPORTER_GENERIC::makeDesignHeader(), DSN::PARSER::PARSER(), CLIPBOARD_IO::Save(), PCB_IO::Save(), SCH_SEXPR_PLUGIN_CACHE::Save(), CLIPBOARD_IO::SaveSelection(), KICAD_MANAGER_FRAME::SetProjectFileName(), 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 246 of file kicad_curl.cpp.

247 {
248  return LIBCURL_VERSION;
249 }

Referenced by GetVersionInfoData().

◆ GetKicadCurlVersion()

std::string GetKicadCurlVersion ( )

Definition at line 241 of file kicad_curl.cpp.

242 {
243  return KICAD_CURL::GetVersion();
244 }
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:205

References Format().

Referenced by SETTINGS_MANAGER::GetSettingsVersion().

◆ 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:205

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

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

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