-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathproject.py
More file actions
50 lines (41 loc) · 1.73 KB
/
project.py
File metadata and controls
50 lines (41 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys
from pyqtbuild import PyQtBindings, PyQtProject, QmakeBuilder
from sipbuild import Option, UserException
class QCefViewBindings(PyQtBindings):
def __init__(self, project):
super().__init__(project, "QCefView")
def get_options(self):
options = super().get_options()
options += [
Option("cef_incdir", help="the CEF include dir", metavar="DIR"),
Option("cef_libdir", help="the CEF library dir", metavar="DIR"),
Option("cef_lib", help="the CEF library", metavar="LIB"),
]
return options
def apply_user_defaults(self, tool):
if sys.platform == "darwin":
self.include_dirs += [self.cef_incdir]
self.extra_link_args += [
f"-F{self.cef_libdir}",
f"-framework {self.cef_lib}",
]
else:
self.include_dirs += [self.cef_incdir]
self.library_dirs += [self.cef_libdir]
self.libraries += [self.cef_lib]
return super().apply_user_defaults(tool)
def verify_configuration(self, tool):
required_options = ["cef_incdir", "cef_libdir", "cef_lib"]
for opt in required_options:
if not getattr(self, opt):
raise UserException(
f"Option --{opt.replace('_', '-')}=<path> is required (or set in the config file)"
)
super().verify_configuration(tool)
class QCefViewProject(PyQtProject):
def __init__(self):
super().__init__()
self.builder_factory = QmakeBuilder
self.bindings_factories = [QCefViewBindings]
def apply_user_defaults(self, tool):
return super().apply_user_defaults(tool)