xref: /aosp_15_r20/external/pytorch/c10/xpu/XPUMacros.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #ifndef C10_USING_CUSTOM_GENERATED_MACROS
4 #include <c10/xpu/impl/xpu_cmake_macros.h>
5 #endif
6 
7 // See c10/macros/Export.h for a detailed explanation of what the function
8 // of these macros are.  We need one set of macros for every separate library
9 // we build.
10 
11 #ifdef _WIN32
12 #if defined(C10_XPU_BUILD_SHARED_LIBS)
13 #define C10_XPU_EXPORT __declspec(dllexport)
14 #define C10_XPU_IMPORT __declspec(dllimport)
15 #else
16 #define C10_XPU_EXPORT
17 #define C10_XPU_IMPORT
18 #endif
19 #else // _WIN32
20 #if defined(__GNUC__)
21 #define C10_XPU_EXPORT __attribute__((__visibility__("default")))
22 #else // defined(__GNUC__)
23 #define C10_XPU_EXPORT
24 #endif // defined(__GNUC__)
25 #define C10_XPU_IMPORT C10_XPU_EXPORT
26 #endif // _WIN32
27 
28 // This one is being used by libc10_xpu.so
29 #ifdef C10_XPU_BUILD_MAIN_LIB
30 #define C10_XPU_API C10_XPU_EXPORT
31 #else
32 #define C10_XPU_API C10_XPU_IMPORT
33 #endif
34