JD2022-TU1/main/extern/gear4/gear_core/gearconfig.h

79 lines
3.1 KiB
C++

////////////////////////////////////////////////////////////////////////////////
//
// File : gearconfig.h
// Copyright (c) Ubisoft Entertainment. All rights reserved.
//
////////////////////////////////////////////////////////////////////////////////
//
// Every value for the debug, release and retail build along with specific
// definitions for the DLL vs non-DLL build are contained therein.
//
////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef G4_GEARCONFIG__INCLUDED
#define G4_GEARCONFIG__INCLUDED
// Include the pre-configuration file for Gear
#include <gear_core/base/stddef.h>
#define G4_SET_RT_CONFIG(config, value) G4::g_CurrentConfig.config = value
#define G4_GET_RT_CONFIG(config) G4::g_CurrentConfig.config
//////////////////////////////////////////////////////////////////////////
//
#if defined(__clang__) && defined(G4_IS_CURRENTLY_PARSING)
#define __G4_CONFIG__(cfgtype, name, type, ...) \
namespace g4_parser_internal \
{ \
struct \
__attribute__((annotate(cfgtype "," #name "," #type "," #__VA_ARGS__))) \
G4_RT_CFG_ ## name ## _STRUCT{ }; \
}
#define G4_CREATE_RT_CONFIG(name, type, default_value, ...) \
__G4_CONFIG__("rtconfig", name, type, default_value, __VA_ARGS__)
#define G4_CREATE_CONFIG(name, type, default_value, ...) \
__G4_CONFIG__("config", name, type, default_value, __VA_ARGS__)
#else
#define G4_CREATE_RT_CONFIG(...)
#define G4_CREATE_CONFIG(...)
#endif
#if defined(G4_RETAIL)
#include <gear_core/base/config/retail.h>
#else
#include <gear_core/base/config/debug.h>
#endif
////////////////////////////////////////////////////////////
// Gear Lib/DLL macros - Should only be used inside of Gear
// If Gear is compiling in DLL mode, let's set a meaning for DLLIMPORT & DLLEXPORT
#ifdef G4_CORE_DLL
#if (G4_PLATFORM != G4_PLATFORM_WIN32) && (G4_PLATFORM != G4_PLATFORM_WIN64)
#error G4_CORE_DLL can only be defined on win32 & win64 platforms !
#endif
#define G4_CORE_DLL_ENTRY_IMPORT __declspec(dllimport)
#define G4_CORE_DLL_ENTRY_EXPORT __declspec(dllexport)
#else
#define G4_CORE_DLL_ENTRY_IMPORT
#define G4_CORE_DLL_ENTRY_EXPORT
#endif
// If we are currently compiling the Gear DLL, export. Otherwise import!
#ifdef G4_CORE_EXPORT_DLL
#if !defined(G4_CORE_DLL)
#error G4_CORE_DLL must be defined when G4_CORE_EXPORT_DLL is defined !
#endif
#define G4_CORE_DLL_ENTRY G4_CORE_DLL_ENTRY_EXPORT
#else
#define G4_CORE_DLL_ENTRY G4_CORE_DLL_ENTRY_IMPORT
#endif
#endif // #ifndef G4_GEARCONFIG__INCLUDED