2021-09-15 15:24:47 +08:00
|
|
|
// sol2
|
|
|
|
|
|
|
|
// The MIT License (MIT)
|
|
|
|
|
|
|
|
// Copyright (c) 2013-2021 Rapptz, ThePhD and contributors
|
|
|
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
|
// this software and associated documentation files (the "Software"), to deal in
|
|
|
|
// the Software without restriction, including without limitation the rights to
|
|
|
|
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
|
|
// the Software, and to permit persons to whom the Software is furnished to do so,
|
|
|
|
// subject to the following conditions:
|
|
|
|
|
|
|
|
// The above copyright notice and this permission notice shall be included in all
|
|
|
|
// copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
|
|
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
|
|
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifndef SOL_DETAIL_BUILD_VERSION_HPP
|
|
|
|
#define SOL_DETAIL_BUILD_VERSION_HPP
|
|
|
|
|
|
|
|
#include <sol/version.hpp>
|
|
|
|
|
|
|
|
// clang-format off
|
|
|
|
|
|
|
|
#if defined(SOL_DLL)
|
|
|
|
#if (SOL_DLL != 0)
|
|
|
|
#define SOL_DLL_I_ SOL_ON
|
|
|
|
#else
|
|
|
|
#define SOL_DLL_I_ SOL_OFF
|
|
|
|
#endif
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_COMPILER_VCXX) && (defined(DLL_) || defined(_DLL))
|
2021-09-15 15:24:47 +08:00
|
|
|
#define SOL_DLL_I_ SOL_DEFAULT_ON
|
|
|
|
#else
|
|
|
|
#define SOL_DLL_I_ SOL_DEFAULT_OFF
|
|
|
|
#endif // DLL definition
|
|
|
|
|
|
|
|
#if defined(SOL_HEADER_ONLY)
|
|
|
|
#if (SOL_HEADER_ONLY != 0)
|
|
|
|
#define SOL_HEADER_ONLY_I_ SOL_ON
|
|
|
|
#else
|
|
|
|
#define SOL_HEADER_ONLY_I_ SOL_OFF
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define SOL_HEADER_ONLY_I_ SOL_DEFAULT_OFF
|
|
|
|
#endif // Header only library
|
|
|
|
|
2021-10-23 04:17:49 +08:00
|
|
|
#if defined(SOL_BUILD)
|
|
|
|
#if (SOL_BUILD != 0)
|
|
|
|
#define SOL_BUILD_I_ SOL_ON
|
|
|
|
#else
|
|
|
|
#define SOL_BUILD_I_ SOL_OFF
|
|
|
|
#endif
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_HEADER_ONLY)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_BUILD_I_ SOL_DEFAULT_OFF
|
|
|
|
#else
|
|
|
|
#define SOL_BUILD_I_ SOL_DEFAULT_ON
|
|
|
|
#endif
|
|
|
|
|
2021-09-15 15:24:47 +08:00
|
|
|
#if defined(SOL_UNITY_BUILD)
|
|
|
|
#if (SOL_UNITY_BUILD != 0)
|
|
|
|
#define SOL_UNITY_BUILD_I_ SOL_ON
|
|
|
|
#else
|
|
|
|
#define SOL_UNITY_BUILD_I_ SOL_OFF
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define SOL_UNITY_BUILD_I_ SOL_DEFAULT_OFF
|
|
|
|
#endif // Header only library
|
|
|
|
|
|
|
|
#if defined(SOL_C_FUNCTION_LINKAGE)
|
|
|
|
#define SOL_C_FUNCTION_LINKAGE_I_ SOL_C_FUNCTION_LINKAGE
|
|
|
|
#else
|
2022-06-23 04:32:13 +08:00
|
|
|
#if SOL_IS_ON(SOL_BUILD_CXX_MODE)
|
2021-09-15 15:24:47 +08:00
|
|
|
// C++
|
|
|
|
#define SOL_C_FUNCTION_LINKAGE_I_ extern "C"
|
|
|
|
#else
|
|
|
|
// normal
|
|
|
|
#define SOL_C_FUNCTION_LINKAGE_I_
|
|
|
|
#endif // C++ or not
|
|
|
|
#endif // Linkage specification for C functions
|
|
|
|
|
|
|
|
#if defined(SOL_API_LINKAGE)
|
|
|
|
#define SOL_API_LINKAGE_I_ SOL_API_LINKAGE
|
|
|
|
#else
|
2022-06-23 04:32:13 +08:00
|
|
|
#if SOL_IS_ON(SOL_DLL)
|
|
|
|
#if SOL_IS_ON(SOL_COMPILER_VCXX) || SOL_IS_ON(SOL_PLATFORM_WINDOWS) || SOL_IS_ON(SOL_PLATFORM_CYGWIN)
|
2021-09-15 15:24:47 +08:00
|
|
|
// MSVC Compiler; or, Windows, or Cygwin platforms
|
2022-06-23 04:32:13 +08:00
|
|
|
#if SOL_IS_ON(SOL_BUILD)
|
2021-09-15 15:24:47 +08:00
|
|
|
// Building the library
|
2022-06-23 04:32:13 +08:00
|
|
|
#if SOL_IS_ON(SOL_COMPILER_GCC)
|
2021-09-15 15:24:47 +08:00
|
|
|
// Using GCC
|
|
|
|
#define SOL_API_LINKAGE_I_ __attribute__((dllexport))
|
|
|
|
#else
|
|
|
|
// Using Clang, MSVC, etc...
|
|
|
|
#define SOL_API_LINKAGE_I_ __declspec(dllexport)
|
|
|
|
#endif
|
|
|
|
#else
|
2022-06-23 04:32:13 +08:00
|
|
|
#if SOL_IS_ON(SOL_COMPILER_GCC)
|
2021-09-15 15:24:47 +08:00
|
|
|
#define SOL_API_LINKAGE_I_ __attribute__((dllimport))
|
|
|
|
#else
|
|
|
|
#define SOL_API_LINKAGE_I_ __declspec(dllimport)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
// extern if building normally on non-MSVC
|
|
|
|
#define SOL_API_LINKAGE_I_ extern
|
|
|
|
#endif
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_UNITY_BUILD)
|
2021-09-15 15:24:47 +08:00
|
|
|
// Built-in library, like how stb typical works
|
2022-06-23 04:32:13 +08:00
|
|
|
#if SOL_IS_ON(SOL_HEADER_ONLY)
|
2021-09-15 15:24:47 +08:00
|
|
|
// Header only, so functions are defined "inline"
|
|
|
|
#define SOL_API_LINKAGE_I_ inline
|
|
|
|
#else
|
|
|
|
// Not header only, so seperately compiled files
|
|
|
|
#define SOL_API_LINKAGE_I_ extern
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
// Normal static library
|
2022-06-23 04:32:13 +08:00
|
|
|
#if SOL_IS_ON(SOL_BUILD_CXX_MODE)
|
2021-09-15 15:24:47 +08:00
|
|
|
#define SOL_API_LINKAGE_I_
|
|
|
|
#else
|
|
|
|
#define SOL_API_LINKAGE_I_ extern
|
|
|
|
#endif
|
|
|
|
#endif // DLL or not
|
|
|
|
#endif // Build definitions
|
|
|
|
|
|
|
|
#if defined(SOL_PUBLIC_FUNC_DECL)
|
|
|
|
#define SOL_PUBLIC_FUNC_DECL_I_ SOL_PUBLIC_FUNC_DECL
|
|
|
|
#else
|
|
|
|
#define SOL_PUBLIC_FUNC_DECL_I_ SOL_API_LINKAGE_I_
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SOL_INTERNAL_FUNC_DECL_)
|
|
|
|
#define SOL_INTERNAL_FUNC_DECL_I_ SOL_INTERNAL_FUNC_DECL_
|
|
|
|
#else
|
|
|
|
#define SOL_INTERNAL_FUNC_DECL_I_ SOL_API_LINKAGE_I_
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SOL_PUBLIC_FUNC_DEF)
|
|
|
|
#define SOL_PUBLIC_FUNC_DEF_I_ SOL_PUBLIC_FUNC_DEF
|
|
|
|
#else
|
|
|
|
#define SOL_PUBLIC_FUNC_DEF_I_ SOL_API_LINKAGE_I_
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SOL_INTERNAL_FUNC_DEF)
|
|
|
|
#define SOL_INTERNAL_FUNC_DEF_I_ SOL_INTERNAL_FUNC_DEF
|
|
|
|
#else
|
|
|
|
#define SOL_INTERNAL_FUNC_DEF_I_ SOL_API_LINKAGE_I_
|
|
|
|
#endif
|
|
|
|
|
2021-10-23 04:17:49 +08:00
|
|
|
#if defined(SOL_FUNC_DECL)
|
|
|
|
#define SOL_FUNC_DECL_I_ SOL_FUNC_DECL
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_HEADER_ONLY)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_FUNC_DECL_I_
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_DLL)
|
|
|
|
#if SOL_IS_ON(SOL_COMPILER_VCXX)
|
|
|
|
#if SOL_IS_ON(SOL_BUILD)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_FUNC_DECL_I_ extern __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define SOL_FUNC_DECL_I_ extern __declspec(dllimport)
|
|
|
|
#endif
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_FUNC_DECL_I_ extern __attribute__((visibility("default")))
|
|
|
|
#else
|
|
|
|
#define SOL_FUNC_DECL_I_ extern
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SOL_FUNC_DEFN)
|
|
|
|
#define SOL_FUNC_DEFN_I_ SOL_FUNC_DEFN
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_HEADER_ONLY)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_FUNC_DEFN_I_ inline
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_DLL)
|
|
|
|
#if SOL_IS_ON(SOL_COMPILER_VCXX)
|
|
|
|
#if SOL_IS_ON(SOL_BUILD)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_FUNC_DEFN_I_ __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define SOL_FUNC_DEFN_I_ __declspec(dllimport)
|
|
|
|
#endif
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_FUNC_DEFN_I_ __attribute__((visibility("default")))
|
|
|
|
#else
|
|
|
|
#define SOL_FUNC_DEFN_I_
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SOL_HIDDEN_FUNC_DECL)
|
|
|
|
#define SOL_HIDDEN_FUNC_DECL_I_ SOL_HIDDEN_FUNC_DECL
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_HEADER_ONLY)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_HIDDEN_FUNC_DECL_I_
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_DLL)
|
|
|
|
#if SOL_IS_ON(SOL_COMPILER_VCXX)
|
|
|
|
#if SOL_IS_ON(SOL_BUILD)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_HIDDEN_FUNC_DECL_I_ extern __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define SOL_HIDDEN_FUNC_DECL_I_ extern __declspec(dllimport)
|
|
|
|
#endif
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_HIDDEN_FUNC_DECL_I_ extern __attribute__((visibility("default")))
|
|
|
|
#else
|
|
|
|
#define SOL_HIDDEN_FUNC_DECL_I_ extern
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SOL_HIDDEN_FUNC_DEFN)
|
|
|
|
#define SOL_HIDDEN_FUNC_DEFN_I_ SOL_HIDDEN_FUNC_DEFN
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_HEADER_ONLY)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_HIDDEN_FUNC_DEFN_I_ inline
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_DLL)
|
|
|
|
#if SOL_IS_ON(SOL_COMPILER_VCXX)
|
|
|
|
#if SOL_IS_ON(SOL_BUILD)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_HIDDEN_FUNC_DEFN_I_
|
|
|
|
#else
|
|
|
|
#define SOL_HIDDEN_FUNC_DEFN_I_
|
|
|
|
#endif
|
2022-06-23 04:32:13 +08:00
|
|
|
#elif SOL_IS_ON(SOL_COMPILER_GCC) || SOL_IS_ON(SOL_COMPILER_CLANG)
|
2021-10-23 04:17:49 +08:00
|
|
|
#define SOL_HIDDEN_FUNC_DEFN_I_ __attribute__((visibility("hidden")))
|
|
|
|
#else
|
|
|
|
#define SOL_HIDDEN_FUNC_DEFN_I_
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2021-09-15 15:24:47 +08:00
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
#endif // SOL_DETAIL_BUILD_VERSION_HPP
|