Skip to content

Commit

Permalink
[Imp] mpt/base/detect_libc.hpp: Detect different generations of Micro…
Browse files Browse the repository at this point in the history
…soft's C library.

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22036 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
manxorist committed Oct 31, 2024
1 parent 7ca68cc commit 03c9a61
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/mpt/base/detect_libc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@
#define MPT_LIBC_GENERIC 1
#elif (defined(__MINGW32__) || defined(__MINGW64__))
#define MPT_LIBC_MINGW 1
#if defined(_UCRT)
#define MPT_LIBC_MINGW_UCRT 1
#elif defined(__MSVCRT__)
#define MPT_LIBC_MINGW_MSVCRT 1
#elif defined(__CRTDLL__)
#define MPT_LIBC_MINGW_CRTDLL 1
#endif
#elif (defined(__GLIBC__) || defined(__GNU_LIBRARY__))
#define MPT_LIBC_GLIBC 1
#elif defined(_UCRT)
#define MPT_LIBC_MS 1
#define MPT_LIBC_MS_UCRT 1
#elif MPT_COMPILER_MSVC
#define MPT_LIBC_MS 1
#define MPT_LIBC_MS_MSVCRT 1
#elif MPT_COMPILER_CLANG && MPT_OS_WINDOWS
#define MPT_LIBC_MS 1
#elif defined(__BIONIC__)
Expand All @@ -44,9 +53,24 @@
#ifndef MPT_LIBC_MINGW
#define MPT_LIBC_MINGW 0
#endif
#ifndef MPT_LIBC_MINGW_UCRT
#define MPT_LIBC_MINGW_UCRT 0
#endif
#ifndef MPT_LIBC_MINGW_MSVCRT
#define MPT_LIBC_MINGW_MSVCRT 0
#endif
#ifndef MPT_LIBC_MINGW_CRTDLL
#define MPT_LIBC_MINGW_CRTDLL 0
#endif
#ifndef MPT_LIBC_MS
#define MPT_LIBC_MS 0
#endif
#ifndef MPT_LIBC_MS_UCRT
#define MPT_LIBC_MS_UCRT 0
#endif
#ifndef MPT_LIBC_MS_MSVCRT
#define MPT_LIBC_MS_MSVCRT 0
#endif
#ifndef MPT_LIBC_BIONIC
#define MPT_LIBC_BIONIC 0
#endif
Expand Down
50 changes: 50 additions & 0 deletions src/mpt/base/namespace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,47 @@
#if MPT_LIBC_GENERIC
#define MPT_VERSION_ABI_LIBC _
#elif MPT_LIBC_MS
#if MPT_LIBC_MS_UCRT
#if MPT_LIBC_MS_SHARED
#ifdef MPT_LIBC_MS_DEBUG
#define MPT_VERSION_ABI_LIBC UMDd
#else
#define MPT_VERSION_ABI_LIBC UMDr
#endif
#elif MPT_LIBC_MS_STATIC
#ifdef MPT_LIBC_MS_DEBUG
#define MPT_VERSION_ABI_LIBC UMTd
#else
#define MPT_VERSION_ABI_LIBC UMTr
#endif
#else
#ifdef MPT_LIBC_MS_DEBUG
#define MPT_VERSION_ABI_LIBC UMd
#else
#define MPT_VERSION_ABI_LIBC UMr
#endif
#endif
#elif MPT_LIBC_MS_MSVCRT
#if MPT_LIBC_MS_SHARED
#ifdef MPT_LIBC_MS_DEBUG
#define MPT_VERSION_ABI_LIBC MMDd
#else
#define MPT_VERSION_ABI_LIBC MMDr
#endif
#elif MPT_LIBC_MS_STATIC
#ifdef MPT_LIBC_MS_DEBUG
#define MPT_VERSION_ABI_LIBC MMTd
#else
#define MPT_VERSION_ABI_LIBC MMTr
#endif
#else
#ifdef MPT_LIBC_MS_DEBUG
#define MPT_VERSION_ABI_LIBC MMd
#else
#define MPT_VERSION_ABI_LIBC MMr
#endif
#endif
#else
#if MPT_LIBC_MS_SHARED
#ifdef MPT_LIBC_MS_DEBUG
#define MPT_VERSION_ABI_LIBC MDd
Expand All @@ -50,10 +91,19 @@
#define MPT_VERSION_ABI_LIBC Mr
#endif
#endif
#endif
#elif MPT_LIBC_GLIBC
#define MPT_VERSION_ABI_LIBC G
#elif MPT_LIBC_MINGW
#if MPT_LIBC_MINGW_UCRT
#define MPT_VERSION_ABI_LIBC MWU
#elif MPT_LIBC_MINGW_MSVCRT
#define MPT_VERSION_ABI_LIBC MWM
#elif MPT_LIBC_MINGW_CRTDLL
#define MPT_VERSION_ABI_LIBC MWC
#else
#define MPT_VERSION_ABI_LIBC MW
#endif
#elif MPT_LIBC_BIONIC
#define MPT_VERSION_ABI_LIBC B
#elif MPT_LIBC_APPLE
Expand Down

0 comments on commit 03c9a61

Please sign in to comment.