Skip to content

Commit d28ca1e

Browse files
authored
Add options to project.py to specify include and library directories (#493)
1 parent e84b4a8 commit d28ca1e

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

project.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23

34
from pyqtbuild import PyQtBindings, PyQtProject
45
from sipbuild import Option
@@ -16,12 +17,37 @@ def __init__(self, project):
1617
""" Initialise the bindings. """
1718

1819
super().__init__(project, 'ads')
20+
21+
def get_options(self):
22+
"""Our custom options that a user can pass to sip-build."""
23+
options = super().get_options()
24+
options += [
25+
Option('ads_incdir',
26+
help='the directory containing the ads header file',
27+
metavar='DIR'),
28+
Option('ads_libdir',
29+
help='the directory containing the ads library',
30+
metavar='DIR'),
31+
Option('ads_lib',
32+
help='the ads library',
33+
metavar='LIB'),
34+
]
35+
return options
1936

2037
def apply_user_defaults(self, tool):
2138
""" Set default values for user options that haven't been set yet. """
22-
39+
2340
resource_file = os.path.join(self.project.root_dir,'src','ads.qrc')
2441
print("Adding resource file to qmake project: ", resource_file)
2542
self.builder_settings.append('RESOURCES += '+resource_file)
2643

44+
if self.ads_lib is not None:
45+
self.libraries.append(self.ads_lib)
46+
47+
if self.ads_incdir is not None:
48+
self.include_dirs.append(self.ads_incdir)
49+
50+
if self.ads_libdir is not None:
51+
self.library_dirs.append(self.ads_libdir)
52+
2753
super().apply_user_defaults(tool)

0 commit comments

Comments
 (0)