Cog/Frameworks/OpenMPT/OpenMPT/common/mptBaseMacros.h
Christopher Snowhill 731e52c440 Build libOpenMPT from source once again
Bundle libOpenMPT as a dynamic framework, which should be safe once
again, now that there is only one version to bundle. Also, now it is
using the versions of libvorbisfile and libmpg123 that are bundled with
the player, instead of compiling minimp3 and stbvorbis.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-30 22:57:30 -07:00

66 lines
1.8 KiB
C++

/*
* mptBaseMacros.h
* ---------------
* Purpose: Basic assorted compiler-related helpers.
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "openmpt/all/BuildSettings.hpp"
#include "mpt/base/preprocessor.hpp"
#include "mpt/base/compiletime_warning.hpp"
#include "mpt/base/macros.hpp"
#if MPT_CXX_AT_LEAST(20)
#include <version>
#else // !C++20
#include <array>
#endif // C++20
#include <array>
#include <iterator>
#include <type_traits>
#include <cstddef>
#include <cstdint>
#include <stddef.h>
#include <stdint.h>
OPENMPT_NAMESPACE_BEGIN
#define MPT_UNREFERENCED_PARAMETER(x) MPT_UNUSED(x)
#define MPT_UNUSED_VARIABLE(x) MPT_UNUSED(x)
#if MPT_COMPILER_MSVC
// warning LNK4221: no public symbols found; archive member will be inaccessible
// There is no way to selectively disable linker warnings.
// #pragma warning does not apply and a command line option does not exist.
// Some options:
// 1. Macro which generates a variable with a unique name for each file (which means we have to pass the filename to the macro)
// 2. unnamed namespace containing any symbol (does not work for c++11 compilers because they actually have internal linkage now)
// 3. An unused trivial inline function.
// Option 3 does not actually solve the problem though, which leaves us with option 1.
// In any case, for optimized builds, the linker will just remove the useless symbol.
#define MPT_MSVC_WORKAROUND_LNK4221_CONCAT_DETAIL(x,y) x##y
#define MPT_MSVC_WORKAROUND_LNK4221_CONCAT(x,y) MPT_MSVC_WORKAROUND_LNK4221_CONCAT_DETAIL(x,y)
#define MPT_MSVC_WORKAROUND_LNK4221(x) int MPT_MSVC_WORKAROUND_LNK4221_CONCAT(mpt_msvc_workaround_lnk4221_,x) = 0;
#endif
#ifndef MPT_MSVC_WORKAROUND_LNK4221
#define MPT_MSVC_WORKAROUND_LNK4221(x)
#endif
OPENMPT_NAMESPACE_END