Skip to content

Commit 00343d4

Browse files
committed
Migrate to Conan 2.x
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent 538edea commit 00343d4

File tree

4 files changed

+47
-40
lines changed

4 files changed

+47
-40
lines changed

.github/workflows/ut.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,26 @@ jobs:
2828
- name: Install Dependency
2929
run: |
3030
sudo apt update && sudo apt install -y cmake libopenblas-dev libaio-dev g++-12 gcc-12 python3 python3-pip \
31-
&& pip3 install conan==1.65.0 \
32-
&& conan remote add default-conan-local https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local
31+
&& pip3 install conan==2.25.1 \
32+
&& conan profile detect \
33+
&& conan remote add default-conan-local2 https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local2
3334
- name: Restore Conan Packages
3435
uses: actions/cache@v4
3536
with:
36-
path: ~/.conan
37+
path: ~/.conan2
3738
key: milvus-common-ubuntu-22.04-${{ hashFiles('conanfile.py')}}
3839
restore-keys: milvus-common-ubuntu-22.04-
3940
- name: Build & Run
41+
env:
42+
CONAN_ARGS: '-o &:with_ut=True -o &:with_asan=True -s compiler.version=12 -s compiler.cppstd=17 -s build_type=Release -of .'
4043
run: |
41-
mkdir build && cd build && conan install .. --build=missing -o with_ut=True -o with_asan=True -s compiler.libcxx=libstdc++11 -s compiler.version=12 -s compiler.cppstd=17 -s build_type=Release && conan build .. \
44+
mkdir build && cd build \
45+
&& conan install .. --build=missing $CONAN_ARGS \
46+
&& conan build .. $CONAN_ARGS \
4247
&& ./test/test_cachinglayer/cachinglayer_test && ./test/all_tests
4348
- name: Save Conan Packages
4449
uses: actions/cache/save@v4
4550
with:
46-
path: ~/.conan
51+
path: ~/.conan2
4752
key: milvus-common-ubuntu-22.04-${{ hashFiles('conanfile.py')}}
4853
restore-keys: milvus-common-ubuntu-22.04-

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ conan: deps
2727
$(SDKROOT_ENV) \
2828
conan install . --build=missing \
2929
-s build_type=$(BUILD_TYPE) \
30-
-if $(BUILD_DIR)
30+
-of $(BUILD_DIR)
3131

3232
configure: conan
3333
cmake -S . -B $(BUILD_DIR) \

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ Milvus Common is a core component library that serves as a bridge between Milvus
1717
## Build from source
1818

