mirror of
https://github.com/PartialVolume/shredos.x86_64.git
synced 2026-03-01 22:12:12 +00:00
Upgrade buildroot to 2023.05 (from 2021.08.2), kernel is upgraded to 6.3 (from 5.13.19).
This commit is contained in:
@@ -0,0 +1 @@
|
||||
source "$BR2_EXTERNAL_PYTHON_PYBIND_PATH/package/python-pybind-example/Config.in"
|
||||
@@ -0,0 +1 @@
|
||||
name: PYTHON_PYBIND
|
||||
@@ -0,0 +1 @@
|
||||
include $(sort $(wildcard $(BR2_EXTERNAL_PYTHON_PYBIND_PATH)/package/*/*.mk))
|
||||
@@ -0,0 +1,6 @@
|
||||
config BR2_PACKAGE_PYTHON_PYBIND_EXAMPLE
|
||||
bool "python-pybind-example"
|
||||
depends on BR2_PACKAGE_PYTHON3
|
||||
select BR2_PACKAGE_PYTHON_PYBIND
|
||||
help
|
||||
This test creates a cpp macro later used on target in python
|
||||
@@ -0,0 +1,16 @@
|
||||
#include <pybind11/pybind11.h>
|
||||
namespace py = pybind11;
|
||||
|
||||
int add (int i, int j) {
|
||||
return i + j;
|
||||
}
|
||||
|
||||
PYBIND11_MODULE (example, m) {
|
||||
// optional module description
|
||||
m.doc() = "pybind11 example plugin";
|
||||
// test a module method
|
||||
m.def("add", &add, "example::add adds two integer numbers");
|
||||
// test a module attribute
|
||||
py::object hello = py::cast("Hello World");
|
||||
m.attr("says") = hello;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
################################################################################
|
||||
#
|
||||
# python-pybind-example
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# this builds a C++ macro "add(a,b)"
|
||||
# that we expose to host-python with a custom install
|
||||
# and that the python test script will later use
|
||||
PYTHON_PYBIND_EXAMPLE_DEPENDENCIES = python-pybind
|
||||
|
||||
PYTHON_PYBIND_EXAMPLE_PYBIND_INCLUDE = \
|
||||
$(shell $(HOST_DIR)/bin/python3 -c 'import pybind11; print(pybind11.get_include())')
|
||||
|
||||
PYTHON_PYBIND_EXAMPLE_CXX_FLAGS = \
|
||||
$(TARGET_CXXFLAGS) \
|
||||
-Wall -shared -std=c++11 -fPIC \
|
||||
-I$(PYTHON_PYBIND_EXAMPLE_PYBIND_INCLUDE) \
|
||||
$(shell $(STAGING_DIR)/usr/bin/python3-config --includes --libs --ldflags)
|
||||
|
||||
# .so to be installed must have exact suffix
|
||||
# otherwise import() in python will not work
|
||||
HOST_LIB_BINARY_SUFFIX = \
|
||||
$(shell $(STAGING_DIR)/usr/bin/python3-config --extension-suffix)
|
||||
|
||||
define PYTHON_PYBIND_EXAMPLE_BUILD_CMDS
|
||||
if [ -z "$(PYTHON_PYBIND_EXAMPLE_PYBIND_INCLUDE)" ]; then \
|
||||
echo "pybind11.get_include() returned empty"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(TARGET_CXX) $(PYTHON_PYBIND_EXAMPLE_CXX_FLAGS) \
|
||||
$(PYTHON_PYBIND_EXAMPLE_PKGDIR)/example.cpp \
|
||||
-o $(@D)/example$(HOST_LIB_BINARY_SUFFIX)
|
||||
endef
|
||||
|
||||
define PYTHON_PYBIND_EXAMPLE_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -D -m 755 $(@D)/example$(HOST_LIB_BINARY_SUFFIX) \
|
||||
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/example$(HOST_LIB_BINARY_SUFFIX)
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user