These are my initial build and code changes to supporting building llvm as shared library/DLL on windows(without force exporting all symbols) and making symbol visibility hidden by default on Linux which adding explicit symbol visibility macros to the whole llvm codebase. Updated cmake code to allow building llvm-shlib on windows by appending /WHOLEARCHIVE:lib to the linker options. Remove the hardcoded CMake error from using LLVM_BUILD_LLVM_DYLIB on windows. Updated CMake to define new macros to control conditional export macros in llvm/Support/Compiler.h Use /Zc:dllexportInlines- when compiling with clang-cl on windows with a opt out CMake option to disable using it. Replace some use of LLVM_EXTERNAL_VISIBILITY with new export macros. Some of the cmake and code changes are based on @tstellar's earlier PR https://github.com/llvm/llvm-project/pull/67502. I have Windows building using clang-cl, while for MSVC its at-least able to build libllvm, but some tests can't build because llvm iterator template metaprogramming that doesn't work well with dllexport. Linux should build without issue. My full branch is here https://github.com/fsfod/llvm-project/tree/llvm-export-api-20.0 and including all the auto generated export macros from clang tooling based system.
52 lines
1.2 KiB
CMake
52 lines
1.2 KiB
CMake
# The common library is similar to the basic library except it can
|
|
# depend on vt_gen.
|
|
#
|
|
# This library contains the bulk of the supporting code for all
|
|
# TableGen backends. It's split off as a separate library to
|
|
# allow unit-testing those components.
|
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
Support
|
|
TableGen
|
|
)
|
|
|
|
add_llvm_library(LLVMTableGenCommon STATIC OBJECT EXCLUDE_FROM_ALL DISABLE_LLVM_LINK_LLVM_DYLIB
|
|
GlobalISel/CodeExpander.cpp
|
|
GlobalISel/CombinerUtils.cpp
|
|
GlobalISel/CXXPredicates.cpp
|
|
GlobalISel/GlobalISelMatchTable.cpp
|
|
GlobalISel/GlobalISelMatchTableExecutorEmitter.cpp
|
|
GlobalISel/PatternParser.cpp
|
|
GlobalISel/Patterns.cpp
|
|
|
|
AsmWriterInst.cpp
|
|
CodeGenDAGPatterns.cpp
|
|
CodeGenHwModes.cpp
|
|
CodeGenInstAlias.cpp
|
|
CodeGenInstruction.cpp
|
|
CodeGenRegisters.cpp
|
|
CodeGenSchedule.cpp
|
|
CodeGenTarget.cpp
|
|
DAGISelMatcher.cpp
|
|
InfoByHwMode.cpp
|
|
OptEmitter.cpp
|
|
PredicateExpander.cpp
|
|
SubtargetFeatureInfo.cpp
|
|
Types.cpp
|
|
Utils.cpp
|
|
VarLenCodeEmitterGen.cpp
|
|
|
|
LINK_LIBS
|
|
LLVMTableGenBasic
|
|
|
|
DEPENDS
|
|
vt_gen
|
|
intrinsics_gen
|
|
)
|
|
|
|
# Users may include its headers as "Common/*.h"
|
|
target_include_directories(LLVMTableGenCommon
|
|
PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
|
|
)
|