mac安装halide

  1. 安装命令
1
brew install halide

如果出现以下提示报错,可能是和我一样刚升级14 系统

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
➜  ~ brew install halide
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.

Warning: You are using macOS 14.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
pre-release version.

那需要重置一下 brew

1
brew update-reset
  1. cmake引入使用

简单的 cmake配置文件如下

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
cmake_minimum_required(VERSION 3.22)  
project(halide_test)

set(CMAKE_CXX_STANDARD 17)  
set(CMAKE_CXX_STANDARD_REQUIRED YES)  
set(CMAKE_CXX_EXTENSIONS NO)

find_package(Halide REQUIRED)  
if (Halide_FOUND)      
    message("halide version:" ${Halide_VERSION})  
endif ()

add_executable(halide_test main.cpp)  
target_link_libraries(halide_test PRIVATE Halide::Halide Halide::ImageIO)

执行 cmake的时候,如果报找不到 llvm相关的报错

1
2
3
4
Could not find a package configuration file provided by "LLVM" (requested version x.x.x) with any of the following names:

LLVMConfig.cmake
llvm-config.cmake

那可能有两种原因,一种是没安装 llvm,需要安装。另一种是安装了版本好对不上或者LLVM_DIR没加入环境变量,此时在 cmake的时候补上即可

1
cmake -DLLVM_DIR=<path_to_llvm_cmake_config_dir> ..

微信公众号