SuperDex Physics C++ API
Loading...
Searching...
No Matches
mochi_physics_macros.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/**
18 Macros used to declare the MochiPhysics public API
19*/
20#pragma once
21
22// DLL Import/Export Attributes
23#ifndef MOCHI_DLL_EXPORT
24#if defined(_MSC_VER)
25#define MOCHI_DLL_EXPORT __declspec(dllexport)
26#define MOCHI_DLL_IMPORT __declspec(dllimport)
27#elif defined(__GNUC__) || defined(__clang__)
28#define MOCHI_DLL_EXPORT __attribute__((visibility("default")))
29#define MOCHI_DLL_IMPORT
30#else
31#define MOCHI_DLL_EXPORT
32#define MOCHI_DLL_IMPORT
33#pragma warning Unknown dynamic link import / export semantics.
34#endif
35#endif
36
37// MOCHI_PHYSICS_EXPORTS should be defined to 1 when compiling the internals of MochiPhysics project
38// (lib or dll). It should be 0 (or undefined) when including MochiPhysics headers from elsewhere.
39#ifndef MOCHI_PHYSICS_EXPORTS
40#define MOCHI_PHYSICS_EXPORTS 0
41#endif
42
43// By default, assume this library is being build as a DLL. If you want to build it as a static,
44// then define MOCHI_PHYSICS_DYNAMICALLY_LINKED to 0 in your build system (CMake, Visual Studio,
45// etc...)
46#ifndef MOCHI_PHYSICS_DYNAMICALLY_LINKED
47#define MOCHI_PHYSICS_DYNAMICALLY_LINKED 1
48#endif
49#if MOCHI_PHYSICS_DYNAMICALLY_LINKED && MOCHI_PHYSICS_EXPORTS
50// Declare API symbols as MOCHI_DLL_EXPORT when building the CPP files in this project into a DLL.
51// That is the only time MOCHI_PHYSICS_EXPORTS is 1.
52#define MOCHI_API MOCHI_DLL_EXPORT
53#elif MOCHI_PHYSICS_DYNAMICALLY_LINKED && !MOCHI_PHYSICS_EXPORTS
54// Declare API symbols as MOCHI_DLL_IMPORT when this project is being build as a DLL, but the
55// headers are being included elsewhere.
56#define MOCHI_API MOCHI_DLL_IMPORT
57#else
58// Declare API symbols with no import/export semantics if this project is being built as a static
59// library
60#define MOCHI_API
61#endif