From 6b2fe56644df28420ce077abe3aeedb2a420ce72 Mon Sep 17 00:00:00 2001 From: Enwei Jiao Date: Thu, 9 Nov 2023 10:02:19 +0800 Subject: [PATCH] Remove deprecated conan generator (#174) Signed-off-by: Enwei Jiao --- .github/workflows/analyzer.yaml | 4 ++-- CMakeLists.txt | 2 +- cmake/libs/libdiskann.cmake | 1 + conanfile.py | 7 +++++-- python/setup.py | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/analyzer.yaml b/.github/workflows/analyzer.yaml index 82f549f96..f14ee774b 100644 --- a/.github/workflows/analyzer.yaml +++ b/.github/workflows/analyzer.yaml @@ -30,5 +30,5 @@ jobs: restore-keys: ${{ runner.os }}-${{ hashFiles('**/conanfile.py') }} - name: Build & Analyzer run: | - mkdir build && cd build && conan install .. --build=missing -o with_ut=True -o with_diskann=True && cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_DISKANN=ON \ - && cd .. && find src -type f | grep -E "\.cc$" | xargs /usr/lib/llvm-10/share/clang/run-clang-tidy.py -quiet -p=./build + mkdir build && cd build && conan install .. --build=missing -o with_ut=True -o with_diskann=True && conan build .. \ + && cd .. && find src -type f | grep -E "\.cc$" | xargs /usr/lib/llvm-10/share/clang/run-clang-tidy.py -quiet -p=./build/Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 2464e4978..4e9bf11d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,6 @@ find_package(nlohmann_json REQUIRED) find_package(glog REQUIRED) find_package(prometheus-cpp REQUIRED) find_package(fmt REQUIRED) -include_directories(${fmt_INCLUDE_DIR}) set(CMAKE_CXX_STANDARD 17) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OS X deployment version" FORCE) @@ -137,6 +136,7 @@ list(APPEND KNOWHERE_LINKER_LIBS faiss) list(APPEND KNOWHERE_LINKER_LIBS glog::glog) list(APPEND KNOWHERE_LINKER_LIBS nlohmann_json::nlohmann_json) list(APPEND KNOWHERE_LINKER_LIBS prometheus-cpp::core prometheus-cpp::push) +list(APPEND KNOWHERE_LINKER_LIBS fmt::fmt-header-only) list(APPEND KNOWHERE_LINKER_LIBS ${FOLLY_LIBRARIES}) add_library(knowhere SHARED ${KNOWHERE_SRCS}) diff --git a/cmake/libs/libdiskann.cmake b/cmake/libs/libdiskann.cmake index 58ec83601..75b5d4c64 100644 --- a/cmake/libs/libdiskann.cmake +++ b/cmake/libs/libdiskann.cmake @@ -28,6 +28,7 @@ target_link_libraries(diskann PUBLIC ${AIO_LIBRARIES} ${DISKANN_BOOST_PROGRAM_OPTIONS_LIB} nlohmann_json::nlohmann_json Folly::folly + fmt::fmt-header-only glog::glog) if(__X86_64) target_compile_options( diff --git a/conanfile.py b/conanfile.py index 920871819..c9a01d903 100644 --- a/conanfile.py +++ b/conanfile.py @@ -4,6 +4,7 @@ from conan.tools import files from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.gnu import PkgConfigDeps from conan.errors import ConanInvalidConfiguration from conans import tools import os @@ -19,8 +20,6 @@ class KnowhereConan(ConanFile): homepage = "https://github.com/milvus-io/knowhere" license = "Apache-2.0" - generators = {"pkg_config","cmake_find_package"} - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -157,9 +156,13 @@ def generate(self): tc.variables["WITH_BENCHMARK"] = self.options.with_benchmark tc.variables["WITH_COVERAGE"] = self.options.with_coverage tc.generate() + deps = CMakeDeps(self) deps.generate() + pc = PkgConfigDeps(self) + pc.generate() + def build(self): # files.apply_conandata_patches(self) cmake = CMake(self) diff --git a/python/setup.py b/python/setup.py index f25c8eabb..814d200a6 100644 --- a/python/setup.py +++ b/python/setup.py @@ -30,7 +30,7 @@ def run(self): def get_thirdparty_prefix(lib_name): prefix = "" - with open(os.path.join("..", "build", lib_name + ".pc")) as f: + with open(os.path.join("..", "build", "Release", "generators", lib_name + ".pc")) as f: for line in f.readlines(): if line.startswith("prefix="): prefix = line.strip().split("=")[1]