File: CMakeLists.txt

package info (click to toggle)
halide 21.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,752 kB
  • sloc: cpp: 289,334; ansic: 22,751; python: 7,486; makefile: 4,299; sh: 2,508; java: 1,549; javascript: 282; pascal: 207; xml: 127; asm: 9
file content (85 lines) | stat: -rw-r--r-- 2,283 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
cmake_minimum_required(VERSION 3.28)
project(Halide_Python VERSION 21.0.0)

if (PROJECT_IS_TOP_LEVEL)
    enable_testing()
endif ()

include(CMakeDependentOption)

##
# Project options
##

# Preferred defaults for built-in options
set(CMAKE_CXX_STANDARD 17 CACHE STRING "The minimum C++ standard to use")
option(CMAKE_CXX_STANDARD_REQUIRED "Prevent CMake C++ standard selection decay" ON)
option(CMAKE_CXX_EXTENSIONS "Enable C++ vendor extensions (e.g. GNU)" OFF)

# Duplicated options from parent project
option(WITH_TESTS "Build tests" "${PROJECT_IS_TOP_LEVEL}")
option(WITH_TUTORIALS "Build tutorials" "${PROJECT_IS_TOP_LEVEL}")
option(WITH_PACKAGING "Include install() rules" "${PROJECT_IS_TOP_LEVEL}")

# Support not actually building the bindings, but using the ones we find
# via `find_package(Halide)`. This allows running tests against the
# installed Halide package.
option(WITH_PYTHON_BINDINGS "Build Python bindings" ON)

cmake_dependent_option(
    WITH_PYTHON_STUBS "Build Python stubs" ON
    WITH_PYTHON_BINDINGS OFF
)

cmake_dependent_option(
    WITH_TEST_PYTHON "Build Python tests" ON
    WITH_TESTS OFF
)

##
# Dependencies
##

# The plain Development component is the same as requesting both
# Development.Module and Development.Embed. We don't need the Embed
# part, so only requesting Module avoids failures when Embed is not
# available, as is the case in the manylinux Docker images.
find_package(Python 3.9 REQUIRED Interpreter Development.Module)

if (WITH_PYTHON_BINDINGS)
    find_package(pybind11 2.11.1 REQUIRED)
endif ()

# Note: this must happen, especially when WITH_PYTHON_BINDINGS is OFF.
find_package(Halide REQUIRED Halide)
if (NOT Halide_ENABLE_RTTI OR NOT Halide_ENABLE_EXCEPTIONS)
    message(FATAL_ERROR "Python bindings require RTTI and exceptions to be enabled.")
endif ()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(AddPythonTest)

##
# Add our sources to this sub-tree.
##

if (WITH_PYTHON_BINDINGS)
    add_subdirectory(src)
endif ()

if (WITH_PYTHON_STUBS)
    add_subdirectory(stub)
endif ()

if (WITH_TEST_PYTHON)
    add_subdirectory(apps)
    add_subdirectory(test)
endif ()

if (WITH_TUTORIALS)
    add_subdirectory(tutorial)
endif ()

if (WITH_PACKAGING)
    add_subdirectory(packaging)
endif ()