File size: 1,363 Bytes
7b853a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

#pragma once

// Finds the current platform
#if defined( __WIN32__ ) || defined( _WIN32 )
#    define PLATFORM_WIN32
#else
#    define PLATFORM_LINUX
#endif

//
// Platform Specific Helpers/Functions
//

// DLL export
#if defined(PLATFORM_WIN32) // Windows
#    if defined(COMPILER_MSVC)
#        if defined(STATIC_LIB)
#            define API
#        else
#            if defined(API)
#                define API __declspec(dllexport)
#            else
#                define API __declspec(dllimport)
#            endif
#        endif
#    else
#        if defined(STATIC_LIB)
#            define API
#        else
#            if defined(API)
#                define API __attribute__ ((dllexport))
#            else
#                define API __attribute__ ((dllimport))
#            endif
#        endif
#    endif
#    define DISABLE_OPTIMIZATION __pragma( optimize( "", off ) )
#    define ENABLE_OPTIMIZATION __pragma( optimize( "", on ) )
#    define DEBUG_BREAK() // __debugbreak()
#else // Linux settings
#    include <signal.h>
#    define API __attribute__ ((visibility ("default")))
#    define DISABLE_OPTIMIZATION
#    define ENABLE_OPTIMIZATION
#    define DEBUG_BREAK() // raise(SIGTRAP)
#endif