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

qhull: relocatable shared libs on macOS #9279

Merged
merged 2 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
relocatable shared libs on macOS
  • Loading branch information
SpaceIm committed Feb 5, 2022
commit 63a1d7027322887437253b486ef31772888265aa
4 changes: 2 additions & 2 deletions recipes/qhull/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.1)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(KEEP_RPATHS)

add_subdirectory("source_subfolder")
54 changes: 45 additions & 9 deletions recipes/qhull/all/patches/fix-cmake-7.3.2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
- set(qhull_STATICR qhullstatic_r)
-endif()
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
+
+set(qhull_CPP qhullcpp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it really need a patch? can we set these qhull_* variables from the outside (via cmake -Dqhull_CPP=whatver ...)?

Copy link
Contributor Author

@SpaceIm SpaceIm Feb 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part of the patch for old versions is not new. it is required. Basically it's part of 8.0.2 and master: qhull/qhull#76

+set(qhull_SHARED libqhull) # Temporarily avoid name conflict with qhull executable
+set(qhull_SHAREDP qhull_p)
+set(qhull_SHAREDR qhull_r)
+set(qhull_STATIC qhullstatic)
+set(qhull_STATICR qhullstatic_r)
+
+if(BUILD_SHARED_LIBS)
+set(
+ qhull_TARGETS_INSTALL
Expand All @@ -49,7 +49,7 @@
set(
qhull_TARGETS_TEST # Unused
user_eg user_eg2 user_eg3 user_egp testqset testqset_r
@@ -371,7 +370,8 @@ add_library(${qhull_SHAREDR} SHARED
@@ -371,10 +370,12 @@ add_library(${qhull_SHAREDR} SHARED
src/libqhull_r/qhull_r-exports.def)
set_target_properties(${qhull_SHAREDR} PROPERTIES
SOVERSION ${qhull_SOVERSION}
Expand All @@ -59,7 +59,19 @@

if(UNIX)
target_link_libraries(${qhull_SHAREDR} m)
@@ -394,15 +394,11 @@ add_library(${qhull_SHARED} SHARED
+ if(0)
if(APPLE)
set_target_properties(${qhull_SHAREDR} PROPERTIES
INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
@@ -384,6 +385,7 @@ if(UNIX)
INSTALL_RPATH_USE_LINK_PATH TRUE
BUILD_WITH_INSTALL_RPATH FALSE)
endif()
+ endif()
endif(UNIX)

# ---------------------------------------
@@ -394,18 +396,15 @@ add_library(${qhull_SHARED} SHARED
${libqhull_SOURCES}
src/libqhull/qhull-exports.def)

Expand All @@ -77,7 +89,19 @@

if(UNIX)
target_link_libraries(${qhull_SHARED} m)
@@ -427,7 +423,8 @@ add_library(${qhull_SHAREDP} SHARED
+ if(0)
if(APPLE)
set_target_properties(${qhull_SHARED} PROPERTIES
INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
@@ -415,6 +414,7 @@ if(UNIX)
INSTALL_RPATH_USE_LINK_PATH TRUE
BUILD_WITH_INSTALL_RPATH FALSE)
endif()
+ endif()
endif(UNIX)

# ---------------------------------------
@@ -427,10 +427,12 @@ add_library(${qhull_SHAREDP} SHARED
set_target_properties(${qhull_SHAREDP} PROPERTIES
COMPILE_DEFINITIONS "qh_QHpointer"
SOVERSION ${qhull_SOVERSION}
Expand All @@ -87,7 +111,19 @@

if(UNIX)
target_link_libraries(${qhull_SHAREDP} m)
@@ -448,11 +445,13 @@ endif(UNIX)
+ if(0)
if(APPLE)
set_target_properties(${qhull_SHAREDP} PROPERTIES
INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
@@ -440,6 +442,7 @@ if(UNIX)
INSTALL_RPATH_USE_LINK_PATH TRUE
BUILD_WITH_INSTALL_RPATH FALSE)
endif()
+ endif()
endif(UNIX)

# ---------------------------------------
@@ -448,11 +451,13 @@ endif(UNIX)

add_library(${qhull_STATIC} STATIC ${libqhull_SOURCES})
set_target_properties(${qhull_STATIC} PROPERTIES
Expand All @@ -103,7 +139,7 @@

if(UNIX)
target_link_libraries(${qhull_STATIC} m)
@@ -466,7 +465,8 @@ endif(UNIX)
@@ -466,7 +471,8 @@ endif(UNIX)

add_library(${qhull_CPP} STATIC ${libqhullcpp_SOURCES})
set_target_properties(${qhull_CPP} PROPERTIES
Expand All @@ -113,15 +149,15 @@

# ---------------------------------------
# Define qhull executables linked to qhullstatic library
@@ -619,6 +619,7 @@ add_test(NAME user_eg3
@@ -619,6 +625,7 @@ add_test(NAME user_eg3

install(TARGETS ${qhull_TARGETS_INSTALL} EXPORT QhullTargets
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
+ BUNDLE DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
INCLUDES DESTINATION include)
@@ -661,10 +662,7 @@ install(
@@ -661,10 +668,7 @@ install(
)

install(FILES ${libqhull_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull)
Expand Down
54 changes: 45 additions & 9 deletions recipes/qhull/all/patches/fix-cmake-8.0.x.patch
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
set(
qhull_TARGETS_TEST # Unused
user_eg user_eg2 user_eg3 user_egp testqset testqset_r
@@ -375,7 +375,8 @@ add_library(${qhull_SHAREDR} SHARED
@@ -375,10 +375,12 @@ add_library(${qhull_SHAREDR} SHARED
src/libqhull_r/qhull_r-exports.def)
set_target_properties(${qhull_SHAREDR} PROPERTIES
SOVERSION ${qhull_SOVERSION}
Expand All @@ -55,7 +55,19 @@

if(UNIX)
target_link_libraries(${qhull_SHAREDR} m)
@@ -398,15 +399,11 @@ add_library(${qhull_SHARED} SHARED
+ if(0)
if(APPLE)
set_target_properties(${qhull_SHAREDR} PROPERTIES
INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
@@ -388,6 +390,7 @@ if(UNIX)
INSTALL_RPATH_USE_LINK_PATH TRUE
BUILD_WITH_INSTALL_RPATH FALSE)
endif()
+ endif()
endif(UNIX)

# ---------------------------------------
@@ -398,18 +401,15 @@ add_library(${qhull_SHARED} SHARED
${libqhull_SOURCES}
src/libqhull/qhull-exports.def)

Expand All @@ -73,7 +85,19 @@

if(UNIX)
target_link_libraries(${qhull_SHARED} m)
@@ -431,7 +428,8 @@ add_library(${qhull_SHAREDP} SHARED
+ if(0)
if(APPLE)
set_target_properties(${qhull_SHARED} PROPERTIES
INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
@@ -419,6 +419,7 @@ if(UNIX)
INSTALL_RPATH_USE_LINK_PATH TRUE
BUILD_WITH_INSTALL_RPATH FALSE)
endif()
+ endif()
endif(UNIX)

# ---------------------------------------
@@ -431,10 +432,12 @@ add_library(${qhull_SHAREDP} SHARED
set_target_properties(${qhull_SHAREDP} PROPERTIES
COMPILE_DEFINITIONS "qh_QHpointer"
SOVERSION ${qhull_SOVERSION}
Expand All @@ -83,7 +107,19 @@

if(UNIX)
target_link_libraries(${qhull_SHAREDP} m)
@@ -452,11 +450,13 @@ endif(UNIX)
+ if(0)
if(APPLE)
set_target_properties(${qhull_SHAREDP} PROPERTIES
INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
@@ -444,6 +447,7 @@ if(UNIX)
INSTALL_RPATH_USE_LINK_PATH TRUE
BUILD_WITH_INSTALL_RPATH FALSE)
endif()
+ endif()
endif(UNIX)

# ---------------------------------------
@@ -452,11 +456,13 @@ endif(UNIX)

add_library(${qhull_STATIC} STATIC ${libqhull_SOURCES})
set_target_properties(${qhull_STATIC} PROPERTIES
Expand All @@ -99,15 +135,15 @@

if(UNIX)
target_link_libraries(${qhull_STATIC} m)
@@ -471,6 +471,7 @@ endif(UNIX)
@@ -471,6 +477,7 @@ endif(UNIX)
add_library(${qhull_CPP} STATIC ${libqhullcpp_SOURCES})
set_target_properties(${qhull_CPP} PROPERTIES
VERSION ${qhull_VERSION}
+ OUTPUT_NAME "${qhull_CPP}$<$<CONFIG:Debug>:_d>"
POSITION_INDEPENDENT_CODE "TRUE")

# ---------------------------------------
@@ -561,10 +562,8 @@ target_link_libraries(user_eg2 ${qhull_STATICR})
@@ -561,10 +568,8 @@ target_link_libraries(user_eg2 ${qhull_STATICR})

set(user_eg3_SOURCES src/user_eg3/user_eg3_r.cpp)

Expand All @@ -118,7 +154,7 @@

# ---------------------------------------
# qhullp is qhull/unix.c linked to deprecated qh_QHpointer libqhull_p
@@ -615,8 +614,6 @@ add_test(NAME user_eg
@@ -615,8 +620,6 @@ add_test(NAME user_eg
COMMAND sh -c "./user_eg")
add_test(NAME user_eg2
COMMAND sh -c "./user_eg2")
Expand All @@ -127,15 +163,15 @@

# ---------------------------------------
# Define install
@@ -624,6 +621,7 @@ add_test(NAME user_eg3
@@ -624,6 +627,7 @@ add_test(NAME user_eg3

install(TARGETS ${qhull_TARGETS_INSTALL} EXPORT QhullTargets
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
+ BUNDLE DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
INCLUDES DESTINATION include)
@@ -681,10 +679,7 @@ foreach(pkgconfig IN ITEMS "${qhull_SHARED};Qhull shared library"
@@ -681,10 +685,7 @@ foreach(pkgconfig IN ITEMS "${qhull_SHARED};Qhull shared library"
endforeach()

install(FILES ${libqhull_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull)
Expand Down