improve the detection for GCC
This commit is contained in:
parent
21a5e2fc2e
commit
3863a0dc60
@ -20,40 +20,9 @@
|
|||||||
|
|
||||||
#define NANA_WINDOWS 1
|
#define NANA_WINDOWS 1
|
||||||
|
|
||||||
// compilers in Windows...
|
|
||||||
|
|
||||||
// MSVC++ versions
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define _SCL_SECURE_NO_WARNNGS
|
|
||||||
#define _CRT_SECURE_NO_DEPRECATE
|
|
||||||
#pragma warning(disable : 4996)
|
|
||||||
|
|
||||||
#if (_MSC_VER == 1900)
|
|
||||||
// google: break any code that tries to use codecvt<char16_t> or codecvt<char32_t>.
|
|
||||||
// google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support.
|
|
||||||
// google: Those definitions are for codecvt<wchar_t>::id, codecvt<unsigned short>::id and codecvt<char>::id respectively.
|
|
||||||
// However, the codecvt<char16_t>::id and codecvt<char32_t>::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all.
|
|
||||||
// google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources.
|
|
||||||
#define STD_CODECVT_NOT_SUPPORTED
|
|
||||||
#endif // _MSC_VER == 1900
|
|
||||||
#endif // _MSVC
|
|
||||||
|
|
||||||
// MINGW ...
|
// MINGW ...
|
||||||
#if defined(__MINGW32__) || defined(__MINGW64__) || defined(MINGW)
|
#if defined(__MINGW32__) || defined(__MINGW64__) || defined(MINGW)
|
||||||
#define NANA_MINGW
|
#define NANA_MINGW
|
||||||
//#define STD_THREAD_NOT_SUPPORTED // don't works? why? where __GNUC__, etc. are set? by CLion ??
|
|
||||||
//Use this flag if MinGW version is older than 4.8.1
|
|
||||||
#if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2)))
|
|
||||||
// don't works? why? where __GNUC__, etc. are set? by CLion ??
|
|
||||||
// ??
|
|
||||||
#define UNDEFINED_to_string
|
|
||||||
|
|
||||||
// https://github.com/meganz/mingw-std-threads
|
|
||||||
#define STD_THREAD_NOT_SUPPORTED
|
|
||||||
#define USE_github_com_meganz_mingw_std_threads
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // MINGW
|
#endif // MINGW
|
||||||
|
|
||||||
// end Windows
|
// end Windows
|
||||||
@ -85,24 +54,52 @@
|
|||||||
|
|
||||||
// compilers ...
|
// compilers ...
|
||||||
|
|
||||||
// temp
|
// MSVC++ versions
|
||||||
//#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED // don't works?
|
#if defined(_MSC_VER)
|
||||||
//#define STD_CODECVT_NOT_SUPPORTED
|
#define _SCL_SECURE_NO_WARNNGS
|
||||||
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
|
#pragma warning(disable : 4996)
|
||||||
|
|
||||||
// GCC ...
|
#if (_MSC_VER == 1900)
|
||||||
#if defined(__GNU__)
|
// google: break any code that tries to use codecvt<char16_t> or codecvt<char32_t>.
|
||||||
#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ <= 1)
|
// google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support.
|
||||||
// don't works?
|
// google: Those definitions are for codecvt<wchar_t>::id, codecvt<unsigned short>::id and codecvt<char>::id respectively.
|
||||||
|
// However, the codecvt<char16_t>::id and codecvt<char32_t>::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all.
|
||||||
|
// google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources.
|
||||||
|
#define STD_CODECVT_NOT_SUPPORTED
|
||||||
|
#endif // _MSC_VER == 1900
|
||||||
|
#endif // _MSVC
|
||||||
|
|
||||||
//GCC 4.7.0 does not implement the <codecvt> and codecvt_utfx classes ??
|
//GCC
|
||||||
#define STD_CODECVT_NOT_SUPPORTED
|
#if defined(__GNUC__)
|
||||||
|
#if defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
||||||
|
//<codecvt> is a known issue on libstdc++, it works on libc++
|
||||||
|
#define STD_CODECVT_NOT_SUPPORTED
|
||||||
|
#endif
|
||||||
|
|
||||||
//Some functions which are specified in 21.5 Numeric conversions in Strings library have not yet implemented
|
#if (__GNUC__ == 4)
|
||||||
|
#if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1))
|
||||||
|
#define STD_THREAD_NOT_SUPPORTED
|
||||||
|
|
||||||
//Implement workarounds for GCC/MinGW which version is below 4.8.2
|
//boost.thread is preferred
|
||||||
|
//but if USE_github_com_meganz_mingw_std_threads is enabled,
|
||||||
|
//boost.thread will be replaced with meganz's mingw-std-threads.
|
||||||
|
// https://github.com/meganz/mingw-std-threads
|
||||||
|
//#define USE_github_com_meganz_mingw_std_threads
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(NANA_MINGW)
|
||||||
|
//It's a known issue under MinGW
|
||||||
#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
|
#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
#endif // GCC
|
|
||||||
|
#if ((__GNUC_MINOR__ < 8) || defined(NANA_MINGW))
|
||||||
|
#define STD_TO_STRING_NOT_SUPPORTED
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// End compilers ...
|
// End compilers ...
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -56,8 +56,23 @@ namespace std
|
|||||||
//Workaround for no implemenation of std::stoull in MinGW.
|
//Workaround for no implemenation of std::stoull in MinGW.
|
||||||
unsigned long long stoull(const std::string&, std::size_t* pos = nullptr, int base = 10);
|
unsigned long long stoull(const std::string&, std::size_t* pos = nullptr, int base = 10);
|
||||||
unsigned long long stoull(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
|
unsigned long long stoull(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
|
||||||
|
}
|
||||||
|
#endif //STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
|
||||||
|
|
||||||
|
#ifdef STD_TO_STRING_NOT_SUPPORTED
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
//Workaround for no implemenation of std::to_string/std::to_wstring in MinGW.
|
||||||
|
std::string to_string(long double);
|
||||||
|
std::string to_string(double);
|
||||||
|
std::string to_string(unsigned);
|
||||||
|
std::string to_string(int);
|
||||||
|
std::string to_string(long);
|
||||||
|
std::string to_string(unsigned long);
|
||||||
|
std::string to_string(long long);
|
||||||
|
std::string to_string(unsigned long long);
|
||||||
|
std::string to_string(float);
|
||||||
|
|
||||||
//Workaround for no implemenation of std::to_wstring in MinGW.
|
|
||||||
std::wstring to_wstring(long double);
|
std::wstring to_wstring(long double);
|
||||||
std::wstring to_wstring(double);
|
std::wstring to_wstring(double);
|
||||||
std::wstring to_wstring(unsigned);
|
std::wstring to_wstring(unsigned);
|
||||||
|
|||||||
@ -294,6 +294,74 @@ namespace std
|
|||||||
*pos = (std::size_t)(end - ptr);
|
*pos = (std::size_t)(end - ptr);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
}//end namespace std
|
||||||
|
#endif //STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
|
||||||
|
|
||||||
|
#ifdef STD_TO_STRING_NOT_SUPPORTED
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
std::string to_string(double v)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << v;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(long double v)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << v;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(unsigned v)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << v;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(int v)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << v;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(long v)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << v;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(unsigned long v)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << v;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(long long v)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << v;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(unsigned long long v)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << v;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string to_string(float v)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << v;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
std::wstring to_wstring(double v)
|
std::wstring to_wstring(double v)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -468,8 +468,8 @@ namespace detail
|
|||||||
arg.right_button = ((Button2Mask & mask_state) != 0) || (::nana::mouse::right_button == arg.button);
|
arg.right_button = ((Button2Mask & mask_state) != 0) || (::nana::mouse::right_button == arg.button);
|
||||||
arg.mid_button = ((Button3Mask & mask_state) != 0) || (::nana::mouse::middle_button == arg.button);
|
arg.mid_button = ((Button3Mask & mask_state) != 0) || (::nana::mouse::middle_button == arg.button);
|
||||||
arg.alt = ((Mod1Mask & mask_state) != 0);
|
arg.alt = ((Mod1Mask & mask_state) != 0);
|
||||||
arg.shift = £¨(ShiftMask & mask_state) != 0);
|
arg.shift = ((ShiftMask & mask_state) != 0);
|
||||||
arg.ctrl = £¨(ControlMask & mask_state) != 0);
|
arg.ctrl = ((ControlMask & mask_state) != 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -833,7 +833,7 @@ namespace detail
|
|||||||
msgwnd->flags.action = mouse_action::over;
|
msgwnd->flags.action = mouse_action::over;
|
||||||
|
|
||||||
click_arg.window_handle = reinterpret_cast<window>(msgwnd);
|
click_arg.window_handle = reinterpret_cast<window>(msgwnd);
|
||||||
emit_drawer(&drawer::click, msgwnd, arg, &context);
|
emit_drawer(&drawer::click, msgwnd, click_arg, &context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <nana/deploy.hpp>
|
||||||
#include <nana/gui/place.hpp>
|
#include <nana/gui/place.hpp>
|
||||||
#include <nana/gui/programming_interface.hpp>
|
#include <nana/gui/programming_interface.hpp>
|
||||||
#include <nana/gui/widgets/label.hpp>
|
#include <nana/gui/widgets/label.hpp>
|
||||||
@ -95,13 +96,7 @@ namespace nana
|
|||||||
|
|
||||||
std::string pos_str() const
|
std::string pos_str() const
|
||||||
{
|
{
|
||||||
#ifdef UNDEFINED_to_string
|
|
||||||
std::stringstream ss;
|
|
||||||
ss<<pos();
|
|
||||||
return ss.str();
|
|
||||||
#else
|
|
||||||
return std::to_string(pos());
|
return std::to_string(pos());
|
||||||
#endif // UNDEFINED_to_string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
token read()
|
token read()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user