1919
```
20-
pip install conan==1.64.0
20+
pip install conan==2.25.1
21+
conan profile detect
2122
mkdir build && cd build
22-
conan install .. --build=missing -o with_ut=True -s compiler.libcxx=libstdc++11 -s compiler.version=12 -s build_type=Release
23-
conan build ..
23+
conan install .. --build=missing -o "&:with_ut=True" -s compiler.cppstd=17 -s build_type=Release -of .
24+
conan build .. -of .
2425
2526
# run ut
2627
./test/test_cachinglayer/cachinglayer_test

conanfile.py

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
1+
required_conan_version = ">=2.0"
2+
13
from conan.tools.microsoft import is_msvc, msvc_runtime_flag
2-
from conan.tools.build import check_min_cppstd
4+
from conan.tools.build import check_min_cppstd, cppstd_flag
35
from conan.tools.scm import Version
46
from conan.tools import files
57
from conan import ConanFile
68
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
79
from conan.tools.gnu import PkgConfigDeps
810
from conan.errors import ConanInvalidConfiguration
9-
from conans import tools
1011
import os
1112

12-
required_conan_version = ">=1.55.0"
13-
1413
class MilvusCommonConan(ConanFile):
1514
settings = "os", "compiler", "build_type", "arch"
1615
requires = (
1716
"gtest/1.15.0",
18-
"glog/0.7.1",
19-
"fmt/11.0.2",
20-
"prometheus-cpp/1.2.4",
21-
"libcurl/8.10.1",
22-
"gflags/2.2.2",
23-
"opentelemetry-cpp/1.23.0@milvus/dev#bcd65b63b8db8447178ed93bbc94dcc0",
24-
"grpc/1.67.1@milvus/dev#5aa62c51bced448b83d7db9e5b3a13c7",
25-
"abseil/20250127.0",
26-
"xz_utils/5.4.5",
27-
"zlib/1.3.1",
28-
"libevent/2.1.12",
29-
"openssl/3.3.2",
30-
"folly/2024.08.12.00@milvus/dev#e09fc71826ce6b4568441910665f0889",
31-
"boost/1.83.0"
17+
"glog/0.7.1#a306e61d7b8311db8cb148ad62c48030",
18+
"fmt/11.0.2#eb98daa559c7c59d591f4720dde4cd5c",
19+
"prometheus-cpp/1.2.4#0918d66c13f97acb7809759f9de49b3f",
20+
"gflags/2.2.2#7671803f1dc19354cc90bd32874dcfda",
21+
"opentelemetry-cpp/1.23.0@milvus/dev#11bc565ec6e82910ae8f7471da756720",
22+
"grpc/1.67.1@milvus/dev#e05fe4470d8577922d7cb0a4356dc082",
23+
"abseil/20250127.0#481edcc75deb0efb16500f511f0f0a1c",
24+
"xz_utils/5.4.5#fc4e36861e0a47ecd4a40a00e6d29ac8",
25+
"zlib/1.3.1#8045430172a5f8d56ba001b14561b4ea",
26+
"libevent/2.1.12#95065aaefcd58d3956d6dfbfc5631d97",
27+
"folly/2024.08.12.00@milvus/dev#f9b2bdf162c0ec47cb4e5404097b340d",
28+
"boost/1.83.0#4e8a94ac1b88312af95eded83cd81ca8",
3229
)
3330

3431
options = {
@@ -37,26 +34,30 @@ class MilvusCommonConan(ConanFile):
3734
}
3835

3936
default_options = {
40-
"folly:shared": True,
41-
"gtest:build_gmock": True,
42-
"openssl:shared": True,
43-
"gflags:shared": True,
44-
"glog:with_gflags": True,
45-
"glog:shared": True,
46-
"prometheus-cpp:with_pull": False,
47-
"fmt:header_only": False,
48-
"opentelemetry-cpp:with_stl": True,
37+
"folly/*:shared": True,
38+
"gtest/*:build_gmock": True,
39+
"openssl/*:shared": True,
40+
"gflags/*:shared": True,
41+
"glog/*:with_gflags": True,
42+
"glog/*:shared": True,
43+
"prometheus-cpp/*:with_pull": False,
44+
"fmt/*:header_only": False,
45+
"opentelemetry-cpp/*:with_stl": True,
4946
"with_ut": False,
5047
"with_asan": False,
5148
}
5249

5350
def requirements(self):
5451
# Force all dependencies to use protobuf from milvus/dev channel
5552
# This is needed to resolve conflicts between opentelemetry-cpp and grpc
56-
self.requires("protobuf/5.27.0@milvus/dev#6fff8583e2fe32babef04a9097f1d581", force=True, override=True)
57-
self.requires("lz4/1.9.4", force=True, override=True)
53+
self.requires("protobuf/5.27.0@milvus/dev#42f031a96d21c230a6e05bcac4bdd633", force=True, override=True)
54+
self.requires("lz4/1.9.4#7f0b5851453198536c14354ee30ca9ae", force=True, override=True)
55+
# Force overrides openssl to resolve opentelemetry-cpp's transitive deps
56+
self.requires("openssl/3.3.2#9f9f130d58e7c13e76bb8a559f0a6a8b", force=True, override=True)
57+
self.requires("libcurl/8.10.1#a3113369c86086b0e84231844e7ed0a9", force=True, override=True)
58+
self.requires("nlohmann_json/3.11.3#ffb9e9236619f1c883e36662f944345d", force=True)
5859
if self.settings.os != "Macos":
59-
self.requires("libunwind/1.8.1")
60+
self.requires("libunwind/1.8.1#748a981ace010b80163a08867b732e71")
6061

6162
@property
6263
def _minimum_cpp_standard(self):
@@ -75,7 +76,7 @@ def generate(self):
7576
# Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840)
7677
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
7778

78-
cxx_std_flag = tools.cppstd_flag(self.settings)
79+
cxx_std_flag = cppstd_flag(self)
7980
cxx_std_value = (
8081
cxx_std_flag.split("=")[1]
8182
if cxx_std_flag

0 commit comments

Comments
 (0)