forked from m-westphal/gqr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
133 lines (100 loc) · 3.77 KB
/
wscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#! /usr/bin/env python
# encoding: utf-8
# Stefan Woelfl, 2008
# Matthias Westphal, 2009
import os.path
import os
from subprocess import Popen, PIPE
import Options
def get_version():
# content of 'VERSION' always overrides git info
if os.path.exists('VERSION'):
version = file("VERSION").read().strip()
return version
try:
p1 = Popen(["git", "log", "-1", "--pretty=format:%h"], stdout=PIPE, stderr=PIPE).communicate()[0]
version = p1.strip()
except:
print "Version undefined."
version = "undefined"
return version
APPNAME='gqr'
VERSION=get_version()
## These two variables are mandatory ('/' are converted automatically)
srcdir = '.'
blddir = './_build_'
## Self-defined global variables
## will be selectable by options ...
default_install_data_dir = 'share/gqr/data'
def set_options(ctx):
ctx.add_option('--devel',
help='build the debug and profile variants',
default = False, action="store_true", dest='build_devel')
ctx.add_option('--enable-libgqr',
help='build a library with GQR\'s core functionality',
default = False, action="store_true", dest='build_library')
ctx_optgroup = ctx.get_option_group('-b')
# print ctx_optgroup
ctx_optgroup.add_option('--data-dir',
type=str,
default=default_install_data_dir,
help='configure: data dir of gqr (relative to prefix) [Default: %s]' % default_install_data_dir,
dest='data_dir')
ctx_optgroup.add_option('--relation-size',
type=int,
help='configure: support relation type with given number of base relations',
dest='relation_size')
ctx_optgroup.add_option('--enable-xml',
default = False, action="store_true", dest = 'enable_xml', help='configure: enable XML support')
ctx_optgroup.add_option('--enable-libgqr',
help='configure: build the gqr library',
default = False, action="store_true", dest='build_library')
# ctx_optgroup = ctx.get_option_group('-h')
ctx.sub_options('gqr')
def configure(conf):
conf.env['GQR_VERSION'] = VERSION
conf.env['PRG_DOXYGEN_PATH'] = conf.find_program("doxygen")
conf.env['PRG_INSTALL_PATH'] = conf.find_program("install")
conf.sub_config('gqr')
def build(conf):
conf.add_subdirs('gqr data')
def check(ctx):
import unittestw
ut = unittestw.unit_test()
ut.change_to_testfile_dir = False
ut.want_to_see_test_output = False
ut.run()
ut.print_results()
def dist():
if len(VERSION) == 0:
raise SystemExit("Need version to build tarball")
import Scripting
# Excludes for "waf dist"
Scripting.excludes.append('benchmarks')
Scripting.excludes.append('doxygen')
Scripting.excludes.append('results')
Scripting.excludes.append('src-utils')
Scripting.excludes.append('tools')
Scripting.excludes.append('_build_')
Scripting.excludes.append('gmon.out')
Scripting.excludes.append('opra8')
Scripting.excludes.append('opra8.spec')
Scripting.excludes.append('libgqr.so')
Scripting.excludes.append('generators') # data/rcc8/generators/rcc8comp.pl
# global VERSION
Scripting.dist(APPNAME, VERSION)
def distcheck():
# global VERSION
import Scripting
Scripting.distcheck(APPNAME, VERSION)
def dist_hook():
file = open('VERSION', 'w')
file.write(VERSION)
file.close()
def doxygen(ctx):
"generates doxygen documentation"
doxygen_conf = os.path.join('gqr', 'doxygen.cfg')
try:
Popen(['doxygen', doxygen_conf]).wait()
except:
raise SystemExit('Install doxygen first.')