Add wxMSVC_VERSION_ABI_COMPAT

This symbol can be predefined to use the libraries built with "vc14x" as
the compiler prefix. This can be useful to reuse the same binaries for
all ABI-compatible VC 14.x versions: 14.0 (MSVS 2015), 14.1 (2017) and
14.2 (2019).
This commit is contained in:
Vadim Zeitlin
2019-09-29 22:59:50 +02:00
parent dc50646ae4
commit 8d2b2c0f56
2 changed files with 28 additions and 8 deletions

View File

@@ -226,7 +226,12 @@ vc140 <em>before</em> include @c wx/setup.h file, i.e. typically in the MSVS
project options. Alternatively, you can predefine @c wxMSVC_VERSION_AUTO symbol project options. Alternatively, you can predefine @c wxMSVC_VERSION_AUTO symbol
(without any value), which means that the appropriate compiler version should (without any value), which means that the appropriate compiler version should
be used automatically, e.g. "vc100" for VC 10 (MSVS 2010), "vc140" for VC 14 be used automatically, e.g. "vc100" for VC 10 (MSVS 2010), "vc140" for VC 14
(MSVS 2015) etc. (MSVS 2015) etc. Additionally, VC 14 is a special case as it has 3 minor
versions: VC 14.0, 14.1 and 14.2, corresponding to MSVS 2015, 2017 and 2019;
that are ABI-compatible with each other. Due to this, it can also be useful to
reuse the single build of wxWidgets with all versions of the compiler and this
is supported if @c wxMSVC_VERSION_ABI_COMPAT is defined: the compiler prefix
"vc14x" is used in this case.
If the makefiles have been used to build the libraries from source and the @c CFG If the makefiles have been used to build the libraries from source and the @c CFG
variable has been set to specify a different output path for that particular variable has been set to specify a different output path for that particular

View File

@@ -44,9 +44,16 @@
// COMPILER_PREFIX=vcXX and in this case you may want to either predefine // COMPILER_PREFIX=vcXX and in this case you may want to either predefine
// wxMSVC_VERSION as "XX" or define wxMSVC_VERSION_AUTO to use the appropriate // wxMSVC_VERSION as "XX" or define wxMSVC_VERSION_AUTO to use the appropriate
// version depending on the compiler used // version depending on the compiler used
//
// There is an additional complication with MSVC 14.0, 14.1 and 14.2 versions
// (a.k.a. MSVS 2015, 2017 and 2019): as they're all ABI-compatible with each
// other, it is convenient to use the same "vc14x" compiler prefix for all of
// them, but this is not how wxMSVC_VERSION_AUTO behaves by default, so you
// need to additionally define wxMSVC_VERSION_ABI_COMPAT to opt in into using
// this "vc14x" prefix.
#ifdef wxMSVC_VERSION #ifdef wxMSVC_VERSION
#define wxCOMPILER_PREFIX wxCONCAT(vc, wxMSVC_VERSION) #define wxCOMPILER_PREFIX wxCONCAT(vc, wxMSVC_VERSION)
#elif defined(wxMSVC_VERSION_AUTO) #elif defined(wxMSVC_VERSION_AUTO) || defined(wxMSVC_VERSION_ABI_COMPAT)
#if _MSC_VER == 1200 #if _MSC_VER == 1200
#define wxCOMPILER_PREFIX vc60 #define wxCOMPILER_PREFIX vc60
#elif _MSC_VER == 1300 #elif _MSC_VER == 1300
@@ -63,12 +70,20 @@
#define wxCOMPILER_PREFIX vc110 #define wxCOMPILER_PREFIX vc110
#elif _MSC_VER == 1800 #elif _MSC_VER == 1800
#define wxCOMPILER_PREFIX vc120 #define wxCOMPILER_PREFIX vc120
#elif _MSC_VER == 1900 #elif _MSC_VER >= 1900 && _MSC_VER < 2000
#define wxCOMPILER_PREFIX vc140 #ifdef wxMSVC_VERSION_ABI_COMPAT
#elif _MSC_VER >= 1910 && _MSC_VER < 1920 #define wxCOMPILER_PREFIX vc14x
#define wxCOMPILER_PREFIX vc141 #else
#elif _MSC_VER >= 1920 && _MSC_VER < 2000 #if _MSC_VER < 1910
#define wxCOMPILER_PREFIX vc142 #define wxCOMPILER_PREFIX vc140
#elif _MSC_VER >= 1910 && _MSC_VER < 1920
#define wxCOMPILER_PREFIX vc141
#elif _MSC_VER >= 1920 && _MSC_VER < 2000
#define wxCOMPILER_PREFIX vc142
#else
#error "Unknown MSVC 14.x compiler version, please report to wx-dev."
#endif
#endif
#else #else
#error "Unknown MSVC compiler version, please report to wx-dev." #error "Unknown MSVC compiler version, please report to wx-dev."
#endif #endif