]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | # This file is open source software, licensed to you under the terms |
2 | # of the Apache License, Version 2.0 (the "License"). See the NOTICE file | |
3 | # distributed with this work for additional information regarding copyright | |
4 | # ownership. You may not use this file except in compliance with the License. | |
5 | # | |
6 | # You may obtain a copy of the License at | |
7 | # | |
8 | # http://www.apache.org/licenses/LICENSE-2.0 | |
9 | # | |
10 | # Unless required by applicable law or agreed to in writing, | |
11 | # software distributed under the License is distributed on an | |
12 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
13 | # KIND, either express or implied. See the License for the | |
14 | # specific language governing permissions and limitations | |
15 | # under the License. | |
16 | # | |
17 | ||
18 | import os | |
19 | ||
9f95a23c | 20 | SUPPORTED_MODES = ['release', 'debug', 'dev', 'sanitize'] |
11fdf7f2 TL |
21 | |
22 | ROOT_PATH = os.path.realpath(os.path.dirname(__file__)) | |
23 | ||
24 | BUILD_PATHS = { mode: os.path.join(ROOT_PATH, 'build', mode) for mode in SUPPORTED_MODES } | |
25 | ||
9f95a23c | 26 | COOKING_BASIC_ARGS = ['./cooking.sh'] |
11fdf7f2 TL |
27 | |
28 | def is_release_mode(mode): | |
29 | return mode == 'release' | |
30 | ||
31 | def convert_strings_to_cmake_list(*args): | |
32 | """Converts a sequence of whitespace-separated strings of tokens into a semicolon-separated | |
33 | string of tokens for CMake. | |
34 | ||
35 | """ | |
36 | return ';'.join(' '.join(args).split()) | |
37 | ||
38 | def translate_arg(arg, new_name, value_when_none='no'): | |
39 | """ | |
40 | Translate a value populated from the command-line into a name to pass to the invocation of CMake. | |
41 | """ | |
42 | if arg is None: | |
43 | value = value_when_none | |
44 | elif type(arg) is bool: | |
45 | value = 'yes' if arg else 'no' | |
46 | else: | |
47 | value = arg | |
48 | ||
1e59de90 TL |
49 | if value is None: |
50 | return '' | |
51 | else: | |
52 | return '-DSeastar_{}={}'.format(new_name, value) |