Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 1 | project('phosphor-bmc-code-mgmt', 'cpp', |
| 2 | default_options: [ |
Gunnar Mills | f7a69e1 | 2020-06-15 12:16:51 -0500 | [diff] [blame] | 3 | 'buildtype=debugoptimized', |
Patrick Williams | 4026702 | 2021-08-26 16:48:42 -0500 | [diff] [blame] | 4 | 'cpp_std=c++20', |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 5 | 'warning_level=3', |
Gunnar Mills | f7a69e1 | 2020-06-15 12:16:51 -0500 | [diff] [blame] | 6 | 'werror=true' |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 7 | ], |
Patrick Williams | 4026702 | 2021-08-26 16:48:42 -0500 | [diff] [blame] | 8 | meson_version: '>= 0.57.0', |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 9 | license: 'Apache-2.0', |
| 10 | version: '1.0') |
| 11 | |
Lei YU | 2586818 | 2021-05-14 14:50:51 +0800 | [diff] [blame] | 12 | add_project_arguments( |
| 13 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
| 14 | '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| 15 | '-DBOOST_NO_RTTI', |
| 16 | '-DBOOST_NO_TYPEID', |
| 17 | '-DBOOST_ALL_NO_LIB', |
| 18 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 19 | '-DBOOST_ASIO_NO_DEPRECATED', |
| 20 | language: 'cpp', |
| 21 | ) |
| 22 | |
Patrick Williams | 4026702 | 2021-08-26 16:48:42 -0500 | [diff] [blame] | 23 | cpp = meson.get_compiler('cpp') |
| 24 | |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 25 | conf = configuration_data() |
| 26 | |
| 27 | # DBus information |
| 28 | conf.set_quoted('BMC_INVENTORY_INTERFACE', 'xyz.openbmc_project.Inventory.Item.Bmc') |
| 29 | conf.set_quoted('BUSNAME_UPDATER', 'xyz.openbmc_project.Software.BMC.Updater') |
| 30 | conf.set_quoted('DOWNLOAD_BUSNAME', 'xyz.openbmc_project.Software.Download') |
| 31 | conf.set_quoted('FILEPATH_IFACE', 'xyz.openbmc_project.Common.FilePath') |
| 32 | conf.set_quoted('INVENTORY_PATH', '/xyz/openbmc_project/inventory/') |
| 33 | conf.set_quoted('MAPPER_BUSNAME', 'xyz.openbmc_project.ObjectMapper') |
| 34 | conf.set_quoted('MAPPER_INTERFACE', 'xyz.openbmc_project.ObjectMapper') |
| 35 | conf.set_quoted('MAPPER_PATH', '/xyz/openbmc_project/object_mapper') |
| 36 | conf.set_quoted('SOFTWARE_OBJPATH', '/xyz/openbmc_project/software') |
| 37 | conf.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1') |
| 38 | conf.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1') |
| 39 | conf.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager') |
| 40 | conf.set_quoted('VERSION_BUSNAME', 'xyz.openbmc_project.Software.Version') |
| 41 | conf.set_quoted('VERSION_IFACE', 'xyz.openbmc_project.Software.Version') |
Chanh Nguyen | 1fd6ddd | 2021-01-06 11:09:09 +0700 | [diff] [blame] | 42 | conf.set_quoted('EXTENDED_VERSION_IFACE', 'xyz.openbmc_project.Software.ExtendedVersion') |
Justin Ledford | 054bb0b | 2022-03-15 15:46:58 -0700 | [diff] [blame] | 43 | conf.set_quoted('COMPATIBLE_IFACE', 'xyz.openbmc_project.Inventory.Decorator.Compatible') |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 44 | |
| 45 | # Names of the forward and reverse associations |
| 46 | conf.set_quoted('ACTIVATION_FWD_ASSOCIATION', 'inventory') |
| 47 | conf.set_quoted('ACTIVATION_REV_ASSOCIATION', 'activation') |
| 48 | conf.set_quoted('ACTIVE_FWD_ASSOCIATION', 'active') |
| 49 | conf.set_quoted('ACTIVE_REV_ASSOCIATION', 'software_version') |
| 50 | conf.set_quoted('FUNCTIONAL_FWD_ASSOCIATION', 'functional') |
| 51 | conf.set_quoted('FUNCTIONAL_REV_ASSOCIATION', 'software_version') |
| 52 | conf.set_quoted('UPDATEABLE_FWD_ASSOCIATION', 'updateable') |
| 53 | conf.set_quoted('UPDATEABLE_REV_ASSOCIATION', 'software_version') |
| 54 | |
| 55 | # Filesystem files and directories |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 56 | # The prefix path for the versioned read-only bmc partitions |
| 57 | conf.set_quoted('BMC_ROFS_PREFIX', get_option('media-dir') + '/rofs-') |
| 58 | # The name of the BMC table of contents file |
| 59 | conf.set_quoted('OS_RELEASE_FILE', '/etc/os-release') |
| 60 | # The dir where activation data is stored in files |
| 61 | conf.set_quoted('PERSIST_DIR', '/var/lib/phosphor-bmc-code-mgmt/') |
| 62 | |
| 63 | # Supported BMC layout types |
| 64 | conf.set('STATIC_LAYOUT', get_option('bmc-layout').contains('static')) |
| 65 | conf.set('UBIFS_LAYOUT', get_option('bmc-layout').contains('ubi')) |
Adriana Kobylak | 70f5bc0 | 2020-05-13 14:08:14 -0500 | [diff] [blame] | 66 | conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc')) |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 67 | |
| 68 | # Configurable features |
| 69 | conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) |
Adriana Kobylak | 42bd993 | 2021-01-28 09:45:24 -0600 | [diff] [blame] | 70 | conf.set('WANT_SIGNATURE_VERIFY', \ |
| 71 | get_option('verify-signature').enabled() or \ |
| 72 | get_option('verify-full-signature').enabled()) |
George Liu | 0a06e97 | 2020-12-17 09:17:04 +0800 | [diff] [blame] | 73 | conf.set('WANT_SIGNATURE_FULL_VERIFY', get_option('verify-full-signature').enabled()) |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 74 | |
| 75 | # Configurable variables |
| 76 | conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) |
| 77 | conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name')) |
| 78 | conf.set_quoted('IMG_UPLOAD_DIR', get_option('img-upload-dir')) |
| 79 | conf.set_quoted('MANIFEST_FILE_NAME', get_option('manifest-file-name')) |
| 80 | conf.set_quoted('MEDIA_DIR', get_option('media-dir')) |
Adriana Kobylak | 73609bb | 2020-06-18 15:05:40 -0500 | [diff] [blame] | 81 | optional_array = get_option('optional-images') |
| 82 | optional_images = '' |
| 83 | foreach optiona_image : optional_array |
| 84 | optional_images = ' '.join([optional_images, optiona_image]) |
| 85 | endforeach |
| 86 | conf.set_quoted('OPTIONAL_IMAGES', optional_images) |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 87 | conf.set_quoted('PUBLICKEY_FILE_NAME', get_option('publickey-file-name')) |
| 88 | conf.set_quoted('SIGNATURE_FILE_EXT', get_option('signature-file-ext')) |
| 89 | conf.set_quoted('SIGNED_IMAGE_CONF_PATH', get_option('signed-image-conf-path')) |
| 90 | conf.set_quoted('SYNC_LIST_DIR_PATH', get_option('sync-list-dir-path')) |
| 91 | conf.set_quoted('SYNC_LIST_FILE_NAME', get_option('sync-list-file-name')) |
Miguel Gomez | 21dad04 | 2020-06-26 20:54:48 +0000 | [diff] [blame] | 92 | conf.set_quoted('BMC_MSL', get_option('bmc-msl')) |
| 93 | conf.set_quoted('REGEX_BMC_MSL', get_option('regex-bmc-msl')) |
| 94 | |
Lei YU | 6e9fb1d | 2021-02-19 18:01:40 +0800 | [diff] [blame] | 95 | if get_option('host-bios-upgrade').enabled() |
| 96 | conf.set_quoted('BIOS_OBJPATH', get_option('bios-object-path')) |
| 97 | endif |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 98 | |
Lei YU | 6376964 | 2021-12-10 16:15:04 +0800 | [diff] [blame] | 99 | if get_option('bmc-static-dual-image').enabled() |
| 100 | conf.set('BMC_STATIC_DUAL_IMAGE', get_option('bmc-static-dual-image').enabled()) |
| 101 | conf.set_quoted('ALT_ROFS_DIR', get_option('alt-rofs-dir')) |
Lei YU | cc9b41a | 2021-12-15 14:07:16 +0800 | [diff] [blame] | 102 | conf.set_quoted('ALT_RWFS', get_option('alt-rwfs-dir')) |
| 103 | else |
| 104 | conf.set_quoted('ALT_RWFS', '/media/alt/var/persist') |
Lei YU | 6376964 | 2021-12-10 16:15:04 +0800 | [diff] [blame] | 105 | endif |
| 106 | |
Adriana Kobylak | 0af80a4 | 2020-05-05 13:32:10 -0500 | [diff] [blame] | 107 | configure_file(output: 'config.h', configuration: conf) |
Adriana Kobylak | 113492e | 2020-05-05 13:45:45 -0500 | [diff] [blame] | 108 | |
Patrick Williams | c026f6c | 2022-03-21 09:37:14 -0500 | [diff] [blame] | 109 | sdbusplus_dep = dependency('sdbusplus') |
| 110 | sdbusplusplus_prog = find_program('sdbus++', native: true) |
| 111 | sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true) |
Patrick Williams | 4026702 | 2021-08-26 16:48:42 -0500 | [diff] [blame] | 112 | |
Patrick Williams | c026f6c | 2022-03-21 09:37:14 -0500 | [diff] [blame] | 113 | pdi_dep = dependency('phosphor-dbus-interfaces') |
| 114 | phosphor_logging_dep = dependency('phosphor-logging') |
Patrick Williams | 4026702 | 2021-08-26 16:48:42 -0500 | [diff] [blame] | 115 | |
| 116 | cereal_dep = dependency('cereal', required: false) |
| 117 | has_cereal = cpp.has_header_symbol( |
| 118 | 'cereal/cereal.hpp', |
| 119 | 'cereal::specialize', |
| 120 | dependencies: cereal_dep, |
| 121 | required: false) |
| 122 | if not has_cereal |
| 123 | cereal_opts = import('cmake').subproject_options() |
| 124 | cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'}) |
| 125 | cereal_proj = import('cmake').subproject( |
| 126 | 'cereal', |
| 127 | options: cereal_opts, |
| 128 | required: false) |
| 129 | assert(cereal_proj.found(), 'cereal is required') |
| 130 | cereal_dep = cereal_proj.dependency('cereal') |
| 131 | endif |
| 132 | |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 133 | deps = [ |
Patrick Williams | 4026702 | 2021-08-26 16:48:42 -0500 | [diff] [blame] | 134 | cereal_dep, |
Patrick Williams | c026f6c | 2022-03-21 09:37:14 -0500 | [diff] [blame] | 135 | pdi_dep, |
| 136 | phosphor_logging_dep, |
| 137 | sdbusplus_dep, |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 138 | ] |
| 139 | |
| 140 | ssl = dependency('openssl') |
| 141 | |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 142 | systemd = dependency('systemd') |
Lei YU | 3d8ab81 | 2021-12-24 10:35:47 +0800 | [diff] [blame] | 143 | systemd_system_unit_dir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir') |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 144 | |
| 145 | unit_files = [ |
Adriana Kobylak | 436be81 | 2020-06-17 09:44:56 -0500 | [diff] [blame] | 146 | 'obmc-flash-bmc-setenv@.service.in', |
| 147 | 'reboot-guard-disable.service.in', |
| 148 | 'reboot-guard-enable.service.in', |
| 149 | 'force-reboot.service.in', |
| 150 | 'usr-local.mount.in', |
| 151 | 'xyz.openbmc_project.Software.BMC.Updater.service.in', |
| 152 | 'xyz.openbmc_project.Software.Download.service.in', |
| 153 | 'xyz.openbmc_project.Software.Sync.service.in', |
| 154 | 'xyz.openbmc_project.Software.Version.service.in' |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 155 | ] |
| 156 | |
Adriana Kobylak | 113492e | 2020-05-05 13:45:45 -0500 | [diff] [blame] | 157 | subdir('xyz/openbmc_project/Software/Image') |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 158 | |
| 159 | image_updater_sources = files( |
| 160 | 'activation.cpp', |
Adriana Kobylak | 73609bb | 2020-06-18 15:05:40 -0500 | [diff] [blame] | 161 | 'images.cpp', |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 162 | 'item_updater.cpp', |
| 163 | 'item_updater_main.cpp', |
| 164 | 'serialize.cpp', |
| 165 | 'version.cpp', |
Miguel Gomez | 21dad04 | 2020-06-26 20:54:48 +0000 | [diff] [blame] | 166 | 'utils.cpp', |
| 167 | 'msl_verify.cpp' |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 168 | ) |
| 169 | |
| 170 | if get_option('bmc-layout').contains('static') |
Adriana Kobylak | 436be81 | 2020-06-17 09:44:56 -0500 | [diff] [blame] | 171 | image_updater_sources += files( |
| 172 | 'static/flash.cpp', |
| 173 | 'static/item_updater_helper.cpp' |
| 174 | ) |
Adriana Kobylak | 86013f3 | 2020-05-13 12:12:38 -0500 | [diff] [blame] | 175 | elif get_option('bmc-layout').contains('ubi') |
Adriana Kobylak | 436be81 | 2020-06-17 09:44:56 -0500 | [diff] [blame] | 176 | image_updater_sources += files( |
| 177 | 'ubi/flash.cpp', |
| 178 | 'ubi/item_updater_helper.cpp' |
| 179 | ) |
| 180 | |
| 181 | unit_files += [ |
| 182 | 'ubi/obmc-flash-bmc-cleanup.service.in', |
| 183 | 'ubi/obmc-flash-bmc-mirroruboot.service.in', |
| 184 | 'ubi/obmc-flash-bmc-ubiremount.service.in', |
| 185 | 'ubi/obmc-flash-bmc-ubiro@.service.in', |
| 186 | 'ubi/obmc-flash-bmc-ubiro-remove@.service.in', |
| 187 | 'ubi/obmc-flash-bmc-ubirw.service.in', |
| 188 | 'ubi/obmc-flash-bmc-ubirw-remove.service.in', |
| 189 | 'ubi/obmc-flash-bmc-updateubootvars@.service.in' |
| 190 | ] |
Adriana Kobylak | 86013f3 | 2020-05-13 12:12:38 -0500 | [diff] [blame] | 191 | elif get_option('bmc-layout').contains('mmc') |
Adriana Kobylak | 436be81 | 2020-06-17 09:44:56 -0500 | [diff] [blame] | 192 | image_updater_sources += files( |
| 193 | 'mmc/flash.cpp', |
| 194 | 'mmc/item_updater_helper.cpp' |
| 195 | ) |
Adriana Kobylak | 70f5bc0 | 2020-05-13 14:08:14 -0500 | [diff] [blame] | 196 | |
| 197 | unit_files += [ |
| 198 | 'mmc/obmc-flash-mmc@.service.in', |
Adriana Kobylak | d7fbc1e | 2020-06-06 07:46:40 -0500 | [diff] [blame] | 199 | 'mmc/obmc-flash-mmc-mount.service.in', |
Adriana Kobylak | 70f5bc0 | 2020-05-13 14:08:14 -0500 | [diff] [blame] | 200 | 'mmc/obmc-flash-mmc-remove@.service.in', |
Adriana Kobylak | 3412435 | 2020-05-22 09:40:40 -0500 | [diff] [blame] | 201 | 'mmc/obmc-flash-mmc-setprimary@.service.in', |
Adriana Kobylak | d7fbc1e | 2020-06-06 07:46:40 -0500 | [diff] [blame] | 202 | 'mmc/obmc-flash-mmc-umount.service.in', |
Adriana Kobylak | 70f5bc0 | 2020-05-13 14:08:14 -0500 | [diff] [blame] | 203 | ] |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 204 | endif |
| 205 | |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 206 | if get_option('host-bios-upgrade').enabled() |
Adriana Kobylak | 436be81 | 2020-06-17 09:44:56 -0500 | [diff] [blame] | 207 | unit_files += 'obmc-flash-host-bios@.service.in' |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 208 | endif |
| 209 | |
Lei YU | 6376964 | 2021-12-10 16:15:04 +0800 | [diff] [blame] | 210 | if get_option('bmc-static-dual-image').enabled() |
Lei YU | 8474967 | 2021-12-15 14:31:10 +0800 | [diff] [blame] | 211 | unit_files += [ |
Lei YU | 554757b | 2022-03-21 11:05:50 +0800 | [diff] [blame] | 212 | 'static/obmc-flash-bmc-alt@.service.in', |
Lei YU | 8474967 | 2021-12-15 14:31:10 +0800 | [diff] [blame] | 213 | 'static/obmc-flash-bmc-static-mount-alt.service.in', |
| 214 | 'static/obmc-flash-bmc-prepare-for-sync.service.in', |
| 215 | ] |
Lei YU | 6376964 | 2021-12-10 16:15:04 +0800 | [diff] [blame] | 216 | endif |
| 217 | |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 218 | if get_option('sync-bmc-files').enabled() |
| 219 | executable( |
| 220 | 'phosphor-sync-software-manager', |
| 221 | 'sync_manager.cpp', |
| 222 | 'sync_manager_main.cpp', |
| 223 | 'sync_watch.cpp', |
| 224 | dependencies: deps, |
| 225 | install: true |
| 226 | ) |
Adriana Kobylak | 817209f | 2020-05-07 09:52:03 -0500 | [diff] [blame] | 227 | |
| 228 | install_data('synclist', |
| 229 | install_dir: get_option('sysconfdir') |
| 230 | ) |
Lei YU | 8474967 | 2021-12-15 14:31:10 +0800 | [diff] [blame] | 231 | |
| 232 | install_data('sync-once.sh', |
| 233 | install_mode: 'rwxr-xr-x', |
| 234 | install_dir: get_option('bindir') |
| 235 | ) |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 236 | endif |
| 237 | |
Adriana Kobylak | 42bd993 | 2021-01-28 09:45:24 -0600 | [diff] [blame] | 238 | if (get_option('verify-signature').enabled() or \ |
| 239 | get_option('verify-full-signature').enabled()) |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 240 | image_updater_sources += files( |
George Liu | 0a06e97 | 2020-12-17 09:17:04 +0800 | [diff] [blame] | 241 | 'utils.cpp', |
Adriana Kobylak | e0aa780 | 2020-05-05 13:54:49 -0500 | [diff] [blame] | 242 | 'image_verify.cpp', |
| 243 | 'openssl_alloc.cpp' |
| 244 | ) |
| 245 | endif |
| 246 | |
| 247 | executable( |
| 248 | 'phosphor-download-manager', |
| 249 | 'download_manager.cpp', |
| 250 | 'download_manager_main.cpp', |
| 251 | dependencies: deps, |
| 252 | install: true |
| 253 | ) |
| 254 | |
| 255 | executable( |
| 256 | 'phosphor-image-updater', |
| 257 | image_error_cpp, |
| 258 | image_error_hpp, |
| 259 | image_updater_sources, |
| 260 | dependencies: [deps, ssl], |
| 261 | install: true |
| 262 | ) |
| 263 | |
| 264 | executable( |
| 265 | 'phosphor-version-software-manager', |
| 266 | image_error_cpp, |
| 267 | image_error_hpp, |
| 268 | 'image_manager.cpp', |
| 269 | 'image_manager_main.cpp', |
| 270 | 'version.cpp', |
| 271 | 'watch.cpp', |
| 272 | dependencies: [deps, ssl], |
| 273 | install: true |
| 274 | ) |
Adriana Kobylak | 817209f | 2020-05-07 09:52:03 -0500 | [diff] [blame] | 275 | |
| 276 | install_data('obmc-flash-bmc', |
| 277 | install_mode: 'rwxr-xr-x', |
| 278 | install_dir: get_option('bindir') |
| 279 | ) |
| 280 | |
Lei YU | 531fbc2 | 2021-12-10 20:03:18 +0800 | [diff] [blame] | 281 | install_data('detect-slot-aspeed', |
| 282 | install_mode: 'rwxr-xr-x', |
| 283 | install_dir: get_option('bindir') |
| 284 | ) |
| 285 | |
Lei YU | 984cef5 | 2021-12-17 11:28:21 +0800 | [diff] [blame] | 286 | install_data('reset-cs0-aspeed', |
| 287 | install_mode: 'rwxr-xr-x', |
| 288 | install_dir: get_option('bindir') |
| 289 | ) |
| 290 | |
Adriana Kobylak | 817209f | 2020-05-07 09:52:03 -0500 | [diff] [blame] | 291 | install_data('software.conf', |
| 292 | install_dir: '/usr/lib/tmpfiles.d/' |
| 293 | ) |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 294 | |
| 295 | foreach u : unit_files |
| 296 | configure_file( |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 297 | input: u, |
Adriana Kobylak | 436be81 | 2020-06-17 09:44:56 -0500 | [diff] [blame] | 298 | output: '@BASENAME@', |
| 299 | configuration: conf, |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 300 | install: true, |
| 301 | install_dir: systemd_system_unit_dir, |
Adriana Kobylak | 29a0d90 | 2020-05-05 13:59:49 -0500 | [diff] [blame] | 302 | ) |
| 303 | endforeach |
Adriana Kobylak | 78e72d9 | 2020-05-05 14:01:54 -0500 | [diff] [blame] | 304 | |
| 305 | # If test coverage of source files within the root directory are wanted, |
| 306 | # need to define and build the tests from here |
| 307 | build_tests = get_option('tests') |
| 308 | if not build_tests.disabled() |
| 309 | oe_sdk = get_option('oe-sdk') |
| 310 | if oe_sdk.enabled() |
| 311 | # Setup OE SYSROOT |
| 312 | OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip() |
| 313 | if OECORE_TARGET_SYSROOT == '' |
| 314 | error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.') |
| 315 | endif |
| 316 | message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT) |
| 317 | rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib']) |
| 318 | ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip() |
| 319 | dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so] |
| 320 | else |
| 321 | dynamic_linker = [] |
| 322 | endif |
| 323 | |
| 324 | gtest = dependency('gtest', main: true, disabler: true, required: build_tests) |
| 325 | include_srcs = declare_dependency(sources: [ |
George Liu | 0a06e97 | 2020-12-17 09:17:04 +0800 | [diff] [blame] | 326 | 'utils.cpp', |
Adriana Kobylak | 78e72d9 | 2020-05-05 14:01:54 -0500 | [diff] [blame] | 327 | 'image_verify.cpp', |
Adriana Kobylak | 73609bb | 2020-06-18 15:05:40 -0500 | [diff] [blame] | 328 | 'images.cpp', |
Adriana Kobylak | 78e72d9 | 2020-05-05 14:01:54 -0500 | [diff] [blame] | 329 | 'version.cpp'] |
| 330 | ) |
| 331 | |
| 332 | test('utest', |
| 333 | executable( |
| 334 | 'utest', |
| 335 | './test/utest.cpp', |
| 336 | link_args: dynamic_linker, |
| 337 | build_rpath: get_option('oe-sdk').enabled() ? rpath : '', |
| 338 | dependencies: [deps, gtest, include_srcs, ssl] |
| 339 | ) |
| 340 | ) |
| 341 | endif |
George Liu | cc74233 | 2021-10-20 16:25:55 +0800 | [diff] [blame] | 342 | |
| 343 | if get_option('usb-code-update').enabled() |
| 344 | subdir('usb') |
| 345 | endif |