1import os
2
3from pyqtbuild import PyQtBindings, PyQtProject
4from sipbuild import Option
5
6
7class QGIS(PyQtProject):
8    """ The QGIS project. """
9
10    def __init__(self):
11        """ Initialize the project. """
12        super().__init__()
13        self.sip_files_dir = '.'
14        self.bindings_factories = [Qgis3D]
15
16    def get_options(self):
17        """ Return the list of configurable options. """
18        options = super().get_options()
19        options.append(
20                Option('include_dirs', option_type=list,
21                        help="additional directory to search for .sip files",
22                        metavar="DIR"))
23        return options
24
25    def apply_user_defaults(self, tool):
26        """ Set default values for user options that haven't been set yet. """
27        super().apply_user_defaults(tool)
28        if self.include_dirs is not None:
29            self.sip_include_dirs += self.include_dirs
30
31
32class Qgis3D(PyQtBindings):
33    """ The QGIS 3D bindings. """
34
35    def __init__(self, project):
36        """ Initialize the bindings. """
37        super().__init__(project, '3d')
38        self.sip_file = '3d.sip'
39        self.exceptions = True
40        self.release_gil = True
41        self.disabled_features = "@SIP_DISABLE_FEATURES@".split(";")
42
43    def apply_user_defaults(self, tool):
44        """ Set default values for user options that haven't been set yet. """
45        if self.project.py_platform.startswith('win32'):
46            self.tags.append('WS_WIN')
47        elif self.project.py_platform == 'darwin':
48            self.tags.append('WS_MACX')
49        else:
50            self.tags.append('WS_X11')
51        super().apply_user_defaults(tool)
52