Skip to content
Snippets Groups Projects
Verified Commit f6c9ee45 authored by Pavel Doležal's avatar Pavel Doležal
Browse files

Add pybind11 as git submodule

To build Python bindings on older Linux distributions we add pybind11
as a git submodule directly to the repository and remove pyproject.toml
file. We also add '--no-index' option to 'pip3 install ...' command to
build the bindings offline in OBS.
parent 489ebded
No related merge requests found
Pipeline #109720 passed with stage
in 3 minutes and 21 seconds
[submodule "extern/pybind11"]
path = extern/pybind11
url = https://github.com/pybind/pybind11
......@@ -59,18 +59,13 @@ install(FILES ${CMAKE_BINARY_DIR}/src/cdns.pc
)
if (BUILD_PYTHON_BINDINGS)
find_package(Python3 REQUIRED)
find_package(pybind11 REQUIRED)
set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/python/setup.py.in")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(PYPROJECT "${CMAKE_CURRENT_SOURCE_DIR}/python/pyproject.toml")
file(COPY ${PYPROJECT} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
configure_file(${SETUP_PY_IN} ${SETUP_PY})
add_custom_target(pycdns ALL
COMMAND pip3 install --prefix=${CMAKE_CURRENT_BINARY_DIR}/build_python/ ${CMAKE_CURRENT_BINARY_DIR}
COMMAND pip3 install --no-index --prefix=${CMAKE_CURRENT_BINARY_DIR}/build_python/ ${CMAKE_CURRENT_BINARY_DIR}
)
add_dependencies(pycdns cdns)
......
Subproject commit 914c06fb252b6cc3727d0eedab6736e88a3fcb01
[build-system]
requires = [
"setuptools>=33",
"pybind11>=2.9.0",
]
build-backend = "setuptools.build_meta"
import os
import sys
from glob import glob
from pybind11.setup_helpers import Pybind11Extension, build_ext
DIR = "@CMAKE_CURRENT_SOURCE_DIR@"
sys.path.append(os.path.join(DIR, "extern", "pybind11"))
from pybind11.setup_helpers import Pybind11Extension, build_ext # noqa: E402f
del sys.path[-1]
from setuptools import setup
__version__ = "@PROJECT_VERSION@"
......@@ -16,8 +22,8 @@ ext_modules = [
],
libraries=["cdns"],
library_dirs=["@CMAKE_CURRENT_BINARY_DIR@"],
extra_compile_args=['-msse4'],
define_macros=[('VERSION_INFO', __version__)],
extra_compile_args=["-msse4"],
define_macros=[("VERSION_INFO", __version__)],
cxx_std=14,
include_dirs=["@CMAKE_CURRENT_SOURCE_DIR@/src"]
),
......@@ -32,5 +38,10 @@ setup(
description="Python bindings for C++ C-DNS library",
ext_modules=ext_modules,
cmdclass={"build_ext": build_ext},
setup_requires=[
"setuptools>=33",
"wheel",
"pybind11>=2.9.0",
],
python_requires=">=3.5",
)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment