blob: e7086abbf231c7465453eeb5332aa58035f6d556 [file] [log] [blame]
Alec Thileniusf79f52b2017-12-22 12:10:17 -07001project('mosys', 'c')
2
3# Include common. This is passed to all subdir build files as well
4include_common = include_directories(['include'])
5
6# Config data used for creating a config header and including it
7conf_data = configuration_data()
8
9# Set for all platforms
10conf_data.set('PROGRAM', '"mosys"')
11conf_data.set('VERSION', '"1.2.03"')
12conf_data.set('CONFIG_LITTLE_ENDIAN', 1)
13conf_data.set('CONFIG_LOGLEVEL', 4)
14conf_data.set('CONFIG_PLATFORM_EXPERIMENTAL', 1)
Jason D. Clintona7fd67d2018-04-17 13:34:08 -060015use_cros_config = get_option('use_cros_config') == true
Alec Thileniusf79f52b2017-12-22 12:10:17 -070016if use_cros_config
17 conf_data.set('CONFIG_CROS_CONFIG', 1)
18endif
19
20# Setting on a per-arch basis
21arch = get_option('arch')
22if arch == 'x86' or arch == 'x86_64' or arch == 'amd64'
Alec Thileniusf79f52b2017-12-22 12:10:17 -070023 conf_data.set('CONFIG_PLATFORM_ARCH_X86', 1)
Paul Kocialkowski8cc37a32018-06-02 22:18:00 +020024elif arch == 'arm' or arch == 'arm64'
Alec Thileniusf79f52b2017-12-22 12:10:17 -070025 conf_data.set('CONFIG_PLATFORM_ARCH_ARMEL', 1)
Alec Thileniusf79f52b2017-12-22 12:10:17 -070026endif
27
28# Create the config header file and include it by default while compiling
29configure_file(
30 output : 'config.h',
31 configuration : conf_data,
32)
33add_global_arguments('-include', 'config.h', language: 'c')
Jason D. Clintona7fd67d2018-04-17 13:34:08 -060034add_global_arguments('-std=gnu99', language : 'c')
Alec Thileniusf79f52b2017-12-22 12:10:17 -070035
Brian Norrise11e08f2018-04-30 10:46:48 -070036cc = meson.get_compiler('c')
37if (cc.has_argument('-Wno-address-of-packed-member'))
38 add_global_arguments(['-Wno-address-of-packed-member'], language: 'c')
39endif
Jason D. Clinton4f88fa32018-08-29 15:34:26 -060040add_global_arguments('-Wall', language : 'c')
Brian Norris402d8322018-04-30 14:22:51 -070041add_global_arguments('-Werror', language : 'c')
Jason D. Clinton4f88fa32018-08-29 15:34:26 -060042add_global_arguments('-Wstrict-prototypes', language : 'c')
43add_global_arguments('-Wundef', language : 'c')
Brian Norrise11e08f2018-04-30 10:46:48 -070044
Alec Thileniusf79f52b2017-12-22 12:10:17 -070045# External libs used by Mosys
46fmap_dep = dependency('fmap')
47uuid_dep = dependency('uuid')
48
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060049libmosys_src = files()
Andrew Lamb9cccc892019-02-13 14:53:44 -070050unittest_src = files()
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060051
Alec Thileniusf79f52b2017-12-22 12:10:17 -070052# Subdirs with source to link against
53subdir('core')
54subdir('drivers')
55subdir('intf')
56subdir('lib')
57subdir('platform')
58
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060059deps = [
60 fmap_dep,
61 uuid_dep,
62]
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060063
64# Cros config is a special snowflake.
65if use_cros_config
66 libmosys_src += mosys_lib_cros_config_src
67 fdt_dep = meson.get_compiler('c').find_library('fdt')
68 deps += fdt_dep
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060069endif
70
Alec Thileniusf79f52b2017-12-22 12:10:17 -070071# Lib momsys shared library target
72libmosys = static_library(
73 'mosys',
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060074 libmosys_src,
75 dependencies: deps,
Alec Thileniusf79f52b2017-12-22 12:10:17 -070076 include_directories: include_common,
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060077 pic: true,
Alec Thileniusf79f52b2017-12-22 12:10:17 -070078)
Andrew Lamb9cccc892019-02-13 14:53:44 -070079
80# Tests need the libmosys library, so they must be configured at the end.
81subdir('unittests')