-
Notifications
You must be signed in to change notification settings - Fork 17
/
setup.py
executable file
·65 lines (55 loc) · 2.15 KB
/
setup.py
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
#!/usr/bin/env python
import logging
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from setup_support import SetupApp
class GNATCollOMP(SetupApp):
name = 'gnatcoll_omp'
project = 'gnatcoll_omp.gpr'
description = 'GNATColl OpenMP bindings'
def create(self):
super(GNATCollOMP, self).create()
self.build_cmd.add_argument(
'--debug',
help='build project in debug mode',
action="store_true",
default=False)
def update_config(self, config, args):
logging.info('%-26s %s',
'Libraries kind', ", ".join(config.data['library_types']))
# Set library version
with open(os.path.join(config.source_dir, '..',
'version_information'), 'r') as fd:
version = fd.read().strip()
config.set_data('GNATCOLL_VERSION', version, sub='gprbuild')
# Set build mode
config.set_data('BUILD', 'DEBUG' if args.debug else 'PROD',
sub='gprbuild')
logging.info('%-26s %s', 'Build mode',
config.data['gprbuild']['BUILD'])
# Set GNATCOLL_OS
if 'darwin' in config.data['canonical_target']:
gnatcoll_os = 'osx'
elif 'windows' in config.data['canonical_target']:
gnatcoll_os = 'windows'
else:
# Assume this is an Unix system
gnatcoll_os = 'unix'
config.set_data('GNATCOLL_OS', gnatcoll_os, sub='gprbuild')
def variants(self, config, cmd):
result = []
for library_type in config.data['library_types']:
gpr_vars = {'LIBRARY_TYPE': library_type,
'XMLADA_BUILD': library_type,
'GPR_BUILD': library_type}
if cmd == 'install':
result.append((['--build-name=%s' % library_type,
'--build-var=LIBRARY_TYPE'],
gpr_vars))
else:
result.append(([], gpr_vars))
return result
if __name__ == '__main__':
app = GNATCollOMP()
sys.exit(app.run())