Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix Qt on macOS #293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ target/
# Build temporary files
/contrib.enabled
/cv_version.py
_skbuild/
7 changes: 7 additions & 0 deletions 7 cv2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import importlib
import os
import sys

from .cv2 import *
from .data import *

# wildcard import above does not import "private" variables like __version__
# this makes them available
globals().update(importlib.import_module('cv2.cv2').__dict__)

if sys.platform == 'darwin':
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'qt', 'plugins'
)
12 changes: 12 additions & 0 deletions 12 patches/patchQtPlugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/opencv/CMakeLists.txt b/opencv/CMakeLists.txt
index 8ccad4d03a..0d5e2a79e9 100644
--- a/opencv/CMakeLists.txt
+++ b/opencv/CMakeLists.txt
@@ -1164,6 +1164,7 @@ if(WITH_QT OR HAVE_QT)
if(HAVE_QT5)
status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
+ install(DIRECTORY ${Qt5_DIR}/../../../plugins DESTINATION lib/qt)
elseif(HAVE_QT)
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
2 changes: 2 additions & 0 deletions 2 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def main():

if sys.platform == 'darwin' and not build_headless:
cmake_args.append("-DWITH_QT=5")
rearrange_cmake_output_data['cv2.qt.plugins.platforms'] = [(r'lib/qt/plugins/platforms/libqcocoa\.dylib')]

if build_headless:
# it seems that cocoa cannot be disabled so on macOS the package is not truly headless
Expand All @@ -144,6 +145,7 @@ def main():
# https://github.com/skvark/opencv-python/issues/21
cmake_args.append("-DCMAKE_CXX_FLAGS=-stdlib=libc++")
cmake_args.append("-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9")
subprocess.check_call("patch -p1 < patches/patchQtPlugins", shell=True)

if sys.platform.startswith('linux'):
cmake_args.append("-DWITH_IPP=OFF") # tests fail with IPP compiled with
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.