Skip to content

Commit 434b33b

Browse files
authored
Add option to install libtiledb.so (#361)
* Add option to install libtiledb.so * Change INSTALL configuration * Refactor install group condition * Pass TILEDB_DOWNLOADED variable that is passed * Remove logging line * Change install directory * Fix TileDB search directory and use RPATH
1 parent 2138fa7 commit 434b33b

File tree

5 files changed

+37
-19
lines changed

5 files changed

+37
-19
lines changed

apis/python/CMakeLists.txt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,23 @@ target_compile_definitions(
6464
VERSION_INFO=${PROJECT_VERSION}
6565
)
6666

67-
if (APPLE)
68-
set_target_properties(${VSPY_TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path/lib")
69-
elseif(UNIX)
70-
set_target_properties(${VSPY_TARGET_NAME} PROPERTIES INSTALL_RPATH "\$ORIGIN/lib")
71-
endif()
72-
7367
# Install the extension module
7468
install(TARGETS ${VSPY_TARGET_NAME} LIBRARY DESTINATION .)
7569

76-
# Install libtiledb so that we can repackage it with the extension
77-
install(IMPORTED_RUNTIME_ARTIFACTS TileDB::tiledb_shared DESTINATION lib)
70+
if (TILEDB_DOWNLOADED)
71+
message(STATUS "Adding libtiledb into install group")
72+
# Install libtiledb so that we can repackage it with the extension
73+
install(IMPORTED_RUNTIME_ARTIFACTS TileDB::tiledb_shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
74+
75+
if (APPLE)
76+
set_target_properties(${VSPY_TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path/lib")
77+
elseif(UNIX)
78+
set_target_properties(${VSPY_TARGET_NAME} PROPERTIES INSTALL_RPATH "\$ORIGIN/lib")
79+
endif()
80+
else()
81+
# If using external TileDB core library force it to be linked at runtime using RPATH
82+
get_property(TILEDB_LOCATION TARGET TileDB::tiledb_shared PROPERTY LOCATION)
83+
get_filename_component(TILEDB_LOCATION ${TILEDB_LOCATION} DIRECTORY)
84+
message(STATUS "Setting RPATH to ${TILEDB_LOCATION}")
85+
set_target_properties(${VSPY_TARGET_NAME} PROPERTIES INSTALL_RPATH ${TILEDB_LOCATION})
86+
endif()

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ sdist.cmake = true
5555

5656
[tool.scikit-build.cmake.define]
5757
TILEDB_VS_PYTHON = "ON"
58+
TILEDB_PATH = {env="TILEDB_PATH"}
5859

5960
[tool.setuptools_scm]
6061
version_file = "apis/python/src/tiledb/vector_search/version.py"

src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ option(BUILD_CLI "Build the index and query command-line interface programs" OFF
5454

5555
set(CMAKE_CXX_STANDARD 20)
5656

57+
if (TILEDB_PATH)
58+
set(CMAKE_PREFIX_PATH "${TILEDB_PATH};${CMAKE_PREFIX_PATH}")
59+
message(STATUS "Adding TILEDB_PATH to CMAKE_PREFIX_PATH")
60+
endif()
61+
62+
5763
# -----------------------------------------------------------------------------
5864
# Extend the module path so we can find our custom modules
5965
# -----------------------------------------------------------------------------

src/cmake/Modules/FindTileDB_EP.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ else()
6666

6767
list(APPEND FORWARD_EP_CMAKE_ARGS -DEP_TILEDB_BUILT=TRUE)
6868
list(APPEND EXTERNAL_PROJECTS ep_tiledb)
69+
set(TILEDB_DOWNLOADED "True")
6970
else()
7071
message(FATAL_ERROR "Unable to find TileDB library.")
7172
endif()

src/cmake/Superbuild.cmake

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ set(EXTERNAL_PROJECTS)
5050
# character other than a semicolon.
5151
list(JOIN CMAKE_PREFIX_PATH "|" CMAKE_PREFIX_PATH_STR)
5252

53+
############################################################
54+
# Set up external projects for dependencies
55+
############################################################
56+
57+
# These includes modify the EXTERNAL_PROJECTS variable.
58+
59+
# need spdlog to set up any of its needed targets...
60+
# include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindSpdlog.cmake)
61+
#... before tiledb sets up only half of them...
62+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindTileDB_EP.cmake)
63+
5364
# Forward any additional CMake args to the non-superbuild.
5465
set(INHERITED_CMAKE_ARGS
5566
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
@@ -83,19 +94,9 @@ set(INHERITED_CMAKE_ARGS
8394
-DPython3_FIND_REGISTRY=${Python3_FIND_REGISTRY}
8495
-DPython3_INCLUDE_DIR=${Python3_INCLUDE_DIR}
8596
-Dpybind11_DIR=${pybind11_DIR}
97+
-DTILEDB_DOWNLOADED=${TILEDB_DOWNLOADED}
8698
)
8799

88-
############################################################
89-
# Set up external projects for dependencies
90-
############################################################
91-
92-
# These includes modify the EXTERNAL_PROJECTS variable.
93-
94-
# need spdlog to set up any of its needed targets...
95-
# include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindSpdlog.cmake)
96-
#... before tiledb sets up only half of them...
97-
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindTileDB_EP.cmake)
98-
99100
############################################################
100101
# 'make format' target
101102
############################################################

0 commit comments

Comments
 (0)