From ba00d6a6ff303b15a8cfcee79db75d67dfd89d26 Mon Sep 17 00:00:00 2001 From: Andrews Sobral <andrewssobral@gmail.com> Date: Thu, 13 Jul 2017 17:59:55 +0200 Subject: [PATCH] Fix for python 3 and building python support on linux --- CMakeLists.txt | 10 +++++++--- Demo.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1509d8c..64f8505 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,8 +73,12 @@ if(${OpenCV_VERSION} VERSION_LESS 2.3.1) endif() if(BGS_PYTHON_SUPPORT) - #set(Boost_USE_STATIC_LIBS OFF) - set(Boost_USE_STATIC_LIBS ON) + if(WIN32) + set(Boost_USE_STATIC_LIBS ON) + else() + set(Boost_USE_STATIC_LIBS OFF) + endif() + set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) @@ -97,7 +101,7 @@ if(BGS_PYTHON_SUPPORT) if(NOT NUMPY_INCLUDE_DIR) # message(FATAL_ERROR "You must define NUMPY_INCLUDE_DIR by 'cmake -D NUMPY_INCLUDE_DIR=/python/lib/site-packages/numpy/core/include ..'") exec_program ("${PYTHON_EXECUTABLE}" - ARGS "-c \"import numpy; print numpy.get_include()\"" + ARGS "-c \"import numpy; print(numpy.get_include())\"" OUTPUT_VARIABLE NUMPY_INCLUDE_DIR RETURN_VALUE NUMPY_NOT_FOUND) endif() diff --git a/Demo.py b/Demo.py index d5ebee1..efa64cc 100644 --- a/Demo.py +++ b/Demo.py @@ -53,7 +53,7 @@ capture = cv2.VideoCapture(video_file) while not capture.isOpened(): capture = cv2.VideoCapture(video_file) cv2.waitKey(1000) - print "Wait for the header" + print("Wait for the header") #pos_frame = capture.get(cv2.cv.CV_CAP_PROP_POS_FRAMES) #pos_frame = capture.get(cv2.CV_CAP_PROP_POS_FRAMES) -- GitLab