Browse Source

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

and remove duplicate code.
pull/7/merge
jean-pierre charras 8 years ago
parent
commit
6ea6c7219a
  1. 12
      common/dialog_about/dialog_about.cpp
  2. 10
      common/kicad_curl/kicad_curl.cpp
  3. 19
      include/kicad_curl/kicad_curl_easy.h

12
common/dialog_about/dialog_about.cpp

@ -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: ";

10
common/kicad_curl/kicad_curl.cpp

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

19
include/kicad_curl/kicad_curl_easy.h

@ -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>
/**

Loading…
Cancel
Save