From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.216]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kIVTI-0000TY-Mu for ptxdist@pengutronix.de; Wed, 16 Sep 2020 13:19:33 +0200 From: Artur Wiebe Date: Wed, 16 Sep 2020 13:19:28 +0200 Message-Id: <20200916111928.1287941-1-artur@4wiebe.de> MIME-Version: 1.0 Subject: [ptxdist] [PATCH] opencv: added option to build/install python bindings List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: ptxdist@pengutronix.de Cc: Artur Wiebe Signed-off-by: Artur Wiebe --- 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