]>
Commit | Line | Data |
---|---|---|
1 | ## | |
2 | ## This file is part of the libsigrok project. | |
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 | ## | |
19 | ||
20 | from setuptools import setup, find_packages, Extension | |
21 | import subprocess | |
22 | import os | |
23 | ||
24 | sr_includes, sr_lib_dirs, sr_libs, (sr_version,) = [ | |
25 | subprocess.check_output( | |
26 | ["pkg-config", option, "glib-2.0", "glibmm-2.4", "pygobject-3.0"] | |
27 | ).decode().rstrip().split(' ') | |
28 | for option in | |
29 | ("--cflags-only-I", "--libs-only-L", "--libs-only-l", "--modversion")] | |
30 | ||
31 | includes = ['../../include', '../cxx/include'] + [i[2:] for i in sr_includes] | |
32 | libdirs = ['../../.libs', '../cxx/.libs'] + [l[2:] for l in sr_lib_dirs] | |
33 | libs = [l[2:] for l in sr_libs] + ['sigrokxx'] | |
34 | ||
35 | setup( | |
36 | name = 'libsigrok', | |
37 | namespace_packages = ['sigrok'], | |
38 | packages = find_packages(), | |
39 | version = sr_version, | |
40 | description = "libsigrok API wrapper", | |
41 | ext_modules = [ | |
42 | Extension('sigrok.core._classes', | |
43 | sources = ['sigrok/core/classes.i'], | |
44 | swig_opts = ['-c++', '-threads'] + | |
45 | ['-I%s' % i for i in includes], | |
46 | extra_compile_args = ['-std=c++11'], | |
47 | include_dirs = includes, | |
48 | library_dirs = libdirs, | |
49 | libraries = libs) | |
50 | ], | |
51 | ) |