From e0473b627741540286d29de0c87103b692eca3fc Mon Sep 17 00:00:00 2001 From: sthuang <167743503+shaoting-huang@users.noreply.github.com> Date: Tue, 12 Nov 2024 17:00:26 +0800 Subject: [PATCH] fix: update storage lib (#156) Signed-off-by: shaoting-huang --- cpp/CMakeLists.txt | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index e23f5f1..0efa695 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -12,23 +12,26 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}) include(GNUInstallDirs) - if (WITH_OPENDAL) add_compile_definitions(MILVUS_OPENDAL) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(libopendal) endif() -#find_package(Azure REQUIRED) find_package(Boost REQUIRED) find_package(Arrow REQUIRED) find_package(protobuf REQUIRED) find_package(glog REQUIRED) -#find_package(AWSSDK REQUIRED) file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.cc) -add_library(milvus-storage ${SRC_FILES}) -target_include_directories(milvus-storage PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/milvus-storage ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/test/include) + +add_library(milvus-storage SHARED ${SRC_FILES}) +target_include_directories(milvus-storage PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include/milvus-storage + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${CMAKE_CURRENT_SOURCE_DIR}/test/include +) + set(LINK_LIBS arrow::arrow Boost::boost @@ -45,6 +48,11 @@ endif() target_link_libraries(milvus-storage PUBLIC ${LINK_LIBS}) +set_target_properties(milvus-storage PROPERTIES + INSTALL_RPATH "$ORIGIN/../lib" + BUILD_WITH_INSTALL_RPATH TRUE +) + if (WITH_UT) enable_testing() add_subdirectory(test) @@ -55,5 +63,9 @@ if (WITH_BENCHMARK) endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/milvus-storage.pc.in "${CMAKE_CURRENT_BINARY_DIR}/milvus-storage.pc" @ONLY) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/milvus-storage.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/") -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmilvus-storage.dylib" DESTINATION "${CMAKE_INSTALL_LIBDIR}") \ No newline at end of file + +install(TARGETS milvus-storage + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/milvus-storage.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/") \ No newline at end of file