使用cmake查找onnx
使用cmake查找onnx
- 1、写onnx.cmake文件
1、写onnx.cmake文件
使用时可参考下面的修改后使用。
onnxruntimeVersion.cmake
# Custom cmake version file by jcariusset(PACKAGE_VERSION "1.7.0")# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()set(PACKAGE_VERSION_COMPATIBLE TRUE)if("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")set(PACKAGE_VERSION_EXACT TRUE)endif()
endif()
onnxruntimeConfig.cmake
# Custom cmake config file by jcarius to enable find_package(onnxruntime) without modifying LIBRARY_PATH and LD_LIBRARY_PATH
#
# This will define the following variables:
# onnxruntime_FOUND -- True if the system has the onnxruntime library
# onnxruntime_INCLUDE_DIRS -- The include directories for onnxruntime
# onnxruntime_LIBRARIES -- Libraries to link against
# onnxruntime_CXX_FLAGS -- Additional (required) compiler flagsinclude(FindPackageHandleStandardArgs)# Assume we are in <install-prefix>/share/cmake/onnxruntime/onnxruntimeConfig.cmake
get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(onnxruntime_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)set(onnxruntime_INCLUDE_DIRS ${onnxruntime_INSTALL_PREFIX}/include)
set(onnxruntime_LIBRARIES onnxruntime)
set(onnxruntime_CXX_FLAGS "") # no flags neededfind_library(onnxruntime_LIBRARY onnxruntimePATHS "${onnxruntime_INSTALL_PREFIX}/lib"
)add_library(onnxruntime SHARED IMPORTED)
set_property(TARGET onnxruntime PROPERTY IMPORTED_LOCATION "${onnxruntime_LIBRARY}")
set_property(TARGET onnxruntime PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${onnxruntime_INCLUDE_DIRS}")
set_property(TARGET onnxruntime PROPERTY INTERFACE_COMPILE_OPTIONS "${onnxruntime_CXX_FLAGS}")find_package_handle_standard_args(onnxruntime DEFAULT_MSG onnxruntime_LIBRARY onnxruntime_INCLUDE_DIRS)
参考:Setting up ONNX Runtime on Ubuntu 20.04 (C++ API)
使用cmake查找onnx相关推荐
- CMAKE查找库:find_package和pkg_check_moduls的区别
本文介绍 CMake 中两种查找库的方式:find_package 以及 pkg_check_modules 的用法与区别. find_package 如果编译软件使用了外部库,事先并不知道它的头文件 ...
- cmake添加查找目录_CMake如何查找库路径(一)
CMake如何查找库路径(一) 如果你的代码使用了外部库(external libraries),并且你事先不知道这些库的头文件和库文件在当前平台的位置.那么适当的文件夹路径和库的搜索路径就应该被添加 ...
- 利用TensorRT实现神经网络提速(读取ONNX模型并运行)
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到网站. 前言 这篇文章接着上一篇继续讲解如何具体使用TensorRT. 在之前已经写到过一篇去介绍什么是Te ...
- cmake错误:Could not find a configuration file for package “Eigen3“
感谢盛齐师兄指导.该博客记录了师兄的解决思路和原理讲解. 在编译某一开源工具包时,使用cmake编译报错: CMake Error at /(我的文件路径)/cmakelist.txt (find_p ...
- cmake:pkg_check_modules
此文为:轻松入门cmake系列教程 理论 是什么? pkg_check_modules是 CMake 自己的 pkg-config 模块的一个用来简化的封装:你不用再检查 CMake 的版本,加载合适 ...
- 使用CMake构建/开始使用CMake
Getting started with CMake 开始使用CMake CMake is a group of tools that allow to build, test, and packag ...
- CMake - 使用 target_sources() 提高源文件处理能力
翻译自https://crascit.com/2016/01/31/enhanced-source-file-handling-with-target_sources/ 使用 target_sourc ...
- linux cmake增量编译,Cmake 设置交叉编译环境
我用的是合众达的dm6446. 一 首先安装CMAKE 下载cmake 然后解压缩,进入解压缩后的目录,依次执行 # ./bootstrap # make && make insta ...
- ubuntu18.04 安装ceres,g2o,以及cmake升级
背景:在进行slam开发时,需要的一些包 一.ceres安装 1. 下载Ceres 方法一:直接下载 下载链接:https://github.com/ceres-solver/ceres-solver ...
最新文章
- SQL语句 - 嵌套查询
- 2018及以后的热门网络技巧
- 2016 年Adobe设计成就奖作品征集
- Android RelativeLayout和LinearLayout性能分析
- 最常见的读入数据方法集锦
- [TED] Kinect控制的四翼直升机
- PHP中 htmlspecialchars,htmlentities, nl2br函数
- [MOSS开发]:带托管代码的infopath2007表单创建, 发布,应用
- 全球信息数据量陡增 大数据应用前景广阔
- 解决办法:C代码中明明有,为什么编译时提示未定义的引用
- 利用tensorflow加载VGG19
- Arduino射频识别RC522至数据库
- 51单片机仿真设计项目大全
- [每日一氵] TensorRT中 GA和EA的不同
- php替换掉,php替换
- Python3 根据关键字爬取百度图片
- 2021年全球印度香米收入大约12530百万美元,预计2028年达到21670百万美元
- 中国汽车高级驾驶辅助系统(ADAS)行业十四五规划及投资动态分析报告2022-2028年版
- python opencv 剪切图片
- 各种Mapping的区别
热门文章
- Android BLE(低功耗蓝牙)技术总结
- html光标自动定位,div自动获焦并将光标定位到最后
- python-TGI指数分析实战
- 微型计算机控制技术 潘新民 ppt,微型计算机控制技术期末复习参考潘新民.ppt
- js中判断变量不为空或null或“”
- QT qDebug打印
- error LNK2001: 无法解析的外部符号 _sscanf 问题 解决方法
- html物理像素,用一篇文章了解ppi,dpr,物理像素,逻辑像素,以及二倍图
- 封装uniapp-uni-table组件,获取点击行事件,可传入自定义表头,传入后端数据,获取多选数据(其中行点击事件只有H5端可以用)附有完整代码
- 微信公众号开发最全整理