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 = dependency('openssl') 61 62systemd = dependency('systemd') 63systemd_system_unit_dir = systemd.get_variable('systemd_system_unit_dir') 64 65build_tests = get_option('tests') 66 67subdir('bmc') 68 69common_include = include_directories('.') 70 71common_build = build_tests.allowed() or get_option('bios-software-update').allowed() or get_option( 72 'cpld-software-update', 73).allowed() or get_option( 74 'eepromdevice-software-update', 75).allowed() or get_option( 76 'i2cvr-software-update', 77).allowed() 78 79if common_build 80 libpldm_dep = dependency('libpldm') 81 subdir('common') 82endif 83 84gpiod_needed = get_option('bios-software-update').allowed() or get_option( 85 'eepromdevice-software-update', 86).allowed() 87 88if gpiod_needed 89 libgpiod_dep = dependency( 90 'libgpiodcxx', 91 default_options: ['bindings=cxx'], 92 version: '>=1.1.2', 93 ) 94endif 95 96if get_option('bios-software-update').allowed() 97 subdir('bios') 98endif 99 100if get_option('i2cvr-software-update').allowed() or get_option( 101 'cpld-software-update', 102).allowed() 103 subdir('common/i2c/') 104endif 105 106if get_option('i2cvr-software-update').allowed() 107 subdir('i2c-vr') 108endif 109 110if get_option('eepromdevice-software-update').allowed() 111 subdir('eeprom-device') 112endif 113 114if get_option('cpld-software-update').allowed() 115 subdir('cpld') 116endif 117 118if build_tests.allowed() 119 subdir('test') 120endif 121