Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 1 | project('mosys', 'c') |
| 2 | |
| 3 | # Include common. This is passed to all subdir build files as well |
| 4 | include_common = include_directories(['include']) |
| 5 | |
| 6 | # Config data used for creating a config header and including it |
| 7 | conf_data = configuration_data() |
| 8 | |
Jack Rosenthal | 24fea5c | 2020-10-20 09:51:15 -0600 | [diff] [blame] | 9 | use_vpd_file_cache = get_option('use_vpd_file_cache') == true |
Jason D. Clinton | a7fd67d | 2018-04-17 13:34:08 -0600 | [diff] [blame] | 10 | use_cros_config = get_option('use_cros_config') == true |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 11 | if use_cros_config |
| 12 | conf_data.set('CONFIG_CROS_CONFIG', 1) |
| 13 | endif |
| 14 | |
| 15 | # Setting on a per-arch basis |
Jack Rosenthal | 62ce543 | 2020-05-15 10:10:40 -0600 | [diff] [blame] | 16 | arch = host_machine.cpu_family() |
| 17 | if arch == 'x86' or arch == 'x86_64' |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 18 | conf_data.set('CONFIG_PLATFORM_ARCH_X86', 1) |
Jack Rosenthal | 62ce543 | 2020-05-15 10:10:40 -0600 | [diff] [blame] | 19 | elif arch == 'arm' or arch == 'aarch64' |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 20 | conf_data.set('CONFIG_PLATFORM_ARCH_ARMEL', 1) |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 21 | endif |
| 22 | |
Jack Rosenthal | 8180e5f | 2020-04-30 10:50:42 -0600 | [diff] [blame] | 23 | platform_intf = get_option('platform_intf') |
| 24 | if platform_intf != '' |
| 25 | conf_data.set_quoted('CONFIG_SINGLE_PLATFORM', platform_intf) |
| 26 | endif |
| 27 | |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 28 | # Create the config header file and include it by default while compiling |
| 29 | configure_file( |
| 30 | output : 'config.h', |
| 31 | configuration : conf_data, |
| 32 | ) |
| 33 | add_global_arguments('-include', 'config.h', language: 'c') |
Jason D. Clinton | a7fd67d | 2018-04-17 13:34:08 -0600 | [diff] [blame] | 34 | add_global_arguments('-std=gnu99', language : 'c') |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 35 | |
Brian Norris | e11e08f | 2018-04-30 10:46:48 -0700 | [diff] [blame] | 36 | cc = meson.get_compiler('c') |
Jason D. Clinton | 4f88fa3 | 2018-08-29 15:34:26 -0600 | [diff] [blame] | 37 | add_global_arguments('-Wall', language : 'c') |
Brian Norris | 402d832 | 2018-04-30 14:22:51 -0700 | [diff] [blame] | 38 | add_global_arguments('-Werror', language : 'c') |
Jason D. Clinton | 4f88fa3 | 2018-08-29 15:34:26 -0600 | [diff] [blame] | 39 | add_global_arguments('-Wstrict-prototypes', language : 'c') |
| 40 | add_global_arguments('-Wundef', language : 'c') |
Brian Norris | e11e08f | 2018-04-30 10:46:48 -0700 | [diff] [blame] | 41 | |
Jack Rosenthal | 85039cd | 2020-05-15 17:48:37 -0600 | [diff] [blame] | 42 | # Require that externally-visible symbols have a prototype. This |
| 43 | # helps find missing usages of 'static'. |
| 44 | add_global_arguments('-Wmissing-variable-declarations', language : 'c') |
| 45 | add_global_arguments('-Wmissing-prototypes', language : 'c') |
| 46 | |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 47 | # External libs used by Mosys |
Jack Rosenthal | bca93e3 | 2020-05-13 10:21:06 -0600 | [diff] [blame] | 48 | minijail_dep = declare_dependency(link_args: '-lminijail') |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 49 | |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 50 | libmosys_src = files() |
Jack Rosenthal | 3ae1262 | 2020-05-15 10:58:49 -0600 | [diff] [blame] | 51 | platform_support_src = files() |
Andrew Lamb | 9cccc89 | 2019-02-13 14:53:44 -0700 | [diff] [blame] | 52 | unittest_src = files() |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 53 | |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 54 | # Subdirs with source to link against |
| 55 | subdir('core') |
| 56 | subdir('drivers') |
| 57 | subdir('intf') |
| 58 | subdir('lib') |
| 59 | subdir('platform') |
| 60 | |
Jack Rosenthal | df9917b | 2020-10-21 10:57:39 -0600 | [diff] [blame] | 61 | deps = [minijail_dep] |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 62 | |
| 63 | # Cros config is a special snowflake. |
| 64 | if use_cros_config |
| 65 | libmosys_src += mosys_lib_cros_config_src |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 66 | endif |
| 67 | |
Jack Rosenthal | bca93e3 | 2020-05-13 10:21:06 -0600 | [diff] [blame] | 68 | subdir('mains') |
Manoj Gupta | ace739d | 2019-08-13 18:21:57 -0700 | [diff] [blame] | 69 | subdir('unittests') |