-
Notifications
You must be signed in to change notification settings - Fork 2
/
b2code-option.py
43 lines (34 loc) · 1.53 KB
/
b2code-option.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
# -*- coding: utf-8 -*-
from __future__ import print_function
import textwrap
from setup_tools import update_environment, SetupToolsArgumentParser
# Allowed options
options = ['debug', 'opt', 'intel', 'clang']
def get_argument_parser():
description = textwrap.dedent('''\n
Set up the environment for selected compiler options:
debug : use gcc compiler, include debug symbols, no optimization
opt : use gcc compiler, no debug symbols, turn on -O3 optimization
intel : use intel compiler, no debug symbols
clang : use clang compiler (LLVM), no debug symbols, turn on -O3 optimization
''')
parser = SetupToolsArgumentParser(prog='b2code-option',
description=description,
state_env_var='BELLE2_OPTION')
parser.add_argument('option',
metavar='OPTION',
type=str,
choices=options,
help='Environment for the compiler option.')
parser.add_argument('--csh',
default=False,
action='store_true',
help='To be used with csh shells.')
return parser
if __name__ == '__main__':
args = get_argument_parser().parse_args()
# Update the environment with the new option.
update_environment(option=args.option,
csh=args.csh)
# Inform the user about successful completion.
print('echo "Environment setup for build option: ${BELLE2_OPTION}"')