1 | #! /usr/bin/env python3 |
---|
2 | # encoding: utf-8 |
---|
3 | |
---|
4 | NAME = 'pysoy' |
---|
5 | DATE = 'unreleased' |
---|
6 | VERSION = '1.0beta3' |
---|
7 | WEBSITE = 'http://www.pysoy.org/' |
---|
8 | LICENSE = ''' |
---|
9 | Copyright (C) 2006-2014 Copyleft Games Group |
---|
10 | |
---|
11 | This program is free software: you can redistribute it and/or modify |
---|
12 | it under the terms of the GNU Affero General Public License as published by |
---|
13 | the Free Software Foundation, either version 3 of the License, or |
---|
14 | (at your option) any later version. |
---|
15 | |
---|
16 | This program is distributed in the hope that it will be useful, |
---|
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
19 | GNU Affero General Public License for more details. |
---|
20 | |
---|
21 | You should have received a copy of the GNU Affero General Public License |
---|
22 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
23 | ''' |
---|
24 | import sys, os |
---|
25 | import waflib.Utils |
---|
26 | import waflib.Options |
---|
27 | from waflib.Utils import subprocess |
---|
28 | |
---|
29 | top = '.' |
---|
30 | out = 'build' |
---|
31 | |
---|
32 | def options(opt): |
---|
33 | opt.load('compiler_c python') |
---|
34 | |
---|
35 | opt.add_option('--withdocs', dest='docs', default=False, |
---|
36 | action='store_true', help='build docs using Sphinx') |
---|
37 | |
---|
38 | # Unit testing |
---|
39 | opt.add_option('--runtests', dest='runTests', default=False, |
---|
40 | action='store_true', help='run unit tests found in tests/') |
---|
41 | opt.load('waf_unit_test') |
---|
42 | |
---|
43 | |
---|
44 | def configure(conf) : |
---|
45 | import sys |
---|
46 | |
---|
47 | conf.env.PYTHON = sys.executable |
---|
48 | |
---|
49 | conf.env.PREFIX = '/usr' |
---|
50 | |
---|
51 | # Load C compiler, unit testing, and python compiler |
---|
52 | conf.load('compiler_c python waf_unit_test') |
---|
53 | |
---|
54 | conf.check_python_version((3,1,0)) |
---|
55 | |
---|
56 | conf.check_python_headers() |
---|
57 | |
---|
58 | # Sphinx |
---|
59 | if conf.options.docs: |
---|
60 | conf.find_program("sphinx-build", var="SPHINX_BUILD") |
---|
61 | |
---|
62 | #Dependencies |
---|
63 | conf.check_cfg(package='soy-1', uselib_store='SOY', |
---|
64 | mandatory=True, args='--cflags --libs') |
---|
65 | |
---|
66 | # Set the package to pysoy |
---|
67 | conf.env['PACKAGE'] = 'pysoy' |
---|
68 | |
---|
69 | # Set platform |
---|
70 | from platform import system; conf.env[system().upper()] = 1 |
---|
71 | |
---|
72 | # If building for videocore use native optimization |
---|
73 | if (conf.env['PLATFORM_TYPE'] == 'videocore'): |
---|
74 | conf.env.CFLAGS = ['-march=native'] |
---|
75 | |
---|
76 | def build(bld) : |
---|
77 | # Defines for .pc |
---|
78 | bld.define('PACKAGE', NAME) |
---|
79 | bld.define('VERSION', VERSION) |
---|
80 | bld.recurse('src') |
---|
81 | |
---|
82 | if bld.env['SPHINX_BUILD'] and bld.cmd == 'build': |
---|
83 | bld.recurse('docs') |
---|
84 | |
---|
85 | # Unit testing |
---|
86 | if bld.options.runTests: |
---|
87 | bld.recurse('tests') |
---|
88 | from waflib.Tools import waf_unit_test |
---|
89 | bld.add_post_fun(waf_unit_test.summary) |
---|
90 | |
---|