1.6 conan
远程已经编译好的库
conan中文博客:
三方库资源:
github conan-io
本地查询
conan search
Existing package recipes:
b2/4.9.6
boost/1.71.0@nolovr/stable
bzip2/1.0.8
ceres-solver/2.0.0@nolovr/stable
eigen/3.3.7@nolovr/stable
eigen_checks/master@nolovr/stable
本地编译
首先修改 ‘/home/sun/.conan/profiles/default’ 文档,编辑配置如下;
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
[build_requires]
[options]
[env]
CC=/usr/bin/clang-9
CXX=/usr/bin/clang++-9
执行下面命令,开始编译:
找到onetbb_nlvr 文件包含conanfile.py 在上一层文件打开 执行下面命令,conan自动寻找 .py 开始本地编译onetbb库。
conan create . --build=missing
commands资料
$ conan create [-h] [-j JSON] [-k] [-kb] [-ne] [-tbf TEST_BUILD_FOLDER]
[-tf TEST_FOLDER] [--ignore-dirty] [--build-require]
[--require-override REQUIRE_OVERRIDE] [-m [MANIFESTS]]
[-mi [MANIFESTS_INTERACTIVE]] [-v [VERIFY]] [-b [BUILD]]
[-r REMOTE] [-u] [-l LOCKFILE]
[--lockfile-out LOCKFILE_OUT] [-e ENV_HOST]
[-e:b ENV_BUILD] [-e:h ENV_HOST] [-o OPTIONS_HOST]
[-o:b OPTIONS_BUILD] [-o:h OPTIONS_HOST]
[-pr PROFILE_HOST] [-pr:b PROFILE_BUILD]
[-pr:h PROFILE_HOST] [-s SETTINGS_HOST]
[-s:b SETTINGS_BUILD] [-s:h SETTINGS_HOST]
[-c CONF_HOST] [-c:b CONF_BUILD] [-c:h CONF_HOST]
path [reference]
根据cnakelists.txt中添加的三方库选项去匹配本地库,cmkaelists如下所是:
#conan config
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_C_COMPILER "clang-9")
set(CMAKE_CXX_COMPILER "clang++-9")
set(CMAKE_CXX_FLAGS "-Wall --std=c++17 -fPIC -march=native -D_LINUX -D_REENTRANT")
set(CONAN_PROFILE ../conan_cmake/conan_profiles/linux.profile)
elseif (CMAKE_SYSTEM_NAME MATCHES "Android")
set(CMAKE_CXX_FLAGS "-Wall --std=c++17 -fPIC")
set(CONAN_PROFILE ../conan_cmake/conan_profiles/arm.profile)
else ()
message("not support this platform")
endif ()
project(polaris C CXX ASM)
include(conan_cmake/conan.cmake)
set(ENV{CONAN_REVISIONS_ENABLED} 1)
conan_add_remote(NAME nolovr
INDEX 0
URL http://server ip:server port/artifactory/api/conan/nlvr
VERIFY_SSL TRUE)
conan_cmake_run(
PROFILE ${CONAN_PROFILE}
REQUIRES eigen/3.3.7@nolovr/stable
eigen_checks/master@nolovr/stable
REQUIRES opencv/3.4.17@nolovr/stable
REQUIRES onetbb/2021.3.0@nolovr/stable
REQUIRES kindr/master@nolovr/stable
REQUIRES eigen_checks/master@nolovr/stable
BASIC_SETUP CMAKE_TARGETS
SETTINGS build_type=Release
BUILD missing
)
conan_global_flags()
add_compile_definitions(COMMIT_ID="${COMMIT_ID}")
set(TIGER_DOES_EXIST_IN_MOUNTAIN TRUE)
add_definitions(-DTIGER_DOES_EXIST_IN_MOUNTAIN)
# end conan config
本地上传
实例:
conan upload onetbb/2021.3.0@nlvr/stable --all -r nlvr
$ conan upload [-h] [-p PACKAGE] [-q QUERY] [-r REMOTE] [--all]
[--skip-upload] [--force] [--check] [-c] [--retry RETRY]
[--retry-wait RETRY_WAIT] [-no [{all,recipe}]] [-j JSON]
[--parallel]
pattern_or_reference