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

Commit 6b3dae7

Browse filesBrowse files
authored
Merge pull request opencv#293 from dlech/master
Fix Qt on macOS
2 parents 2fd09dc + d1a7159 commit 6b3dae7
Copy full SHA for 6b3dae7

File tree

4 files changed

+22
-0
lines changed
Filter options

4 files changed

+22
-0
lines changed

‎.gitignore

Copy file name to clipboardExpand all lines: .gitignore
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ target/
6767
# Build temporary files
6868
/contrib.enabled
6969
/cv_version.py
70+
_skbuild/

‎cv2/__init__.py

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import importlib
2+
import os
3+
import sys
24

35
from .cv2 import *
46
from .data import *
57

68
# wildcard import above does not import "private" variables like __version__
79
# this makes them available
810
globals().update(importlib.import_module('cv2.cv2').__dict__)
11+
12+
if sys.platform == 'darwin':
13+
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = os.path.join(
14+
os.path.dirname(os.path.abspath(__file__)), 'qt', 'plugins'
15+
)

‎patches/patchQtPlugins

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/opencv/CMakeLists.txt b/opencv/CMakeLists.txt
2+
index 8ccad4d03a..0d5e2a79e9 100644
3+
--- a/opencv/CMakeLists.txt
4+
+++ b/opencv/CMakeLists.txt
5+
@@ -1164,6 +1164,7 @@ if(WITH_QT OR HAVE_QT)
6+
if(HAVE_QT5)
7+
status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
8+
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
9+
+ install(DIRECTORY ${Qt5_DIR}/../../../plugins DESTINATION lib/qt)
10+
elseif(HAVE_QT)
11+
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
12+
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def main():
128128

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

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

148150
if sys.platform.startswith('linux'):
149151
cmake_args.append("-DWITH_IPP=OFF") # tests fail with IPP compiled with

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.