ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Macro.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.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 // In CloudViewer, we set symbol visibility based on folder / cmake target
14 // through cmake. e.g. all symbols in kernel folders are hidden. These macros
15 // allow fine grained control over symbol visibility.
16 #if defined(_WIN32) || defined(__CYGWIN__)
17 #define CLOUDVIEWER_DLL_IMPORT __declspec(dllimport)
18 #define CLOUDVIEWER_DLL_EXPORT __declspec(dllexport)
19 #define CLOUDVIEWER_DLL_LOCAL
20 #else
21 #define CLOUDVIEWER_DLL_IMPORT [[gnu::visibility("default")]]
22 #define CLOUDVIEWER_DLL_EXPORT [[gnu::visibility("default")]]
23 #define CLOUDVIEWER_DLL_LOCAL [[gnu::visibility("hidden")]]
24 #endif
25 
26 #ifdef CLOUDVIEWER_STATIC
27 #define CLOUDVIEWER_API
28 #define CLOUDVIEWER_LOCAL
29 #else
30 #define CLOUDVIEWER_LOCAL CLOUDVIEWER_DLL_LOCAL
31 #if defined(CLOUDVIEWER_ENABLE_DLL_EXPORTS)
32 #define CLOUDVIEWER_API CLOUDVIEWER_DLL_EXPORT
33 #else
34 #define CLOUDVIEWER_API CLOUDVIEWER_DLL_IMPORT
35 #endif
36 #endif
37 
38 // Compiler-specific function macro.
39 // Ref: https://stackoverflow.com/a/4384825
40 #ifdef _WIN32
41 #define CLOUDVIEWER_FUNCTION __FUNCSIG__
42 #else
43 #define CLOUDVIEWER_FUNCTION __PRETTY_FUNCTION__
44 #endif
45 
46 // Assertion for CUDA device code.
47 // Usage:
48 // CLOUDVIEWER_ASSERT(condition);
49 // CLOUDVIEWER_ASSERT(condition && "Error message");
50 // For host-only code, consider using utility::LogError();
51 #define CLOUDVIEWER_ASSERT(...) assert((__VA_ARGS__))