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 | |
Jason D. Clinton | a7fd67d | 2018-04-17 13:34:08 -0600 | [diff] [blame] | 9 | use_cros_config = get_option('use_cros_config') == true |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 10 | if use_cros_config |
| 11 | conf_data.set('CONFIG_CROS_CONFIG', 1) |
| 12 | endif |
| 13 | |
| 14 | # Setting on a per-arch basis |
Jack Rosenthal | 62ce543 | 2020-05-15 10:10:40 -0600 | [diff] [blame^] | 15 | arch = host_machine.cpu_family() |
| 16 | if arch == 'x86' or arch == 'x86_64' |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 17 | conf_data.set('CONFIG_PLATFORM_ARCH_X86', 1) |
Jack Rosenthal | 62ce543 | 2020-05-15 10:10:40 -0600 | [diff] [blame^] | 18 | elif arch == 'arm' or arch == 'aarch64' |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 19 | conf_data.set('CONFIG_PLATFORM_ARCH_ARMEL', 1) |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 20 | endif |
| 21 | |
Jack Rosenthal | 8180e5f | 2020-04-30 10:50:42 -0600 | [diff] [blame] | 22 | platform_intf = get_option('platform_intf') |
| 23 | if platform_intf != '' |
| 24 | conf_data.set_quoted('CONFIG_SINGLE_PLATFORM', platform_intf) |
| 25 | endif |
| 26 | |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 27 | # Create the config header file and include it by default while compiling |
| 28 | configure_file( |
| 29 | output : 'config.h', |
| 30 | configuration : conf_data, |
| 31 | ) |
| 32 | add_global_arguments('-include', 'config.h', language: 'c') |
Jason D. Clinton | a7fd67d | 2018-04-17 13:34:08 -0600 | [diff] [blame] | 33 | add_global_arguments('-std=gnu99', language : 'c') |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 34 | |
Brian Norris | e11e08f | 2018-04-30 10:46:48 -0700 | [diff] [blame] | 35 | cc = meson.get_compiler('c') |
Jason D. Clinton | 4f88fa3 | 2018-08-29 15:34:26 -0600 | [diff] [blame] | 36 | add_global_arguments('-Wall', language : 'c') |
Brian Norris | 402d832 | 2018-04-30 14:22:51 -0700 | [diff] [blame] | 37 | add_global_arguments('-Werror', language : 'c') |
Jason D. Clinton | 4f88fa3 | 2018-08-29 15:34:26 -0600 | [diff] [blame] | 38 | add_global_arguments('-Wstrict-prototypes', language : 'c') |
| 39 | add_global_arguments('-Wundef', language : 'c') |
Brian Norris | e11e08f | 2018-04-30 10:46:48 -0700 | [diff] [blame] | 40 | |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 41 | # External libs used by Mosys |
| 42 | fmap_dep = dependency('fmap') |
Jack Rosenthal | bca93e3 | 2020-05-13 10:21:06 -0600 | [diff] [blame] | 43 | minijail_dep = declare_dependency(link_args: '-lminijail') |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 44 | |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 45 | libmosys_src = files() |
Andrew Lamb | 9cccc89 | 2019-02-13 14:53:44 -0700 | [diff] [blame] | 46 | unittest_src = files() |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 47 | |
Alec Thilenius | f79f52b | 2017-12-22 12:10:17 -0700 | [diff] [blame] | 48 | # Subdirs with source to link against |
| 49 | subdir('core') |
| 50 | subdir('drivers') |
| 51 | subdir('intf') |
| 52 | subdir('lib') |
| 53 | subdir('platform') |
| 54 | |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 55 | deps = [ |
| 56 | fmap_dep, |
Jack Rosenthal | bca93e3 | 2020-05-13 10:21:06 -0600 | [diff] [blame] | 57 | minijail_dep, |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 58 | ] |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 59 | |
| 60 | # Cros config is a special snowflake. |
| 61 | if use_cros_config |
| 62 | libmosys_src += mosys_lib_cros_config_src |
Jason D. Clinton | 3a2b39c | 2018-04-16 11:42:49 -0600 | [diff] [blame] | 63 | endif |
| 64 | |
Jack Rosenthal | bca93e3 | 2020-05-13 10:21:06 -0600 | [diff] [blame] | 65 | subdir('mains') |
Manoj Gupta | ace739d | 2019-08-13 18:21:57 -0700 | [diff] [blame] | 66 | subdir('unittests') |