Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:05:44

0001 /*
0002  * SPDX-License-Identifier: Apache-2.0
0003  */
0004 
0005 #ifndef ONNX_ONNX_PB_H
0006 #define ONNX_ONNX_PB_H
0007 
0008 // Defines ONNX_EXPORT and ONNX_IMPORT. On Windows, this corresponds to
0009 // different declarations (dllexport and dllimport). On Linux/Mac, it just
0010 // resolves to the same "default visibility" setting.
0011 #if defined(_MSC_VER)
0012 #if defined(ONNX_BUILD_SHARED_LIBS) || defined(ONNX_BUILD_MAIN_LIB)
0013 #define ONNX_EXPORT __declspec(dllexport)
0014 #define ONNX_IMPORT __declspec(dllimport)
0015 #else
0016 #define ONNX_EXPORT
0017 #define ONNX_IMPORT
0018 #endif
0019 #else
0020 #if defined(__GNUC__)
0021 #define ONNX_EXPORT __attribute__((__visibility__("default")))
0022 #else
0023 #define ONNX_EXPORT
0024 #endif
0025 #define ONNX_IMPORT ONNX_EXPORT
0026 #endif
0027 
0028 // ONNX_API is a macro that, depends on whether you are building the
0029 // main ONNX library or not, resolves to either ONNX_EXPORT or
0030 // ONNX_IMPORT.
0031 //
0032 // This is used in e.g. ONNX's protobuf files: when building the main library,
0033 // it is defined as ONNX_EXPORT to fix a Windows global-variable-in-dll
0034 // issue, and for anyone dependent on ONNX it will be defined as
0035 // ONNX_IMPORT. ONNX_BUILD_MAIN_LIB can also be set when being built
0036 // statically if ONNX is being linked into a shared library that wants
0037 // to export the ONNX APIs and classes.
0038 //
0039 // More details on Windows dllimport / dllexport can be found at
0040 // https://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx
0041 //
0042 // This solution is similar to
0043 // https://github.com/pytorch/pytorch/blob/master/caffe2/core/common.h
0044 #if defined(ONNX_BUILD_SHARED_LIBS) || defined(ONNX_BUILD_MAIN_LIB)
0045 #define ONNX_API ONNX_EXPORT
0046 #else
0047 #define ONNX_API ONNX_IMPORT
0048 #endif
0049 
0050 #ifdef ONNX_ML
0051 #include "onnx/onnx-ml.pb.h"
0052 #else
0053 #include "onnx/onnx.pb.h"
0054 #endif
0055 
0056 #endif // ! ONNX_ONNX_PB_H