]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # |
2 | # Copyright (c) 2016 Stefan Seefeld | |
3 | # All rights reserved. | |
4 | # | |
5 | # Distributed under the Boost Software License, Version 1.0. | |
6 | # (See accompanying file LICENSE_1_0.txt or copy at | |
7 | # http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | from . import append_feature_flag | |
10 | ||
11 | class features: | |
12 | ||
13 | @classmethod | |
14 | def init_once(cls, env): | |
15 | pass | |
16 | ||
17 | @staticmethod | |
18 | def architecture(env, arch): | |
19 | if arch: | |
20 | flag = {'x86' : '-m32', | |
21 | 'x86_64' : '-m64',}.get(arch) | |
22 | if flag: | |
23 | append_feature_flag(env, CCFLAGS = flag) | |
24 | ||
25 | @staticmethod | |
26 | def optimize(env, optimize): | |
27 | if not optimize or optimize == "no": | |
28 | append_feature_flag(env, CCFLAGS = "-O0 -fno-inline") | |
29 | elif optimize == "speed": | |
30 | append_feature_flag(env, CCFLAGS = "-O3 -finline-functions -Wno-inline") | |
31 | elif optimize == "space": | |
32 | append_feature_flag(env, CCFLAGS = "-Os") | |
33 | else: | |
34 | append_feature_flag(env, CCFLAGS = "") | |
35 | ||
36 | @staticmethod | |
37 | def profile(env, profile): | |
38 | if profile: | |
39 | append_feature_flag(env, CCFLAGS = "-pg", LINKFLAGS = "-pg") | |
40 | else: | |
41 | append_feature_flag(env, CCFLAGS = "", LINKFLAGS = "") | |
42 | ||
43 | @staticmethod | |
44 | def threading(env, threading): | |
45 | if threading == "multi": | |
46 | append_feature_flag(env, CCFLAGS = "-pthread", LINKFLAGS = "-pthread") | |
47 | else: | |
48 | append_feature_flag(env, CCFLAGS = "", LINKFLAGS = "") | |
49 | ||
50 | @staticmethod | |
51 | def debug(env, debug): | |
52 | if debug: | |
53 | append_feature_flag(env, CCFLAGS = "-g", CPPDEFINES = []) | |
54 | else: | |
55 | append_feature_flag(env, CCFLAGS = "", CPPDEFINES = "NDEBUG") |