You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
7.2 KiB

16 years ago
16 years ago
16 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. // Date for KiCad build version
  25. #include <wx/wx.h>
  26. #include <config.h>
  27. #include <boost/version.hpp>
  28. // kicad_curl.h must be included before wx headers, to avoid
  29. // conflicts for some defines, at least on Windows
  30. // kicad_curl.h can create conflicts for some defines, at least on Windows
  31. // so we are using here 2 proxy functions to know Curl version to avoid
  32. // including kicad_curl.h to know Curl version
  33. extern std::string GetKicadCurlVersion();
  34. extern std::string GetCurlLibVersion();
  35. #if defined( KICAD_USE_OCC ) | defined( KICAD_USE_OCE )
  36. #include <Standard_Version.hxx>
  37. #endif
  38. // The include file version.h is always created even if the repo version cannot be
  39. // determined. In this case KICAD_VERSION_FULL will default to the KICAD_VERSION
  40. // that is set in KiCadVersion.cmake.
  41. #include <kicad_build_version.h>
  42. wxString GetBuildVersion()
  43. {
  44. wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_VERSION_FULL ) );
  45. return msg;
  46. }
  47. wxString GetBuildDate()
  48. {
  49. wxString msg = wxString::Format( wxT( "%s %s" ), wxT( __DATE__ ), wxT( __TIME__ ) );
  50. return msg;
  51. }
  52. wxString GetSemanticVersion()
  53. {
  54. wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_SEMANTIC_VERSION ) );
  55. return msg;
  56. }
  57. wxString GetMajorMinorVersion()
  58. {
  59. wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_MAJOR_MINOR_VERSION ) );
  60. return msg;
  61. }
  62. wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
  63. {
  64. wxString aMsg;
  65. // DO NOT translate information in the msg_version string
  66. wxString eol = aHtml ? "<br>" : "\n";
  67. // Tabs instead of spaces for the plaintext version for shorter string length
  68. wxString indent4 = aHtml ? "&nbsp;&nbsp;&nbsp;&nbsp;" : "\t";
  69. #define ON "ON" << eol
  70. #define OFF "OFF" << eol
  71. wxString version;
  72. version << GetBuildVersion()
  73. #ifdef DEBUG
  74. << ", debug"
  75. #else
  76. << ", release"
  77. #endif
  78. << " build";
  79. wxPlatformInfo platform;
  80. aMsg << "Application: " << aTitle << eol << eol;
  81. aMsg << "Version: " << version << eol << eol;
  82. aMsg << "Libraries:" << eol;
  83. aMsg << indent4 << wxGetLibraryVersionInfo().GetVersionString() << eol;
  84. if( !aBrief )
  85. aMsg << indent4 << GetKicadCurlVersion() << eol;
  86. aMsg << eol;
  87. aMsg << "Platform: " << wxGetOsDescription() << ", "
  88. << platform.GetArchName() << ", "
  89. << platform.GetEndiannessName() << ", "
  90. << platform.GetPortIdName();
  91. #ifdef __WXGTK__
  92. aMsg << ", " << wxGetenv( "XDG_SESSION_DESKTOP" )
  93. << ", " << wxGetenv( "XDG_SESSION_TYPE" );
  94. #endif
  95. aMsg << eol << eol;
  96. if( !aBrief )
  97. aMsg << "Build Info:" << eol;
  98. if( !aBrief )
  99. aMsg << indent4 << "Date: " << GetBuildDate() << eol;
  100. aMsg << indent4 << "wxWidgets: " << wxVERSION_NUM_DOT_STRING << " (";
  101. aMsg << __WX_BO_UNICODE __WX_BO_STL __WX_BO_WXWIN_COMPAT_2_8 ")";
  102. // Get the GTK+ version where possible.
  103. #ifdef __WXGTK__
  104. int major, minor;
  105. major = wxPlatformInfo().Get().GetToolkitMajorVersion();
  106. minor = wxPlatformInfo().Get().GetToolkitMinorVersion();
  107. aMsg << " GTK+ " << major << "." << minor;
  108. #endif
  109. aMsg << eol;
  110. aMsg << indent4 << "Boost: " << ( BOOST_VERSION / 100000 ) << wxT( "." )
  111. << ( BOOST_VERSION / 100 % 1000 ) << wxT( "." )
  112. << ( BOOST_VERSION % 100 ) << eol;
  113. #ifdef KICAD_USE_OCC
  114. aMsg << indent4 << "OCC: " << OCC_VERSION_COMPLETE << eol;
  115. #endif
  116. #ifdef KICAD_USE_OCE
  117. aMsg << indent4 << "OCE: " << OCC_VERSION_COMPLETE << eol;
  118. #endif
  119. aMsg << indent4 << "Curl: " << GetCurlLibVersion() << eol;
  120. #if defined( KICAD_SPICE )
  121. #if defined( NGSPICE_BUILD_VERSION )
  122. aMsg << indent4 << "ngspice: " << NGSPICE_BUILD_VERSION << eol;
  123. #elif defined( NGSPICE_HAVE_CONFIG_H )
  124. #undef HAVE_STRNCASECMP /* is redefined in ngspice/config.h */
  125. #include <ngspice/config.h>
  126. aMsg << indent4 << "ngspice: " << PACKAGE_VERSION << eol;
  127. #else
  128. aMsg << indent4 << "ngspice: " << "unknown" << eol;
  129. #endif
  130. #endif
  131. aMsg << indent4 << "Compiler: ";
  132. #if defined(__clang__)
  133. aMsg << "Clang " << __clang_major__ << "." << __clang_minor__ << "." << __clang_patchlevel__;
  134. #elif defined(__GNUG__)
  135. aMsg << "GCC " << __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__;
  136. #elif defined(_MSC_VER)
  137. aMsg << "Visual C++ " << _MSC_VER;
  138. #elif defined(__INTEL_COMPILER)
  139. aMsg << "Intel C++ " << __INTEL_COMPILER;
  140. #else
  141. aMsg << "Other Compiler ";
  142. #endif
  143. #if defined(__GXX_ABI_VERSION)
  144. aMsg << " with C++ ABI " << __GXX_ABI_VERSION << eol;
  145. #else
  146. aMsg << " without C++ ABI" << eol;
  147. #endif
  148. aMsg << eol;
  149. // Add build settings config (build options):
  150. aMsg << "Build settings:" << eol;
  151. aMsg << indent4 << "KICAD_SCRIPTING=";
  152. #ifdef KICAD_SCRIPTING
  153. aMsg << ON;
  154. #else
  155. aMsg << OFF;
  156. #endif
  157. aMsg << indent4 << "KICAD_SCRIPTING_MODULES=";
  158. #ifdef KICAD_SCRIPTING_MODULES
  159. aMsg << ON;
  160. #else
  161. aMsg << OFF;
  162. #endif
  163. aMsg << indent4 << "KICAD_SCRIPTING_PYTHON3=";
  164. #ifdef KICAD_SCRIPTING_PYTHON3
  165. aMsg << ON;
  166. #else
  167. aMsg << OFF;
  168. #endif
  169. aMsg << indent4 << "KICAD_SCRIPTING_WXPYTHON=";
  170. #ifdef KICAD_SCRIPTING_WXPYTHON
  171. aMsg << ON;
  172. #else
  173. aMsg << OFF;
  174. #endif
  175. aMsg << indent4 << "KICAD_SCRIPTING_WXPYTHON_PHOENIX=";
  176. #ifdef KICAD_SCRIPTING_WXPYTHON_PHOENIX
  177. aMsg << ON;
  178. #else
  179. aMsg << OFF;
  180. #endif
  181. aMsg << indent4 << "KICAD_SCRIPTING_ACTION_MENU=";
  182. #ifdef KICAD_SCRIPTING_ACTION_MENU
  183. aMsg << ON;
  184. #else
  185. aMsg << OFF;
  186. #endif
  187. aMsg << indent4 << "BUILD_GITHUB_PLUGIN=";
  188. #ifdef BUILD_GITHUB_PLUGIN
  189. aMsg << ON;
  190. #else
  191. aMsg << OFF;
  192. #endif
  193. #ifdef KICAD_USE_OCE
  194. aMsg << indent4 << "KICAD_USE_OCE=" << ON;
  195. #endif
  196. #ifdef KICAD_USE_OCC
  197. aMsg << indent4 << "KICAD_USE_OCC=" << ON;
  198. #endif
  199. aMsg << indent4 << "KICAD_SPICE=";
  200. #ifdef KICAD_SPICE
  201. aMsg << ON;
  202. #else
  203. aMsg << OFF;
  204. #endif
  205. #ifndef NDEBUG
  206. aMsg << indent4 << "KICAD_STDLIB_DEBUG=";
  207. #ifdef KICAD_STDLIB_DEBUG
  208. aMsg << ON;
  209. #else
  210. aMsg << OFF;
  211. aMsg << indent4 << "KICAD_STDLIB_LIGHT_DEBUG=";
  212. #ifdef KICAD_STDLIB_LIGHT_DEBUG
  213. aMsg << ON;
  214. #else
  215. aMsg << OFF;
  216. #endif
  217. #endif
  218. aMsg << indent4 << "KICAD_SANITIZE=";
  219. #ifdef KICAD_SANITIZE
  220. aMsg << ON;
  221. #else
  222. aMsg << OFF;
  223. #endif
  224. #endif
  225. return aMsg;
  226. }