1project( 2 'phosphor-bmc-code-mgmt', 3 'cpp', 4 default_options: [ 5 'buildtype=debugoptimized', 6 'cpp_std=c++23', 7 'warning_level=3', 8 'werror=true', 9 ], 10 meson_version: '>=1.1.1', 11 license: 'Apache-2.0', 12 version: '1.0', 13) 14 15add_project_arguments( 16 '-DBOOST_SYSTEM_NO_DEPRECATED', 17 '-DBOOST_ERROR_CODE_HEADER_ONLY', 18 '-DBOOST_NO_RTTI', 19 '-DBOOST_NO_TYPEID', 20 '-DBOOST_ALL_NO_LIB', 21 '-DBOOST_ASIO_DISABLE_THREADS', 22 '-DBOOST_ASIO_NO_DEPRECATED', 23 language: 'cpp', 24) 25 26cpp = meson.get_compiler('cpp') 27 28boost_dep = dependency('boost') 29 30sdbusplus_dep = dependency('sdbusplus') 31sdbusplusplus_prog = find_program('sdbus++', native: true) 32sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true) 33 34pdi_dep = dependency('phosphor-dbus-interfaces') 35phosphor_logging_dep = dependency('phosphor-logging') 36 37cereal_dep = dependency('cereal', required: false) 38has_cereal = cpp.has_header_symbol( 39 'cereal/cereal.hpp', 40 'cereal::specialize', 41 dependencies: cereal_dep, 42 required: false, 43) 44if not has_cereal 45 cereal_opts = import('cmake').subproject_options() 46 cereal_opts.add_cmake_defines( 47 {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'}, 48 ) 49 cereal_proj = import('cmake').subproject( 50 'cereal', 51 options: cereal_opts, 52 required: false, 53 ) 54 assert(cereal_proj.found(), 'cereal is required') 55 cereal_dep = cereal_proj.dependency('cereal') 56endif 57 58deps = [cereal_dep, pdi_dep, phosphor_logging_dep, sdbusplus_dep] 59 60ssl_dep = dependency('openssl') 61 62systemd_dep = dependency('systemd') 63systemd_system_unit_dir = systemd_dep.get_variable( 64 'systemd_system_unit_dir', 65 pkgconfig_define: ['prefix', get_option('prefix')], 66) 67 68build_tests = get_option('tests') 69 70common_include = include_directories('.') 71 72subdir('bmc') 73 74 75all_options = { 76 'bios-software-update': {'dirs' : ['bios'], 'deps': ['libgpiod']}, 77 'cpld-software-update': {'dirs' : ['common/i2c', 'cpld']}, 78 'eepromdevice-software-update': { 79 'dirs': ['eeprom-device'], 80 'deps': ['libgpiod'], 81 }, 82 'i2cvr-software-update': {'dirs' : ['common/i2c', 'i2c-vr']}, 83} 84 85optioned_subdirs = [] 86optioned_deps = [] 87common_build = false 88 89foreach option_name, option_settings : all_options 90 if get_option(option_name).allowed() 91 common_build = true 92 93 foreach dir : option_settings.get('dirs', []) 94 if not optioned_subdirs.contains(dir) 95 optioned_subdirs += dir 96 endif 97 endforeach 98 99 foreach dep : option_settings.get('deps', []) 100 if not optioned_deps.contains(dep) 101 optioned_deps += dep 102 endif 103 endforeach 104 endif 105endforeach 106 107if common_build or build_tests.allowed() 108 libpldm_dep = dependency('libpldm') 109 subdir('common') 110endif 111 112if optioned_deps.contains('libgpiod') 113 libgpiod_dep = dependency( 114 'libgpiodcxx', 115 default_options: ['bindings=cxx'], 116 version: '>=1.1.2', 117 ) 118endif 119 120foreach dir : optioned_subdirs 121 subdir(dir) 122endforeach 123 124if build_tests.allowed() 125 subdir('test') 126endif 127