Avoid including curl.h in dialog about (including curl.h creates constraints with wxWidgets especially on Windows)

and remove duplicate code.
This commit is contained in:
jean-pierre charras 2017-09-04 12:05:08 +02:00
parent 1fe91e6252
commit 6ea6c7219a
3 changed files with 21 additions and 20 deletions

View File

@ -24,12 +24,16 @@
#include <config.h>
#include <string>
// kicad_curl.h must be included before wx headers, to avoid
// conflicts for some defines, at least on Windows
#ifdef BUILD_GITHUB_PLUGIN
#include <curl/curlver.h>
#include <kicad_curl/kicad_curl.h>
// kicad_curl.h can create conflicts for some defines, at least on Windows
// so we are using here 2 proxy functions to know Curl version to avoid
// including kicad_curl.h to know Curl version
extern std::string GetKicadCurlVersion();
extern std::string GetCurlLibVersion();
#endif
#include <boost/version.hpp>
@ -426,7 +430,7 @@ void DIALOG_ABOUT::buildVersionInfoData( wxString& aMsg, bool aFormatHtml )
aMsg << indent4 << wxGetLibraryVersionInfo().GetVersionString() << eol;
#ifdef BUILD_GITHUB_PLUGIN
aMsg << indent4 << KICAD_CURL::GetVersion() << eol;
aMsg << indent4 << GetKicadCurlVersion() << eol;
#endif
aMsg << "Platform: " << wxGetOsDescription() << ", "
<< platform.GetArchName() << ", "
@ -453,7 +457,7 @@ void DIALOG_ABOUT::buildVersionInfoData( wxString& aMsg, bool aFormatHtml )
<< ( BOOST_VERSION % 100 ) << eol;
#ifdef BUILD_GITHUB_PLUGIN
aMsg << indent4 << "Curl: " << LIBCURL_VERSION << eol;
aMsg << indent4 << "Curl: " << GetCurlLibVersion() << eol;
#endif
aMsg << indent4 << "Compiler: ";

View File

@ -222,3 +222,13 @@ std::string KICAD_CURL::GetSimpleVersion()
return res;
}
std::string GetKicadCurlVersion()
{
return KICAD_CURL::GetVersion();
}
std::string GetCurlLibVersion()
{
return LIBCURL_VERSION;
}

View File

@ -26,25 +26,12 @@
/*
* KICAD_CURL_EASY.h must included before wxWidgets because on Windows,
* wxWidgets ends up including windows.h before winsocks2.h inside curl
* this causes build warnings
* Because we are before wx, we must explicitly define we are building with unicode
* wxWidgets defaults to supporting unicode now, so this should be safe.
* because kicad_curl.h includes curl.h, wxWidgets ends up including windows.h
* before winsocks2.h inside curl and this causes build warnings
*/
#if defined(WIN32)
#ifndef UNICODE
# define UNICODE
#endif
#ifndef _UNICODE
# define _UNICODE
#endif
#endif
#include <string>
#include <curl/curl.h>
#include <kicad_curl/kicad_curl.h>
#include <string>
/**