project( 'openpower-proc-control', 'cpp', default_options: [ 'warning_level=3', 'werror=true', 'cpp_std=c++17', 'buildtype=debugoptimized', 'b_ndebug=if-release', ], license: 'Apache-2.0', version: '1.0', ) add_project_arguments('-Wno-psabi', language: 'cpp') if get_option('cpp_std') != 'c++17' error('This project requires c++17') endif if(get_option('buildtype') == 'minsize') add_project_arguments('-DNDEBUG', language : 'cpp') endif cxx = meson.get_compiler('cpp') extra_sources = [] extra_dependencies = [] extra_unit_files = [] unit_subs = configuration_data() unit_subs.set('bindir', join_paths(get_option('prefix'), get_option('bindir'))) unit_subs.set('ENABLE_PHAL_TRUE', '#') if get_option('phal').enabled() and get_option('p9').enabled() error('phal and p9 cannot be selected at the same time') endif build_p9 = not get_option('p9').disabled() build_openfsi = not get_option('openfsi').disabled() build_phal = get_option('phal').enabled() if get_option('phal').enabled() and not get_option('p9').disabled() build_p9 = false endif summary('building p9', build_p9) summary('building openfsi', build_openfsi) summary('building phal', build_phal) if build_p9 extra_sources += [ 'procedures/p9/cleanup_pcie.cpp', 'procedures/p9/set_sync_fsi_clock_mode.cpp', 'procedures/p9/start_host.cpp', 'procedures/p9/start_host_mpreboot.cpp', ] endif if build_openfsi extra_sources += [ 'procedures/openfsi/scan.cpp', ] endif if build_phal extra_sources += [ 'procedures/phal/start_host.cpp', 'procedures/phal/set_SPI_mux.cpp', 'procedures/phal/proc_pre_poweroff.cpp', 'procedures/phal/common_utils.cpp', 'phalerror/create_pel.cpp', 'phalerror/phal_error.cpp', ] extra_dependencies += [ dependency('libdt-api'), cxx.find_library('ekb'), cxx.find_library('ipl'), ] extra_unit_files = [ 'set-spi-mux.service', 'phal-reinit-devtree.service', 'proc-pre-poweroff@.service', ] unit_subs.set('ENABLE_PHAL_TRUE', '') endif executable( 'openpower-proc-control', [ 'cfam_access.cpp', 'ext_interface.cpp', 'filedescriptor.cpp', 'proc_control.cpp', 'registration.cpp', 'targeting.cpp', 'procedures/common/cfam_overrides.cpp', 'procedures/common/cfam_reset.cpp', 'procedures/common/enter_mpreboot.cpp', 'procedures/common/collect_sbe_hb_data.cpp', 'util.cpp', ] + extra_sources, dependencies: [ dependency('libgpiodcxx'), cxx.find_library('pdbg'), dependency('phosphor-dbus-interfaces'), dependency('phosphor-logging'), dependency('sdbusplus'), dependency('threads'), dependency('fmt'), ] + extra_dependencies, install: true ) executable( 'openpower-proc-nmi', [ 'nmi_main.cpp', 'nmi_interface.cpp', ], dependencies: [ cxx.find_library('pdbg'), dependency('phosphor-dbus-interfaces'), dependency('phosphor-logging'), dependency('sdbusplus'), ], install: true ) unit_files = [ 'pcie-poweroff@.service', 'xyz.openbmc_project.Control.Host.NMI.service', 'op-stop-instructions@.service', 'op-cfam-reset.service', 'op-continue-mpreboot@.service', 'op-enter-mpreboot@.service', ] + extra_unit_files systemd_system_unit_dir = dependency('systemd').get_pkgconfig_variable( 'systemdsystemunitdir', define_variable: ['prefix', get_option('prefix')]) foreach u : unit_files configure_file( configuration: unit_subs, input: u + '.in', install: true, install_dir: systemd_system_unit_dir, output: u ) endforeach if not get_option('tests').disabled() test( 'utest', executable( 'utest', 'test/utest.cpp', 'targeting.cpp', 'filedescriptor.cpp', dependencies: [ dependency('gtest', main: true), dependency('phosphor-logging'), ], implicit_include_directories: false, include_directories: '.', ) ) endif