blob: fe69111ff4f56999fb5cda9e85875a4245fe5e36 [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')
Manoj Guptaace739d2019-08-13 18:21:57 -070037add_global_arguments('-Wno-address-of-packed-member', language: 'c')
Jason D. Clinton4f88fa32018-08-29 15:34:26 -060038add_global_arguments('-Wall', language : 'c')
Brian Norris402d8322018-04-30 14:22:51 -070039add_global_arguments('-Werror', language : 'c')
Jason D. Clinton4f88fa32018-08-29 15:34:26 -060040add_global_arguments('-Wstrict-prototypes', language : 'c')
41add_global_arguments('-Wundef', language : 'c')
Brian Norrise11e08f2018-04-30 10:46:48 -070042
Alec Thileniusf79f52b2017-12-22 12:10:17 -070043# External libs used by Mosys
44fmap_dep = dependency('fmap')
45uuid_dep = dependency('uuid')
46
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060047libmosys_src = files()
Andrew Lamb9cccc892019-02-13 14:53:44 -070048unittest_src = files()
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060049
Alec Thileniusf79f52b2017-12-22 12:10:17 -070050# Subdirs with source to link against
51subdir('core')
52subdir('drivers')
53subdir('intf')
54subdir('lib')
55subdir('platform')
56
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060057deps = [
58 fmap_dep,
59 uuid_dep,
60]
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060061
62# Cros config is a special snowflake.
63if use_cros_config
64 libmosys_src += mosys_lib_cros_config_src
65 fdt_dep = meson.get_compiler('c').find_library('fdt')
66 deps += fdt_dep
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060067endif
68
Alec Thileniusf79f52b2017-12-22 12:10:17 -070069# Lib momsys shared library target
70libmosys = static_library(
71 'mosys',
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060072 libmosys_src,
73 dependencies: deps,
Alec Thileniusf79f52b2017-12-22 12:10:17 -070074 include_directories: include_common,
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060075 pic: true,
Alec Thileniusf79f52b2017-12-22 12:10:17 -070076)
Andrew Lamb9cccc892019-02-13 14:53:44 -070077
78# Tests need the libmosys library, so they must be configured at the end.
Manoj Guptaace739d2019-08-13 18:21:57 -070079subdir('unittests')