Skip to content

Commit

Permalink
ensure LIBCLANG_SOVERSION is set correctly also on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Feb 4, 2023
1 parent 7a7f1a6 commit 18b671a
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions recipe/patches/0008-set-libclang-SOVERSION-unconditionally.patch
Original file line number Diff line number Diff line change
@@ -1,30 +1,46 @@
From 4bc14803d5047c88ab177138e0bc63592d459185 Mon Sep 17 00:00:00 2001
From c505a5f72bc8f133d81fb5343a2073af9650c924 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Thu, 14 Apr 2022 11:57:00 +1100
Subject: [PATCH 8/8] set libclang SOVERSION unconditionally

---
clang/tools/libclang/CMakeLists.txt | 6 ++++++
1 file changed, 6 insertions(+)
clang/tools/libclang/CMakeLists.txt | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index da8a9740fa..d311440695 100644
index da8a9740fa..b047461f35 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -199,7 +199,13 @@ if(ENABLE_SHARED)
@@ -9,9 +9,9 @@
# TODO: This should probably not be a option going forward but we
# we should commit to a way to do it. But due to getting this out
# in LLVM 15.x we opted for a option.
-set(LIBCLANG_SOVERSION_ARG)
+set(LIBCLANG_SOVERSION)
if(NOT CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION)
- set(LIBCLANG_SOVERSION_ARG SOVERSION 13)
+ set(LIBCLANG_SOVERSION 13)
endif()

# TODO: harmonize usage of LIBCLANG_SOVERSION / LIBCLANG_LIBARY_VERSION
@@ -199,10 +199,16 @@ if(ENABLE_SHARED)
# Ensure that libclang.so gets rebuilt when the linker script changes.
set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY
OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libclang.map)
+ endif()

+ if(WIN32)
+ # point libclang.lib to libclang-<SO-version>.dll
+ set_target_properties(libclang PROPERTIES RUNTIME_OUTPUT_NAME "libclang-${LIBCLANG_SOVERSION_ARG}")
+ set_target_properties(libclang PROPERTIES RUNTIME_OUTPUT_NAME "libclang-${LIBCLANG_SOVERSION}")
+ else()
+ # on unix, set so-version directly
set_target_properties(libclang PROPERTIES
VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}
${LIBCLANG_SOVERSION_ARG})
- ${LIBCLANG_SOVERSION_ARG})
+ SOVERSION ${LIBCLANG_SOVERSION})
endif()
endif()

--
2.38.1.windows.1

0 comments on commit 18b671a

Please sign in to comment.