File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -935,6 +935,13 @@ if (LLVM_LINK_LLVM_DYLIB AND BUILD_SHARED_LIBS)
935935 message (FATAL_ERROR "Cannot enable BUILD_SHARED_LIBS with LLVM_LINK_LLVM_DYLIB. We recommend disabling BUILD_SHARED_LIBS." )
936936endif ()
937937
938+ set (LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS OFF )
939+ if (LLVM_BUILD_LLVM_DYLIB OR LLVM_BUILD_SHARED_LIBS OR LLVM_ENABLE_PLUGINS)
940+ # Export annotations for LLVM must be enabled if building as a shared lib or
941+ # enabling plugins.
942+ set (LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS ON )
943+ endif ()
944+
938945option (LLVM_OPTIMIZED_TABLEGEN "Force TableGen to be built with optimization" OFF )
939946if (CMAKE_CROSSCOMPILING OR (LLVM_OPTIMIZED_TABLEGEN AND (LLVM_ENABLE_ASSERTIONS OR CMAKE_CONFIGURATION_TYPES )))
940947 set (LLVM_USE_HOST_TOOLS ON )
Original file line number Diff line number Diff line change 110110/* Define if building LLVM with BUILD_SHARED_LIBS */
111111#cmakedefine LLVM_BUILD_SHARED_LIBS
112112
113+ /* Define if exporting LLVM public interface for shared library */
114+ #cmakedefine LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS
115+
113116/* Define if building LLVM with LLVM_FORCE_USE_OLD_TOOLCHAIN_LIBS */
114117#cmakedefine LLVM_FORCE_USE_OLD_TOOLCHAIN ${LLVM_FORCE_USE_OLD_TOOLCHAIN}
115118
Original file line number Diff line number Diff line change 184184// Marker to add to classes or functions in public headers that should not have
185185// export macros added to them by the clang tool
186186#define LLVM_ABI_NOT_EXPORTED
187- #if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS) || \
188- defined (LLVM_ENABLE_PLUGINS)
189- // Some libraries like those for tablegen are linked in to tools that used
190- // in the build so can't depend on the llvm shared library. If export macros
191- // were left enabled when building these we would get duplicate or
192- // missing symbol linker errors on windows.
193- #if defined(LLVM_BUILD_STATIC)
194- #define LLVM_ABI
195- #define LLVM_ABI_FRIEND
196- #define LLVM_TEMPLATE_ABI
197- #define LLVM_EXPORT_TEMPLATE
198- #define LLVM_ABI_EXPORT
199- #elif defined(_WIN32) && !defined(__MINGW32__)
187+ #if defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS) && !defined(LLVM_BUILD_STATIC)
188+ #if defined(_WIN32) && !defined(__MINGW32__)
200189#if defined(LLVM_EXPORTS)
201190#define LLVM_ABI __declspec (dllexport)
202191#define LLVM_TEMPLATE_ABI
222211#define LLVM_EXPORT_TEMPLATE
223212#define LLVM_ABI_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
224213#endif
225- #else
214+ #endif
215+ #if !defined(LLVM_ABI)
226216#define LLVM_ABI
227217#define LLVM_ABI_FRIEND
228218#define LLVM_TEMPLATE_ABI
You can’t perform that action at this time.
0 commit comments