182e9557eSTom Josephproject(
282e9557eSTom Joseph    'phosphor-srvcfg-manager',
382e9557eSTom Joseph    'cpp',
482e9557eSTom Joseph    default_options: [
582e9557eSTom Joseph        'warning_level=3',
682e9557eSTom Joseph        'werror=true',
770c78fe4SPatrick Williams        'cpp_std=c++23'
882e9557eSTom Joseph    ],
982e9557eSTom Joseph    license: 'Apache-2.0',
1082e9557eSTom Joseph    version: '1.0',
1170c78fe4SPatrick Williams    meson_version: '>=1.1.1',
1282e9557eSTom Joseph)
1382e9557eSTom Joseph
1482e9557eSTom Joseph# Wno-psabi reduces the number of "Note:" messages when cross-compiling some STL
1582e9557eSTom Joseph# stuff for ARM. See https://stackoverflow.com/questions/48149323/strange-gcc-warning-when-compiling-qt-project
1682e9557eSTom Joseph# Basically, gcc 6 and gcc 7 are not ABI compatible, but since the whole OpenBMC
1782e9557eSTom Joseph# project uses the same compiler, we can safely ignmore these info notes.
1882e9557eSTom Josephadd_project_arguments('-Wno-psabi', language: 'cpp')
1982e9557eSTom Joseph
2082e9557eSTom Josephboost_args = ['-DBOOST_ALL_NO_LIB',
2182e9557eSTom Joseph              '-DBOOST_ASIO_DISABLE_THREADS',
2282e9557eSTom Joseph              '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
2382e9557eSTom Joseph              '-DBOOST_ERROR_CODE_HEADER_ONLY',
2482e9557eSTom Joseph              '-DBOOST_NO_RTTI',
2582e9557eSTom Joseph              '-DBOOST_NO_TYPEID',
2682e9557eSTom Joseph              '-DBOOST_SYSTEM_NO_DEPRECATED']
2782e9557eSTom Joseph
2882e9557eSTom Josephdeps = [dependency('boost'),
2982e9557eSTom Joseph        dependency('boost', modules : ['coroutine']),
30eca056edSPatrick Williams        dependency('phosphor-dbus-interfaces'),
31eca056edSPatrick Williams        dependency('phosphor-logging'),
32eca056edSPatrick Williams        dependency('sdbusplus'),
3382e9557eSTom Joseph        dependency('systemd'),
3482e9557eSTom Joseph]
3582e9557eSTom Joseph
36*ee190f03SPatrick Williamsif(get_option('usb-code-update').allowed())
3725a0f634SChicago Duan    add_project_arguments('-DUSB_CODE_UPDATE', language : 'cpp')
3825a0f634SChicago Duanendif
3925a0f634SChicago Duan
4082e9557eSTom Josephexecutable('phosphor-srvcfg-manager',
4182e9557eSTom Joseph           'src/main.cpp',
4282e9557eSTom Joseph           'src/srvcfg_manager.cpp',
4382e9557eSTom Joseph           'src/utils.cpp',
4482e9557eSTom Joseph        implicit_include_directories: false,
4582e9557eSTom Joseph        include_directories: ['inc'],
4682e9557eSTom Joseph        dependencies: deps,
4782e9557eSTom Joseph        cpp_args : boost_args,
4882e9557eSTom Joseph        install: true,
4982e9557eSTom Joseph        install_dir: get_option('bindir'))
5082e9557eSTom Joseph
5182e9557eSTom Josephsystemd = dependency('systemd')
529cd87072SPatrik Tesariksystemd_system_unit_dir = systemd.get_variable(
53070dd971SPatrick Williams    'systemdsystemunitdir',
549cd87072SPatrik Tesarik    pkgconfig_define: ['prefix', get_option('prefix')])
5582e9557eSTom Joseph
56c241bdeeSGeorge Liufs = import('fs')
57c241bdeeSGeorge Liufs.copyfile(
58c241bdeeSGeorge Liu    'srvcfg-manager.service',
5982e9557eSTom Joseph    install: true,
60c241bdeeSGeorge Liu    install_dir: systemd_system_unit_dir
6182e9557eSTom Joseph)
62