Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[llvm] Support to export dll on windows #27725

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions ports/llvm/0012-fix-enable-export-dll.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index d2982f1..ee1e563 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -648,9 +648,6 @@ if(MSVC)
# Set this variable to OFF here so it can't be set with a command-line
# argument.
set (LLVM_LINK_LLVM_DYLIB OFF)
- if (BUILD_SHARED_LIBS)
- message(FATAL_ERROR "BUILD_SHARED_LIBS options is not supported on Windows.")
- endif()
else()
option(LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dynamic library" OFF)
option(LLVM_BUILD_LLVM_C_DYLIB "Build libllvm-c re-export library (Darwin only)" OFF)
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index fcaa8f2..9e9f82d 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1136,13 +1136,14 @@ endif()
CMAKE_DEPENDENT_OPTION(LLVM_EXPORT_SYMBOLS_FOR_PLUGINS
"Export symbols from LLVM tools so that plugins can import them" OFF
"NOT ${CMAKE_SYSTEM_NAME} MATCHES AIX" ${LLVM_EXPORT_SYMBOLS_FOR_PLUGINS_AIX_default})
-if(BUILD_SHARED_LIBS AND LLVM_EXPORT_SYMBOLS_FOR_PLUGINS)
- message(FATAL_ERROR "BUILD_SHARED_LIBS not compatible with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS")
-endif()
-if(LLVM_LINK_LLVM_DYLIB AND LLVM_EXPORT_SYMBOLS_FOR_PLUGINS)
- message(FATAL_ERROR "LLVM_LINK_LLVM_DYLIB not compatible with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS")
+if(0)
+ if(BUILD_SHARED_LIBS AND LLVM_EXPORT_SYMBOLS_FOR_PLUGINS)
+ message(FATAL_ERROR "BUILD_SHARED_LIBS not compatible with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS")
+ endif()
+ if(LLVM_LINK_LLVM_DYLIB AND LLVM_EXPORT_SYMBOLS_FOR_PLUGINS)
+ message(FATAL_ERROR "LLVM_LINK_LLVM_DYLIB not compatible with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS")
+ endif()
endif()
-
# By default we should enable LLVM_ENABLE_IDE only for multi-configuration
# generators. This option disables optional build system features that make IDEs
# less usable.
8 changes: 7 additions & 1 deletion ports/llvm/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
set(LLVM_VERSION "14.0.4")

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
if (VCPKG_TARGET_IS_WINDOWS AND (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic))
list(APPEND OPTIONS -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=enabled)
else()
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -16,6 +20,7 @@ vcpkg_from_github(
0009-fix-tools-install-path.patch
0010-fix-libffi.patch
0011-fix-install-bolt.patch
0012-fix-enable-export-dll.patch
)

vcpkg_check_features(
Expand Down Expand Up @@ -232,6 +237,7 @@ set(LLVM_LINK_JOBS 1)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}/llvm
OPTIONS
${OPTIONS}
${FEATURE_OPTIONS}
-DLLVM_INCLUDE_EXAMPLES=OFF
-DLLVM_BUILD_EXAMPLES=OFF
Expand Down
1 change: 1 addition & 0 deletions ports/llvm/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "llvm",
"version": "14.0.4",
"port-version": 1,
"description": "The LLVM Compiler Infrastructure.",
"homepage": "https://llvm.org",
"license": "Apache-2.0",
Expand Down
2 changes: 0 additions & 2 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,6 @@ vcpkg-ci-llvm:x64-linux=pass
vcpkg-ci-llvm:x64-osx=pass
vcpkg-ci-llvm:x64-windows-static-md=pass
vcpkg-ci-llvm:x64-windows-static=pass
vcpkg-ci-llvm:x64-windows=pass
vcpkg-ci-llvm:x86-windows=pass
FrankXie05 marked this conversation as resolved.
Show resolved Hide resolved
vcpkg-ci-opencv:arm-uwp=pass
vcpkg-ci-opencv:arm64-windows=pass
vcpkg-ci-opencv:x64-linux=pass
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4542,7 +4542,7 @@
},
"llvm": {
"baseline": "14.0.4",
"port-version": 0
"port-version": 1
},
"lmdb": {
"baseline": "0.9.29",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/llvm.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1a7952d43e07cbd3165e9282d7c6bef7042fd417",
"version": "14.0.4",
"port-version": 1
},
{
"git-tree": "7f97dd1dc56be6b5637b8406bd01ac0c245eb0dc",
"version": "14.0.4",
Expand Down