* [ptxdist] [PATCH] opencv: added option to build/install python bindings
@ 2020-09-16 11:19 Artur Wiebe
2020-09-22 10:16 ` Michael Olbrich
2020-10-06 8:18 ` [ptxdist] [APPLIED] " Michael Olbrich
0 siblings, 2 replies; 6+ messages in thread
From: Artur Wiebe @ 2020-09-16 11:19 UTC (permalink / raw)
To: ptxdist; +Cc: Artur Wiebe
Signed-off-by: Artur Wiebe <artur@4wiebe.de>
---
rules/opencv.in | 7 +++++++
rules/opencv.make | 17 +++++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/rules/opencv.in b/rules/opencv.in
index 328786aed..bbf907b64 100644
--- a/rules/opencv.in
+++ b/rules/opencv.in
@@ -16,6 +16,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
@@ -140,6 +141,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 8da4beb98..3e5ac8b2b 100644
--- a/rules/opencv.make
+++ b/rules/opencv.make
@@ -35,7 +35,7 @@ OPENCV_BUILD_DIR := $(OPENCV_DIR)-build
OPENCV_CONF_TOOL := cmake
-# Note: not configure_helper.py does not show some options that are only
+# Note: configure_helper.py does not show some options that are only
# valid on other architectures. Run is for ARM and x86_64 and mix the results.
# Variables that are not shown by configure_helper.py are added at the end.
OPENCV_CONF_OPT := \
@@ -78,7 +78,8 @@ OPENCV_CONF_OPT := \
-DBUILD_opencv_ml=$(call ptx/onoff,PTXCONF_OPENCV_ML) \
-DBUILD_opencv_objdetect=$(call ptx/onoff,PTXCONF_OPENCV_OBJDETECT) \
-DBUILD_opencv_photo=$(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=$(call ptx/onoff,PTXCONF_OPENCV_STITCHING) \
-DBUILD_opencv_ts=OFF \
@@ -130,9 +131,11 @@ OPENCV_CONF_OPT := \
-DOPENCV_GENERATE_SETUPVARS=ON \
-DOPENCV_IPP_GAUSSIAN_BLUR=OFF \
-DOPENCV_MATHJAX_RELPATH=https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0 \
- -DOPENCV_PYTHON3_VERSION=OFF \
+ -DOPENCV_PYTHON3_VERSION=$(PYTHON3_MAJORMINOR) \
-DOPENCV_WARNINGS_ARE_ERRORS=OFF \
-DPROTOBUF_UPDATE_FILES=OFF \
+ -DPYTHON3_EXECUTABLE=$(PTXDIST_SYSROOT_CROSS)/bin/python$(PYTHON3_MAJORMINOR) \
+ -DPYTHON3_NUMPY_INCLUDE_DIRS=$(PTXDIST_SYSROOT_TARGET)$(PYTHON3_SITEPACKAGES)/numpy/core/include/ \
-DWITH_1394=OFF \
-DWITH_ADE=OFF \
-DWITH_ARAVIS=OFF \
@@ -203,7 +206,10 @@ OPENCV_CONF_OPT := \
\
-DCMAKE_SKIP_RPATH=ON \
-DBUILD_opencv_python2=OFF \
- -DBUILD_opencv_python3=OFF
+ -DPYTHON_INCLUDE_DIR=$(PTXDIST_SYSROOT_TARGET)/usr/include/python$(PYTHON3_MAJORMINOR)m \
+ -DPYTHON_LIBRARY=$(PTXDIST_SYSROOT_TARGET)/bin/python$(PYTHON3_MAJORMINOR) \
+ -DOPENCV_PYTHON3_INSTALL_PATH=$(PYTHON3_SITEPACKAGES) \
+ -DOPENCV_SKIP_PYTHON_LOADER=ON
$(STATEDIR)/opencv.install:
@@ -243,6 +249,9 @@ $(STATEDIR)/opencv.targetinstall:
$(call install_lib, opencv, 0, 0, 0644, $(lib))$(ptx/nl))
ifdef PTXCONF_OPENCV_EXAMPLES
@$(call install_tree, opencv, 0, 0, $(OPENCV_BUILD_DIR)/bin, /bin)
+endif
+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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH] opencv: added option to build/install python bindings
2020-09-16 11:19 [ptxdist] [PATCH] opencv: added option to build/install python bindings Artur Wiebe
@ 2020-09-22 10:16 ` Michael Olbrich
2020-09-24 7:33 ` [ptxdist] ?==?utf-8?q? ?==?utf-8?q? " Artur Wiebe
2020-10-06 8:18 ` [ptxdist] [APPLIED] " Michael Olbrich
1 sibling, 1 reply; 6+ messages in thread
From: Michael Olbrich @ 2020-09-22 10:16 UTC (permalink / raw)
To: ptxdist; +Cc: Artur Wiebe
On Wed, Sep 16, 2020 at 01:19:28PM +0200, Artur Wiebe wrote:
> Signed-off-by: Artur Wiebe <artur@4wiebe.de>
> ---
> rules/opencv.in | 7 +++++++
> rules/opencv.make | 17 +++++++++++++----
> 2 files changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/rules/opencv.in b/rules/opencv.in
> index 328786aed..bbf907b64 100644
> --- a/rules/opencv.in
> +++ b/rules/opencv.in
> @@ -16,6 +16,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
>
> @@ -140,6 +141,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 8da4beb98..3e5ac8b2b 100644
> --- a/rules/opencv.make
> +++ b/rules/opencv.make
> @@ -35,7 +35,7 @@ OPENCV_BUILD_DIR := $(OPENCV_DIR)-build
>
> OPENCV_CONF_TOOL := cmake
>
> -# Note: not configure_helper.py does not show some options that are only
> +# Note: configure_helper.py does not show some options that are only
> # valid on other architectures. Run is for ARM and x86_64 and mix the results.
> # Variables that are not shown by configure_helper.py are added at the end.
> OPENCV_CONF_OPT := \
> @@ -78,7 +78,8 @@ OPENCV_CONF_OPT := \
> -DBUILD_opencv_ml=$(call ptx/onoff,PTXCONF_OPENCV_ML) \
> -DBUILD_opencv_objdetect=$(call ptx/onoff,PTXCONF_OPENCV_OBJDETECT) \
> -DBUILD_opencv_photo=$(call ptx/onoff,PTXCONF_OPENCV_PHOTO) \
> - -DBUILD_opencv_python_bindings_generator=ON \
> + -DBUILD_opencv_python3=$(call ptx/onoff,PTXCONF_OPENCV_PYTHON) \
This option should remain at the end with all other options that are not
visible with configure_helper.py
> + -DBUILD_opencv_python_bindings_generator=$(call ptx/onoff,PTXCONF_OPENCV_PYTHON) \
> -DBUILD_opencv_python_tests=ON \
> -DBUILD_opencv_stitching=$(call ptx/onoff,PTXCONF_OPENCV_STITCHING) \
> -DBUILD_opencv_ts=OFF \
> @@ -130,9 +131,11 @@ OPENCV_CONF_OPT := \
> -DOPENCV_GENERATE_SETUPVARS=ON \
> -DOPENCV_IPP_GAUSSIAN_BLUR=OFF \
> -DOPENCV_MATHJAX_RELPATH=https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0 \
> - -DOPENCV_PYTHON3_VERSION=OFF \
> + -DOPENCV_PYTHON3_VERSION=$(PYTHON3_MAJORMINOR) \
> -DOPENCV_WARNINGS_ARE_ERRORS=OFF \
> -DPROTOBUF_UPDATE_FILES=OFF \
> + -DPYTHON3_EXECUTABLE=$(PTXDIST_SYSROOT_CROSS)/bin/python$(PYTHON3_MAJORMINOR) \
> + -DPYTHON3_NUMPY_INCLUDE_DIRS=$(PTXDIST_SYSROOT_TARGET)$(PYTHON3_SITEPACKAGES)/numpy/core/include/ \
> -DWITH_1394=OFF \
> -DWITH_ADE=OFF \
> -DWITH_ARAVIS=OFF \
> @@ -203,7 +206,10 @@ OPENCV_CONF_OPT := \
> \
> -DCMAKE_SKIP_RPATH=ON \
> -DBUILD_opencv_python2=OFF \
> - -DBUILD_opencv_python3=OFF
> + -DPYTHON_INCLUDE_DIR=$(PTXDIST_SYSROOT_TARGET)/usr/include/python$(PYTHON3_MAJORMINOR)m \
> + -DPYTHON_LIBRARY=$(PTXDIST_SYSROOT_TARGET)/bin/python$(PYTHON3_MAJORMINOR) \
Hmmm, from what I can tell, you can use PYTHON3_INCLUDE_DIR and
PYTHON3_LIBRARY here to make it explicit. And configure_helper.py knows
about PYTHON3_LIBRARY, so move it to the correct location.
Michael
> + -DOPENCV_PYTHON3_INSTALL_PATH=$(PYTHON3_SITEPACKAGES) \
> + -DOPENCV_SKIP_PYTHON_LOADER=ON
>
>
> $(STATEDIR)/opencv.install:
> @@ -243,6 +249,9 @@ $(STATEDIR)/opencv.targetinstall:
> $(call install_lib, opencv, 0, 0, 0644, $(lib))$(ptx/nl))
> ifdef PTXCONF_OPENCV_EXAMPLES
> @$(call install_tree, opencv, 0, 0, $(OPENCV_BUILD_DIR)/bin, /bin)
> +endif
> +ifdef PTXCONF_OPENCV_PYTHON
> + @$(call install_tree, opencv, 0, 0, -, $(PYTHON3_SITEPACKAGES))
What's installed here? Just .py files? Or are .pyc files generated
correctly?
Michael
> 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
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] ?==?utf-8?q? ?==?utf-8?q? [PATCH] opencv: added option to build/install python bindings
2020-09-22 10:16 ` Michael Olbrich
@ 2020-09-24 7:33 ` Artur Wiebe
2020-09-24 13:47 ` [ptxdist] ?= =?utf-8?q? " Michael Olbrich
0 siblings, 1 reply; 6+ messages in thread
From: Artur Wiebe @ 2020-09-24 7:33 UTC (permalink / raw)
To: ptxdist
HI Michael,
On Tuesday, September 22, 2020 12:16 CEST, Michael Olbrich <m.olbrich@pengutronix.de> wrote:
> On Wed, Sep 16, 2020 at 01:19:28PM +0200, Artur Wiebe wrote:
> > Signed-off-by: Artur Wiebe <artur@4wiebe.de>
> > ---
> > rules/opencv.in | 7 +++++++
> > rules/opencv.make | 17 +++++++++++++----
> > 2 files changed, 20 insertions(+), 4 deletions(-)
> >
> > diff --git a/rules/opencv.in b/rules/opencv.in
> > index 328786aed..bbf907b64 100644
> > --- a/rules/opencv.in
> > +++ b/rules/opencv.in
> > @@ -16,6 +16,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
> >
> > @@ -140,6 +141,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 8da4beb98..3e5ac8b2b 100644
> > --- a/rules/opencv.make
> > +++ b/rules/opencv.make
> > @@ -35,7 +35,7 @@ OPENCV_BUILD_DIR := $(OPENCV_DIR)-build
> >
> > OPENCV_CONF_TOOL := cmake
> >
> > -# Note: not configure_helper.py does not show some options that are only
> > +# Note: configure_helper.py does not show some options that are only
> > # valid on other architectures. Run is for ARM and x86_64 and mix the results.
> > # Variables that are not shown by configure_helper.py are added at the end.
> > OPENCV_CONF_OPT := \
> > @@ -78,7 +78,8 @@ OPENCV_CONF_OPT := \
> > -DBUILD_opencv_ml=$(call ptx/onoff,PTXCONF_OPENCV_ML) \
> > -DBUILD_opencv_objdetect=$(call ptx/onoff,PTXCONF_OPENCV_OBJDETECT) \
> > -DBUILD_opencv_photo=$(call ptx/onoff,PTXCONF_OPENCV_PHOTO) \
> > - -DBUILD_opencv_python_bindings_generator=ON \
> > + -DBUILD_opencv_python3=$(call ptx/onoff,PTXCONF_OPENCV_PYTHON) \
>
My configure_helper.py shows this exactly on this place (maybe only with other python options set?).
> This option should remain at the end with all other options that are not
> visible with configure_helper.py
>
> > + -DBUILD_opencv_python_bindings_generator=$(call ptx/onoff,PTXCONF_OPENCV_PYTHON) \
> > -DBUILD_opencv_python_tests=ON \
> > -DBUILD_opencv_stitching=$(call ptx/onoff,PTXCONF_OPENCV_STITCHING) \
> > -DBUILD_opencv_ts=OFF \
> > @@ -130,9 +131,11 @@ OPENCV_CONF_OPT := \
> > -DOPENCV_GENERATE_SETUPVARS=ON \
> > -DOPENCV_IPP_GAUSSIAN_BLUR=OFF \
> > -DOPENCV_MATHJAX_RELPATH=https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0 \
> > - -DOPENCV_PYTHON3_VERSION=OFF \
> > + -DOPENCV_PYTHON3_VERSION=$(PYTHON3_MAJORMINOR) \
> > -DOPENCV_WARNINGS_ARE_ERRORS=OFF \
> > -DPROTOBUF_UPDATE_FILES=OFF \
> > + -DPYTHON3_EXECUTABLE=$(PTXDIST_SYSROOT_CROSS)/bin/python$(PYTHON3_MAJORMINOR) \
> > + -DPYTHON3_NUMPY_INCLUDE_DIRS=$(PTXDIST_SYSROOT_TARGET)$(PYTHON3_SITEPACKAGES)/numpy/core/include/ \
> > -DWITH_1394=OFF \
> > -DWITH_ADE=OFF \
> > -DWITH_ARAVIS=OFF \
> > @@ -203,7 +206,10 @@ OPENCV_CONF_OPT := \
> > \
> > -DCMAKE_SKIP_RPATH=ON \
> > -DBUILD_opencv_python2=OFF \
> > - -DBUILD_opencv_python3=OFF
> > + -DPYTHON_INCLUDE_DIR=$(PTXDIST_SYSROOT_TARGET)/usr/include/python$(PYTHON3_MAJORMINOR)m \
> > + -DPYTHON_LIBRARY=$(PTXDIST_SYSROOT_TARGET)/bin/python$(PYTHON3_MAJORMINOR) \
>
These variables are described here: https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
I tried with the ones from configure_helper.py, but it does not work. During prepare configure tells to set the options above!
> Hmmm, from what I can tell, you can use PYTHON3_INCLUDE_DIR and
> PYTHON3_LIBRARY here to make it explicit. And configure_helper.py knows
> about PYTHON3_LIBRARY, so move it to the correct location.
>
> Michael
>
> > + -DOPENCV_PYTHON3_INSTALL_PATH=$(PYTHON3_SITEPACKAGES) \
> > + -DOPENCV_SKIP_PYTHON_LOADER=ON
> >
> >
> > $(STATEDIR)/opencv.install:
> > @@ -243,6 +249,9 @@ $(STATEDIR)/opencv.targetinstall:
> > $(call install_lib, opencv, 0, 0, 0644, $(lib))$(ptx/nl))
> > ifdef PTXCONF_OPENCV_EXAMPLES
> > @$(call install_tree, opencv, 0, 0, $(OPENCV_BUILD_DIR)/bin, /bin)
> > +endif
> > +ifdef PTXCONF_OPENCV_PYTHON
> > + @$(call install_tree, opencv, 0, 0, -, $(PYTHON3_SITEPACKAGES))
>
Actually only "/usr/lib/python3.7/site-packages/cv2.cpython-37m-x86_64-linux-gnu.so" is installed (on my platform). I didn't want to code the name from x variables...
> What's installed here? Just .py files? Or are .pyc files generated
> correctly?
>
> Michael
>
> > 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
> >
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] ?= =?utf-8?q? [PATCH] opencv: added option to build/install python bindings
2020-09-24 7:33 ` [ptxdist] ?==?utf-8?q? ?==?utf-8?q? " Artur Wiebe
@ 2020-09-24 13:47 ` Michael Olbrich
0 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2020-09-24 13:47 UTC (permalink / raw)
To: ptxdist
Hi,
On Thu, Sep 24, 2020 at 09:33:47AM +0200, Artur Wiebe wrote:
> On Tuesday, September 22, 2020 12:16 CEST, Michael Olbrich <m.olbrich@pengutronix.de> wrote:
> > On Wed, Sep 16, 2020 at 01:19:28PM +0200, Artur Wiebe wrote:
> > > Signed-off-by: Artur Wiebe <artur@4wiebe.de>
> > > ---
> > > rules/opencv.in | 7 +++++++
> > > rules/opencv.make | 17 +++++++++++++----
> > > 2 files changed, 20 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/rules/opencv.in b/rules/opencv.in
> > > index 328786aed..bbf907b64 100644
> > > --- a/rules/opencv.in
> > > +++ b/rules/opencv.in
> > > @@ -16,6 +16,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
> > >
> > > @@ -140,6 +141,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 8da4beb98..3e5ac8b2b 100644
> > > --- a/rules/opencv.make
> > > +++ b/rules/opencv.make
> > > @@ -35,7 +35,7 @@ OPENCV_BUILD_DIR := $(OPENCV_DIR)-build
> > >
> > > OPENCV_CONF_TOOL := cmake
> > >
> > > -# Note: not configure_helper.py does not show some options that are only
> > > +# Note: configure_helper.py does not show some options that are only
> > > # valid on other architectures. Run is for ARM and x86_64 and mix the results.
> > > # Variables that are not shown by configure_helper.py are added at the end.
> > > OPENCV_CONF_OPT := \
> > > @@ -78,7 +78,8 @@ OPENCV_CONF_OPT := \
> > > -DBUILD_opencv_ml=$(call ptx/onoff,PTXCONF_OPENCV_ML) \
> > > -DBUILD_opencv_objdetect=$(call ptx/onoff,PTXCONF_OPENCV_OBJDETECT) \
> > > -DBUILD_opencv_photo=$(call ptx/onoff,PTXCONF_OPENCV_PHOTO) \
> > > - -DBUILD_opencv_python_bindings_generator=ON \
> > > + -DBUILD_opencv_python3=$(call ptx/onoff,PTXCONF_OPENCV_PYTHON) \
> >
>
> My configure_helper.py shows this exactly on this place (maybe only with other python options set?).
That's possible. I need to check this. I know we have issues like this with
ARM and x86_64.
> > This option should remain at the end with all other options that are not
> > visible with configure_helper.py
> >
> > > + -DBUILD_opencv_python_bindings_generator=$(call ptx/onoff,PTXCONF_OPENCV_PYTHON) \
> > > -DBUILD_opencv_python_tests=ON \
> > > -DBUILD_opencv_stitching=$(call ptx/onoff,PTXCONF_OPENCV_STITCHING) \
> > > -DBUILD_opencv_ts=OFF \
> > > @@ -130,9 +131,11 @@ OPENCV_CONF_OPT := \
> > > -DOPENCV_GENERATE_SETUPVARS=ON \
> > > -DOPENCV_IPP_GAUSSIAN_BLUR=OFF \
> > > -DOPENCV_MATHJAX_RELPATH=https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0 \
> > > - -DOPENCV_PYTHON3_VERSION=OFF \
> > > + -DOPENCV_PYTHON3_VERSION=$(PYTHON3_MAJORMINOR) \
> > > -DOPENCV_WARNINGS_ARE_ERRORS=OFF \
> > > -DPROTOBUF_UPDATE_FILES=OFF \
> > > + -DPYTHON3_EXECUTABLE=$(PTXDIST_SYSROOT_CROSS)/bin/python$(PYTHON3_MAJORMINOR) \
> > > + -DPYTHON3_NUMPY_INCLUDE_DIRS=$(PTXDIST_SYSROOT_TARGET)$(PYTHON3_SITEPACKAGES)/numpy/core/include/ \
> > > -DWITH_1394=OFF \
> > > -DWITH_ADE=OFF \
> > > -DWITH_ARAVIS=OFF \
> > > @@ -203,7 +206,10 @@ OPENCV_CONF_OPT := \
> > > \
> > > -DCMAKE_SKIP_RPATH=ON \
> > > -DBUILD_opencv_python2=OFF \
> > > - -DBUILD_opencv_python3=OFF
> > > + -DPYTHON_INCLUDE_DIR=$(PTXDIST_SYSROOT_TARGET)/usr/include/python$(PYTHON3_MAJORMINOR)m \
> > > + -DPYTHON_LIBRARY=$(PTXDIST_SYSROOT_TARGET)/bin/python$(PYTHON3_MAJORMINOR) \
> >
>
> These variables are described here: https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
> I tried with the ones from configure_helper.py, but it does not work.
> During prepare configure tells to set the options above!
Right sorry. I think PYTHON3_INCLUDE_DIR / PYTHON3_LIBRARY are the
environment variables...
> > Hmmm, from what I can tell, you can use PYTHON3_INCLUDE_DIR and
> > PYTHON3_LIBRARY here to make it explicit. And configure_helper.py knows
> > about PYTHON3_LIBRARY, so move it to the correct location.
> >
> > Michael
> >
> > > + -DOPENCV_PYTHON3_INSTALL_PATH=$(PYTHON3_SITEPACKAGES) \
> > > + -DOPENCV_SKIP_PYTHON_LOADER=ON
> > >
> > >
> > > $(STATEDIR)/opencv.install:
> > > @@ -243,6 +249,9 @@ $(STATEDIR)/opencv.targetinstall:
> > > $(call install_lib, opencv, 0, 0, 0644, $(lib))$(ptx/nl))
> > > ifdef PTXCONF_OPENCV_EXAMPLES
> > > @$(call install_tree, opencv, 0, 0, $(OPENCV_BUILD_DIR)/bin, /bin)
> > > +endif
> > > +ifdef PTXCONF_OPENCV_PYTHON
> > > + @$(call install_tree, opencv, 0, 0, -, $(PYTHON3_SITEPACKAGES))
> >
>
> Actually only
> "/usr/lib/python3.7/site-packages/cv2.cpython-37m-x86_64-linux-gnu.so" is
> installed (on my platform). I didn't want to code the name from x
> variables...
That's ok then. I just wanted to make sure that we don't install
unnecessary files here.
Michael
> > What's installed here? Just .py files? Or are .pyc files generated
> > correctly?
> >
> > Michael
> >
> > > endif
> > > @$(call install_finish, opencv)
> > > @$(call touch)
> > > --
> > > 2.28.0
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [APPLIED] opencv: added option to build/install python bindings
2020-09-16 11:19 [ptxdist] [PATCH] opencv: added option to build/install python bindings Artur Wiebe
2020-09-22 10:16 ` Michael Olbrich
@ 2020-10-06 8:18 ` Michael Olbrich
1 sibling, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2020-10-06 8:18 UTC (permalink / raw)
To: ptxdist; +Cc: Artur Wiebe
Thanks, applied as 3a8eaecbadef4087b845b15b59233b29b9bc12a1.
Michael
[sent from post-receive hook]
On Tue, 06 Oct 2020 10:18:36 +0200, Artur Wiebe <artur@4wiebe.de> wrote:
> Signed-off-by: Artur Wiebe <artur@4wiebe.de>
> Message-Id: <20200916111928.1287941-1-artur@4wiebe.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> diff --git a/rules/opencv.in b/rules/opencv.in
> index 328786aedff9..bbf907b649bb 100644
> --- a/rules/opencv.in
> +++ b/rules/opencv.in
> @@ -16,6 +16,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
>
> @@ -140,6 +141,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 8da4beb9841b..3e5ac8b2b525 100644
> --- a/rules/opencv.make
> +++ b/rules/opencv.make
> @@ -35,7 +35,7 @@ OPENCV_BUILD_DIR := $(OPENCV_DIR)-build
>
> OPENCV_CONF_TOOL := cmake
>
> -# Note: not configure_helper.py does not show some options that are only
> +# Note: configure_helper.py does not show some options that are only
> # valid on other architectures. Run is for ARM and x86_64 and mix the results.
> # Variables that are not shown by configure_helper.py are added at the end.
> OPENCV_CONF_OPT := \
> @@ -78,7 +78,8 @@ OPENCV_CONF_OPT := \
> -DBUILD_opencv_ml=$(call ptx/onoff,PTXCONF_OPENCV_ML) \
> -DBUILD_opencv_objdetect=$(call ptx/onoff,PTXCONF_OPENCV_OBJDETECT) \
> -DBUILD_opencv_photo=$(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=$(call ptx/onoff,PTXCONF_OPENCV_STITCHING) \
> -DBUILD_opencv_ts=OFF \
> @@ -130,9 +131,11 @@ OPENCV_CONF_OPT := \
> -DOPENCV_GENERATE_SETUPVARS=ON \
> -DOPENCV_IPP_GAUSSIAN_BLUR=OFF \
> -DOPENCV_MATHJAX_RELPATH=https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0 \
> - -DOPENCV_PYTHON3_VERSION=OFF \
> + -DOPENCV_PYTHON3_VERSION=$(PYTHON3_MAJORMINOR) \
> -DOPENCV_WARNINGS_ARE_ERRORS=OFF \
> -DPROTOBUF_UPDATE_FILES=OFF \
> + -DPYTHON3_EXECUTABLE=$(PTXDIST_SYSROOT_CROSS)/bin/python$(PYTHON3_MAJORMINOR) \
> + -DPYTHON3_NUMPY_INCLUDE_DIRS=$(PTXDIST_SYSROOT_TARGET)$(PYTHON3_SITEPACKAGES)/numpy/core/include/ \
> -DWITH_1394=OFF \
> -DWITH_ADE=OFF \
> -DWITH_ARAVIS=OFF \
> @@ -203,7 +206,10 @@ OPENCV_CONF_OPT := \
> \
> -DCMAKE_SKIP_RPATH=ON \
> -DBUILD_opencv_python2=OFF \
> - -DBUILD_opencv_python3=OFF
> + -DPYTHON_INCLUDE_DIR=$(PTXDIST_SYSROOT_TARGET)/usr/include/python$(PYTHON3_MAJORMINOR)m \
> + -DPYTHON_LIBRARY=$(PTXDIST_SYSROOT_TARGET)/bin/python$(PYTHON3_MAJORMINOR) \
> + -DOPENCV_PYTHON3_INSTALL_PATH=$(PYTHON3_SITEPACKAGES) \
> + -DOPENCV_SKIP_PYTHON_LOADER=ON
>
>
> $(STATEDIR)/opencv.install:
> @@ -243,6 +249,9 @@ $(STATEDIR)/opencv.targetinstall:
> $(call install_lib, opencv, 0, 0, 0644, $(lib))$(ptx/nl))
> ifdef PTXCONF_OPENCV_EXAMPLES
> @$(call install_tree, opencv, 0, 0, $(OPENCV_BUILD_DIR)/bin, /bin)
> +endif
> +ifdef PTXCONF_OPENCV_PYTHON
> + @$(call install_tree, opencv, 0, 0, -, $(PYTHON3_SITEPACKAGES))
> endif
> @$(call install_finish, opencv)
> @$(call touch)
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ptxdist] [PATCH] opencv: added option to build/install python bindings
@ 2020-08-24 13:27 Artur Wiebe
0 siblings, 0 replies; 6+ messages in thread
From: Artur Wiebe @ 2020-08-24 13:27 UTC (permalink / raw)
To: ptxdist; +Cc: Artur Wiebe
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-10-06 8:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 11:19 [ptxdist] [PATCH] opencv: added option to build/install python bindings Artur Wiebe
2020-09-22 10:16 ` Michael Olbrich
2020-09-24 7:33 ` [ptxdist] ?==?utf-8?q? ?==?utf-8?q? " Artur Wiebe
2020-09-24 13:47 ` [ptxdist] ?= =?utf-8?q? " Michael Olbrich
2020-10-06 8:18 ` [ptxdist] [APPLIED] " Michael Olbrich
-- strict thread matches above, loose matches on Subject: below --
2020-08-24 13:27 [ptxdist] [PATCH] " Artur Wiebe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox