blob: 9888864e6424960e461eae07dfe2b98207bf687f [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)
Alec Thileniusf79f52b2017-12-22 12:10:17 -070024elif arch == 'mip'
25 conf_data.set('CONFIG_PLATFORM_ARCH_MIPSEL', 1)
Paul Kocialkowski8cc37a32018-06-02 22:18:00 +020026elif arch == 'arm' or arch == 'arm64'
Alec Thileniusf79f52b2017-12-22 12:10:17 -070027 conf_data.set('CONFIG_PLATFORM_ARCH_ARMEL', 1)
Alec Thileniusf79f52b2017-12-22 12:10:17 -070028endif
29
30# Create the config header file and include it by default while compiling
31configure_file(
32 output : 'config.h',
33 configuration : conf_data,
34)
35add_global_arguments('-include', 'config.h', language: 'c')
Jason D. Clintona7fd67d2018-04-17 13:34:08 -060036add_global_arguments('-std=gnu99', language : 'c')
Alec Thileniusf79f52b2017-12-22 12:10:17 -070037
Brian Norrise11e08f2018-04-30 10:46:48 -070038cc = meson.get_compiler('c')
39if (cc.has_argument('-Wno-address-of-packed-member'))
40 add_global_arguments(['-Wno-address-of-packed-member'], language: 'c')
41endif
Jason D. Clinton4f88fa32018-08-29 15:34:26 -060042add_global_arguments('-Wall', language : 'c')
Brian Norris402d8322018-04-30 14:22:51 -070043add_global_arguments('-Werror', language : 'c')
Jason D. Clinton4f88fa32018-08-29 15:34:26 -060044add_global_arguments('-Wstrict-prototypes', language : 'c')
45add_global_arguments('-Wundef', language : 'c')
Brian Norrise11e08f2018-04-30 10:46:48 -070046
Alec Thileniusf79f52b2017-12-22 12:10:17 -070047# External libs used by Mosys
48fmap_dep = dependency('fmap')
49uuid_dep = dependency('uuid')
50
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060051libmosys_src = files()
52
Alec Thileniusf79f52b2017-12-22 12:10:17 -070053# Subdirs with source to link against
54subdir('core')
55subdir('drivers')
56subdir('intf')
57subdir('lib')
58subdir('platform')
59
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060060deps = [
61 fmap_dep,
62 uuid_dep,
63]
64link_whole = []
Jason D. Clintona236cdf2018-04-22 18:32:02 -060065objects = []
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060066
67# Cros config is a special snowflake.
68if use_cros_config
69 libmosys_src += mosys_lib_cros_config_src
70 fdt_dep = meson.get_compiler('c').find_library('fdt')
71 deps += fdt_dep
72 dtb_lib = static_library(
73 'cros_config_dtb',
74 cros_config_dtb_src,
75 c_args: [
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060076 '-D__ASSEMBLY__',
77 '-c',
78 ],
79 link_args: [
80 '-znoexecstack',
81 '-r',
82 ],
83 )
84 link_whole += dtb_lib
Jason D. Clintona236cdf2018-04-22 18:32:02 -060085 objects = dtb_lib.extract_all_objects()
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060086endif
87
Alec Thileniusf79f52b2017-12-22 12:10:17 -070088# Lib momsys shared library target
89libmosys = static_library(
90 'mosys',
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060091 libmosys_src,
92 dependencies: deps,
Alec Thileniusf79f52b2017-12-22 12:10:17 -070093 include_directories: include_common,
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060094 link_whole: link_whole,
Jason D. Clintona236cdf2018-04-22 18:32:02 -060095 objects: objects,
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060096 pic: true,
Alec Thileniusf79f52b2017-12-22 12:10:17 -070097)