]>
Commit | Line | Data |
---|---|---|
8dc93c84 | 1 | ## |
50985c20 | 2 | ## This file is part of the libsigrok project. |
8dc93c84 UH |
3 | ## |
4 | ## Copyright (C) 2013 Martin Ling <martin-sigrok@earth.li> | |
5 | ## | |
6 | ## This program is free software: you can redistribute it and/or modify | |
7 | ## it under the terms of the GNU General Public License as published by | |
8 | ## the Free Software Foundation, either version 3 of the License, or | |
9 | ## (at your option) any later version. | |
10 | ## | |
11 | ## This program is distributed in the hope that it will be useful, | |
12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ## GNU General Public License for more details. | |
15 | ## | |
16 | ## You should have received a copy of the GNU General Public License | |
17 | ## along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | ## | |
758b01ad | 19 | |
02206269 | 20 | from setuptools import setup, find_packages, Extension |
758b01ad | 21 | import subprocess |
f7740954 ML |
22 | import os |
23 | ||
24 | env = os.environ.copy() | |
758b01ad | 25 | |
91bea31f ML |
26 | sr_includes, sr_lib_dirs, sr_libs, (sr_version,) = [ |
27 | subprocess.check_output( | |
f7740954 ML |
28 | ["pkg-config", option, "glib-2.0", "glibmm-2.4", "pygobject-3.0"] |
29 | ).decode().rstrip().split(' ') | |
91bea31f ML |
30 | for option in |
31 | ("--cflags-only-I", "--libs-only-L", "--libs-only-l", "--modversion")] | |
758b01ad | 32 | |
f7740954 ML |
33 | includes = ['../../include', '../cxx/include'] + [i[2:] for i in sr_includes] |
34 | libdirs = ['../../.libs', '../cxx/.libs'] + [l[2:] for l in sr_lib_dirs] | |
35 | libs = [l[2:] for l in sr_libs] | |
36 | ||
37 | extension_options = dict( | |
38 | include_dirs = includes, | |
39 | library_dirs = libdirs) | |
40 | ||
758b01ad ML |
41 | setup( |
42 | name = 'libsigrok', | |
02206269 ML |
43 | namespace_packages = ['sigrok'], |
44 | packages = find_packages(), | |
758b01ad ML |
45 | version = sr_version, |
46 | description = "libsigrok API wrapper", | |
758b01ad | 47 | ext_modules = [ |
02206269 ML |
48 | Extension('sigrok.core._lowlevel', |
49 | sources = ['sigrok/core/lowlevel.i'], | |
f7740954 ML |
50 | swig_opts = ['-threads', '-I../../include'], |
51 | libraries = libs + ['sigrok'], | |
52 | **extension_options), | |
53 | Extension('sigrok.core._classes', | |
54 | sources = ['sigrok/core/classes.i'], | |
55 | swig_opts = ['-c++', '-threads'] + | |
56 | ['-I%s' % i for i in includes], | |
57 | extra_compile_args = ['-std=c++11'], | |
58 | libraries = libs + ['sigrokxx'], | |
59 | **extension_options) | |
758b01ad ML |
60 | ], |
61 | ) |