我使用创建了定制的OpenCV包,并将其上传到远程存储中。
工作流程:
cd c:\path\to\conanfile.py conan创建。smart/4.26 --profile ue4
conan export . opencv-ue4/3.4.0@smart/4.26结果:
c:\path> conan出口。opencv-ue4/3.4.0@smart/4.26钩子- attribute_checker.py pre_export():警告: Conanfile没有'url‘。建议将其添加为属性导出包配方opencv-ue4/3.4.0@smart/4.26 exports_sources:复制3 '.patch‘文件: cmakes.patch、check_function.patch、typedefs.patch opencv-ue4/3.4.0@smart/4.26:存储的包没有更改opencv-ue4/3.4.0@smart/4.26:导出版本:.patch
c:\path> conan上传-r bart opencv-ue4/3.4.0@rs7-smart/4.26 -所有上传到远程“bart”:上传opencv-ue4/3.4.0@smart/4.26到远程“bart”配方是最新的,1/1: 1d79899922d252aec6da136ce61bff640124c1c4上传到“bart”上传的conan_package.tgz -> opencv-ue4/3.4.0@smart/4.26:1d7923667.97k上载conaninfo.txt -> opencv-ue4/3.4.0@smart/4.26:1d790.75k上传conanmanifest.txt -> opencv-ue4/3.4.0@smart/4.26:1d7911.81k
我们的远程存储运行在Artifactory上,我可以在浏览器中看到conanfile.py在任何地方都没有列出。
我还可以验证Windows上的目录C:\Users\user\.conan\data\opencv-ue4\3.4.0\smart\4.26\export是否包含conanfile.py和conanmanifest.txt
我正在使用Windows来做以上所有的事情。
现在我试图在另一台机器上使用这个包,运行Ubuntu。
这是我的conanfile.txt
[requires]
opencv-ue4/3.4.0@smart/4.26
[generators]
json命令和结果
> conan install -g json . opencv-ue4/3.4.0@smart/4.26
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=9
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
opencv-ue4/3.4.0@smart/4.26: Not found in local cache, looking in remotes...
opencv-ue4/3.4.0@smart/4.26: Trying with 'bart'...
Downloading conanmanifest.txt completed [0.33k]
opencv-ue4/3.4.0@-smart/4.26: Downloaded recipe revision 0
ERROR: opencv-ue4/3.4.0@smart/4.26: Cannot load recipe.
Error loading conanfile at '/home/user/.conan/data/opencv-ue4/3.4.0/smart/4.26/export/conanfile.py': /home/user/.conan/data/opencv-ue4/3.4.0/smart/4.26/export/conanfile.py not found!运行ls -la /home/user/.conan/data/opencv-ue4/3.4.0/smart/4.26/export/显示,该目录实际上只包含文件conanmanifest.txt。
下面是我用来构建包的conanfile.py的相关部分
from conans import ConanFile, CMake, tools
class OpenCVUE4Conan(ConanFile):
name = "opencv-ue4"
version = "3.4.0"
url = ""
description = "OpenCV custom build for UE4"
license = "BSD"
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
exports_sources = 'patches/cmakes.patch', 'patches/check_function.patch', 'patches/typedefs.patch'
def requirements(self):
self.requires("ue4util/ue4@adamrehn/profile")
self.requires("zlib/ue4@adamrehn/{}".format(self.channel))
self.requires("UElibPNG/ue4@adamrehn/{}".format(self.channel))
def cmake_flags(self):
flags = [
"-DOPENCV_ENABLE_NONFREE=OFF",
# cut
]
return flags
def source(self):
self.run("git clone --depth=1 https://github.com/opencv/opencv.git -b {}".format(self.version))
self.run("git clone --depth=1 https://github.com/opencv/opencv_contrib.git -b {}".format(self.version))
def build(self):
# Patch OpenCV to avoid build errors
for p in self.exports_sources:
if p.endswith(".patch"):
tools.patch(base_path='opencv', patch_file=p, fuzz=True)
cmake = CMake(self)
cmake.configure(source_folder="opencv", args=self.cmake_flags())
cmake.build()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)Windows和Linux中的Conan版本都是1.54.0
如何正确上传和使用包?
更新.
在与@drodri对话后,我从exports_sources中删除了exports_sources,删除了所有PC中的所有conan生成的文件,并删除了从Artifactory中上传的文件。
然后我重建了这个包,重新导出并上传了它。
发布于 2022-11-09 08:53:53
这个问题受到了我们的艺术的限制。管理员禁止上传.py文件。
https://stackoverflow.com/questions/74362535
复制相似问题