Open3D (C++ API)  0.18.0
Macro.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <cassert>
11 
12 // https://gcc.gnu.org/wiki/Visibility updated to use C++11 attribute syntax
13 #if defined(_WIN32) || defined(__CYGWIN__)
14 #define OPEN3D_DLL_IMPORT __declspec(dllimport)
15 #define OPEN3D_DLL_EXPORT __declspec(dllexport)
16 #define OPEN3D_DLL_LOCAL
17 #else
18 #define OPEN3D_DLL_IMPORT [[gnu::visibility("default")]]
19 #define OPEN3D_DLL_EXPORT [[gnu::visibility("default")]]
20 #define OPEN3D_DLL_LOCAL [[gnu::visibility("hidden")]]
21 #endif
22 
23 #ifdef OPEN3D_STATIC
24 #define OPEN3D_API
25 #define OPEN3D_LOCAL
26 #else
27 #define OPEN3D_LOCAL OPEN3D_DLL_LOCAL
28 #if defined(OPEN3D_ENABLE_DLL_EXPORTS)
29 #define OPEN3D_API OPEN3D_DLL_EXPORT
30 #else
31 #define OPEN3D_API OPEN3D_DLL_IMPORT
32 #endif
33 #endif
34 
35 // Compiler-specific function macro.
36 // Ref: https://stackoverflow.com/a/4384825
37 #ifdef _WIN32
38 #define OPEN3D_FUNCTION __FUNCSIG__
39 #else
40 #define OPEN3D_FUNCTION __PRETTY_FUNCTION__
41 #endif
42 
43 // Assertion for CUDA device code.
44 // Usage:
45 // OPEN3D_ASSERT(condition);
46 // OPEN3D_ASSERT(condition && "Error message");
47 // For host-only code, consider using utility::LogError();
48 #define OPEN3D_ASSERT(...) assert((__VA_ARGS__))