mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Artur Wiebe <artur@4wiebe.de>
To: ptxdist@pengutronix.de
Cc: Artur Wiebe <artur@4wiebe.de>
Subject: [ptxdist] [PATCH] opencv: added option to build/install python bindings
Date: Mon, 24 Aug 2020 15:27:23 +0200	[thread overview]
Message-ID: <20200824132723.2119445-1-artur@4wiebe.de> (raw)

Signed-off-by: Artur Wiebe <artur@4wiebe.de>
---
 rules/opencv.in   |  7 +++++++
 rules/opencv.make | 18 +++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/rules/opencv.in b/rules/opencv.in
index 8f39ec395..9c50bb4dc 100644
--- a/rules/opencv.in
+++ b/rules/opencv.in
@@ -15,6 +15,7 @@ menuconfig OPENCV
 	select V4L_UTILS		if OPENCV_V4L_LIBV4L2
 	select V4L_UTILS_LIBV4L1	if OPENCV_V4L_LIBV4L2
 	select V4L_UTILS_LIBV4L2	if OPENCV_V4L_LIBV4L2
+	select PYTHON3_NUMPY	if OPENCV_PYTHON
 	help
 	  Open Source Computer Vision Library
 
@@ -138,6 +139,12 @@ config OPENCV_QT
 	help
 	  QT GUI Support
 
+config OPENCV_PYTHON
+	bool
+	prompt "Python bindings"
+	help
+	  Python bindings
+
 config OPENCV_EXAMPLES
 	bool
 	prompt "Build Examples"
diff --git a/rules/opencv.make b/rules/opencv.make
index 844b39f05..29b29bd2e 100644
--- a/rules/opencv.make
+++ b/rules/opencv.make
@@ -73,7 +73,8 @@ OPENCV_CONF_OPT		:= \
 	-DBUILD_opencv_ml:BOOL=$(call ptx/onoff,PTXCONF_OPENCV_ML) \
 	-DBUILD_opencv_objdetect:BOOL=$(call ptx/onoff,PTXCONF_OPENCV_OBJDETECT) \
 	-DBUILD_opencv_photo:BOOL=$(call ptx/onoff,PTXCONF_OPENCV_PHOTO) \
-	-DBUILD_opencv_python_bindings_generator=ON \
+	-DBUILD_opencv_python3=$(call ptx/onoff,PTXCONF_OPENCV_PYTHON) \
+	-DBUILD_opencv_python_bindings_generator=$(call ptx/onoff,PTXCONF_OPENCV_PYTHON) \
 	-DBUILD_opencv_python_tests=ON \
 	-DBUILD_opencv_stitching:BOOL=$(call ptx/onoff,PTXCONF_OPENCV_STITCHING) \
 	-DBUILD_opencv_ts:BOOL=OFF \
@@ -120,7 +121,13 @@ OPENCV_CONF_OPT		:= \
 	-DOPENCV_FORCE_3RDPARTY_BUILD=OFF \
 	-DOPENCV_GENERATE_PKGCONFIG=ON \
 	-DOPENCV_GENERATE_SETUPVARS=ON \
-	-DOPENCV_PYTHON3_VERSION=OFF \
+	-DOPENCV_PYTHON3_VERSION=$(PYTHON3_MAJORMINOR) \
+	-DPYTHON3_EXECUTABLE=$(PTXDIST_SYSROOT_CROSS)/bin/python$(PYTHON3_MAJORMINOR) \
+	-DPYTHON_INCLUDE_DIR=$(PTXDIST_SYSROOT_TARGET)/usr/include/python$(PYTHON3_MAJORMINOR)m \
+	-DPYTHON_LIBRARY=$(PTXDIST_SYSROOT_TARGET)/bin/python$(PYTHON3_MAJORMINOR) \
+	-DPYTHON3_NUMPY_INCLUDE_DIRS=$(PTXDIST_SYSROOT_TARGET)$(PYTHON3_SITEPACKAGES)/numpy/core/include/ \
+	-DOPENCV_PYTHON3_INSTALL_PATH=$(PYTHON3_SITEPACKAGES) \
+	-DOPENCV_SKIP_PYTHON_LOADER=ON \
 	-DOPENCV_WARNINGS_ARE_ERRORS:BOOL=OFF \
 	-DPROTOBUF_UPDATE_FILES=OFF \
 	-DWITH_1394:BOOL=OFF \
@@ -221,7 +228,12 @@ $(STATEDIR)/opencv.targetinstall:
 
 	@$(foreach lib, $(OPENCV_LIBS-y), \
 		$(call install_lib, opencv, 0, 0, 0644, $(lib));)
-	@$(call install_tree, opencv, 0, 0, $(OPENCV_BUILD_DIR)/bin, /bin)
+	@$(call install_tree, opencv, 0, 0, -, /usr/bin)
+
+ifdef PTXCONF_OPENCV_PYTHON
+	@$(call install_tree, opencv, 0, 0, -, $(PYTHON3_SITEPACKAGES))
+endif
+
 	@$(call install_finish, opencv)
 	@$(call touch)
 
-- 
2.28.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

             reply	other threads:[~2020-08-24 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 13:27 Artur Wiebe [this message]
2020-09-16 11:19 Artur Wiebe
2020-09-22 10:16 ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200824132723.2119445-1-artur@4wiebe.de \
    --to=artur@4wiebe.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox