1 先找一个例程。里面用到halide。
这时会提示找不到package。
按照那个提示做就行。
2 把提前下载好的halide放到一个位置
3 然后设置一下那个Halide_DIR就可以了
set(Halide_DIR "${CMAKE_SOURCE_DIR}/your_path/Halide/")
list(APPEND CMAKE_PREFIX_PATH ${Halide_DIR})
这种方法有个问题 就是不能找halide依赖的库,ZLIB,PNG,JPEG。
解决方法是
直接在那个cmake_prefix_path 里面多加上这一句
这样做就是慢一些文章来源:https://www.toymoban.com/news/detail-833051.html
参考opencv库的make 方式文章来源地址https://www.toymoban.com/news/detail-833051.html
set(Opencv_root "${CMAKE_SOURCE_DIR}/your_path/opencv")
set(Opencv_INCLUDE_DIRS "${Opencv_root}/include/")
set(world_lib "${Opencv_root}/lib/release/opencv_world454.lib")
set(world_d_lib "${Opencv_root}/lib/debug/opencv_world454d.lib")
add_library(opencv::world UNKNOWN IMPORTED)
set_target_properties(
opencv::world
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS}
IMPORTED_LOCATION_DEBUG "${world_d_lib}"
IMPORTED_LOCATION_RELEASE "${world_lib}"
IMPORTED_LOCATION_RELWITHDEBINFO "${world_lib}")
set(libpng_lib "${Opencv_root}/lib/release/libpng.lib")
set(libpng_d_lib "${Opencv_root}/lib/debug/libpngd.lib")
add_library(opencv::libpng UNKNOWN IMPORTED)
set_target_properties(
opencv::libpng
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS}
IMPORTED_LOCATION_DEBUG ${libpng_d_lib}
IMPORTED_LOCATION_RELEASE ${libpng_lib}
IMPORTED_LOCATION_RELWITHDEBINFO "${libpng_lib}")
set(zlib_lib "${Opencv_root}/lib/release/zlib.lib")
set(zlib_d_lib "${Opencv_root}/lib/debug/zlibd.lib")
add_library(opencv::zlib UNKNOWN IMPORTED)
set_target_properties(
opencv::zlib
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS}
IMPORTED_LOCATION_DEBUG ${zlib_d_lib}
IMPORTED_LOCATION_RELEASE ${zlib_lib}
IMPORTED_LOCATION_RELWITHDEBINFO "${zlib_lib}")
set(libjpegturbo_lib "${Opencv_root}/lib/release/libjpeg-turbo.lib")
set(libjpegturbo_d_lib "${Opencv_root}/lib/debug/libjpeg-turbod.lib")
add_library(opencv::libjpegturbo UNKNOWN IMPORTED)
set_target_properties(
opencv::libjpegturbo
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS}
IMPORTED_LOCATION_DEBUG ${libjpegturbo_d_lib}
IMPORTED_LOCATION_RELEASE ${libjpegturbo_lib}
IMPORTED_LOCATION_RELWITHDEBINFO "${libjpegturbo_lib}")
set(libopenjp2_lib "${Opencv_root}/lib/release/libopenjp2.lib")
set(libopenjp2_d_lib "${Opencv_root}/lib/debug/libopenjp2d.lib")
add_library(opencv::libopenjp2 UNKNOWN IMPORTED)
set_target_properties(
opencv::libopenjp2
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS}
IMPORTED_LOCATION_DEBUG ${libopenjp2_d_lib}
IMPORTED_LOCATION_RELEASE ${libopenjp2_lib}
IMPORTED_LOCATION_RELWITHDEBINFO "${libopenjp2_lib}")
add_library(opencv INTERFACE IMPORTED)
set_property(
TARGET opencv PROPERTY INTERFACE_LINK_LIBRARIES opencv::world opencv::libpng
opencv::zlib opencv::libjpegturbo opencv::libopenjp2)
到了这里,关于halide package cmake的设置方式的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!