File: OpenCVDetectHalide.cmake

package info (click to toggle)
opencv 4.10.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 282,092 kB
  • sloc: cpp: 1,178,079; xml: 682,621; python: 49,092; lisp: 31,150; java: 25,469; ansic: 11,039; javascript: 6,085; sh: 1,214; cs: 601; perl: 494; objc: 210; makefile: 173
file content (47 lines) | stat: -rw-r--r-- 1,365 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION ${MIN_VER_CMAKE})

if(" ${HALIDE_ROOT_DIR}" STREQUAL " ")
  unset(HALIDE_ROOT_DIR CACHE)
endif()
ocv_check_environment_variables(HALIDE_ROOT_DIR)
set(HALIDE_ROOT_DIR "${HALIDE_ROOT_DIR}" CACHE PATH "Halide root directory")

if(NOT HAVE_HALIDE)
  find_package(Halide QUIET) # Try CMake-based config files
  if(Halide_FOUND)
    if(TARGET Halide::Halide)  # modern Halide scripts defines imported target
      set(HALIDE_INCLUDE_DIRS "")
      set(HALIDE_LIBRARIES "Halide::Halide")
      set(HAVE_HALIDE TRUE)
    else()
      # using HALIDE_INCLUDE_DIRS / Halide_LIBRARIES
      set(HAVE_HALIDE TRUE)
    endif()
  endif()
endif()

if(NOT HAVE_HALIDE AND HALIDE_ROOT_DIR)
  # Try manual search
  find_library(HALIDE_LIBRARY
      NAMES Halide
      HINTS ${HALIDE_ROOT_DIR}/lib          # Unix
      HINTS ${HALIDE_ROOT_DIR}/lib/Release  # Win32
  )
  find_path(HALIDE_INCLUDE_DIR
      NAMES Halide.h HalideRuntime.h
      HINTS ${HALIDE_ROOT_DIR}/include
  )
  if(HALIDE_LIBRARY AND HALIDE_INCLUDE_DIR)
    # TODO try_compile
    set(HALIDE_INCLUDE_DIRS "${HALIDE_INCLUDE_DIR}")
    set(HALIDE_LIBRARIES "${HALIDE_LIBRARY}")
    set(HAVE_HALIDE TRUE)
  endif()
endif()

if(HAVE_HALIDE)
  if(HALIDE_INCLUDE_DIRS)
    include_directories(${HALIDE_INCLUDE_DIRS})
  endif()
  list(APPEND OPENCV_LINKER_LIBS ${HALIDE_LIBRARIES})
endif()