[clang] [Clang] Include the clang-shlib CMake project when building for MSVC (PR #109457)

Thomas Fransham via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 20 11:33:45 PDT 2024


https://github.com/fsfod created https://github.com/llvm/llvm-project/pull/109457

Enable building clang-cpp shared library for windows when building with explicit visibility macros enabled and LLVM is built as a shared library(LLVM_BUILD_LLVM_DYLIB_VIS).
This is part of the effort to support for enabling plugins on windows by adding better support for building LLVM and Clang as a DLL.

>From 98984a34c9779dfcac179c3b45f02b61ed3ab2f6 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Fri, 20 Sep 2024 19:00:50 +0100
Subject: [PATCH] [Clang] Include the clang-shlib CMake project when building
 for MSVC

Enable building clang-cpp shared library for windows when building with
explicit visibility macros enabled and LLVM is built as a
shared library(LLVM_BUILD_LLVM_DYLIB_VIS).
---
 clang/tools/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/tools/CMakeLists.txt b/clang/tools/CMakeLists.txt
index 9a3512712a28a4..88e29412e54350 100644
--- a/clang/tools/CMakeLists.txt
+++ b/clang/tools/CMakeLists.txt
@@ -22,7 +22,7 @@ add_clang_subdirectory(c-index-test)
 add_clang_subdirectory(clang-refactor)
 # For MinGW we only enable shared library if LLVM_LINK_LLVM_DYLIB=ON.
 # Without that option resulting library is too close to 2^16 DLL exports limit.
-if(UNIX OR (MINGW AND LLVM_LINK_LLVM_DYLIB))
+if(UNIX OR (MSVC AND LLVM_BUILD_LLVM_DYLIB_VIS) OR (MINGW AND LLVM_LINK_LLVM_DYLIB))
   add_clang_subdirectory(clang-shlib)
 endif()
 



More information about the cfe-commits mailing list