Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pybind11 minimum version check compatible with pybind11 v3. #8366

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions python_bindings/src/halide/halide_/PyHalide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@
#include "PyType.h"
#include "PyVar.h"

static_assert(PYBIND11_VERSION_MAJOR == 2 && PYBIND11_VERSION_MINOR >= 6,
"Halide requires PyBind 2.6+");
#if !defined(PYBIND11_VERSION_HEX) || PYBIND11_VERSION_HEX < 0x02060000
#error "Halide requires PyBind 2.6+"
#endif

static_assert(PY_VERSION_HEX >= 0x03000000,
"We appear to be compiling against Python 2.x rather than 3.x, which is not supported.");
// Note: This check will be redundant when PyBind 2.10 becomes the minimum version.
#if PY_VERSION_HEX < 0x03000000
#error "We appear to be compiling against Python 2.x rather than 3.x, which is not supported."
#endif

#ifndef HALIDE_PYBIND_MODULE_NAME
#define HALIDE_PYBIND_MODULE_NAME halide_
Expand Down
13 changes: 8 additions & 5 deletions python_bindings/stub/PyStubImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@

#include "Halide.h"

static_assert(PYBIND11_VERSION_MAJOR == 2 && PYBIND11_VERSION_MINOR >= 6,
"Halide requires PyBind 2.6+");

static_assert(PY_VERSION_HEX >= 0x03000000,
"We appear to be compiling against Python 2.x rather than 3.x, which is not supported.");
#if !defined(PYBIND11_VERSION_HEX) || PYBIND11_VERSION_HEX < 0x02060000
#error "Halide requires PyBind 2.6+"
#endif

// Note: This check will be redundant when PyBind 2.10 becomes the minimum version.
#if PY_VERSION_HEX < 0x03000000
#error "We appear to be compiling against Python 2.x rather than 3.x, which is not supported."
#endif

namespace py = pybind11;

Expand Down
Loading