1project( 2 'openpower-proc-control', 3 'cpp', 4 default_options: [ 5 'warning_level=3', 6 'werror=true', 7 'cpp_std=c++17' 8 ], 9 license: 'Apache-2.0', 10 version: '1.0', 11) 12add_project_arguments('-Wno-psabi', language: 'cpp') 13 14cxx = meson.get_compiler('cpp') 15 16extra_sources = [] 17extra_dependencies = [] 18extra_unit_files = [] 19 20unit_subs = configuration_data() 21unit_subs.set('bindir', join_paths(get_option('prefix'), get_option('bindir'))) 22unit_subs.set('ENABLE_PHAL_TRUE', '#') 23 24if get_option('phal').enabled() and get_option('p9').enabled() 25 error('phal and p9 cannot be selected at the same time') 26endif 27 28build_p9 = not get_option('p9').disabled() 29build_openfsi = not get_option('openfsi').disabled() 30build_phal = get_option('phal').enabled() 31 32if get_option('phal').enabled() and not get_option('p9').disabled() 33 build_p9 = false 34endif 35 36summary('building p9', build_p9) 37summary('building openfsi', build_openfsi) 38summary('building phal', build_phal) 39 40if build_p9 41 extra_sources += [ 42 'procedures/p9/cleanup_pcie.cpp', 43 'procedures/p9/set_sync_fsi_clock_mode.cpp', 44 'procedures/p9/start_host.cpp', 45 'procedures/p9/start_host_mpreboot.cpp', 46 ] 47endif 48if build_openfsi 49 extra_sources += [ 50 'procedures/openfsi/scan.cpp', 51 ] 52endif 53if build_phal 54 extra_sources += [ 55 'procedures/phal/start_host.cpp', 56 'procedures/phal/set_SPI_mux.cpp', 57 'phalerror/create_pel.cpp', 58 'phalerror/phal_error.cpp', 59 ] 60 extra_dependencies += [ 61 dependency('libdt-api'), 62 dependency('fmt'), 63 cxx.find_library('ekb'), 64 cxx.find_library('ipl'), 65 ] 66 extra_unit_files = [ 67 'set-spi-mux.service', 68 'phal-reinit-devtree.service', 69 ] 70 unit_subs.set('ENABLE_PHAL_TRUE', '') 71endif 72 73executable( 74 'openpower-proc-control', 75 [ 76 'cfam_access.cpp', 77 'ext_interface.cpp', 78 'filedescriptor.cpp', 79 'proc_control.cpp', 80 'registration.cpp', 81 'targeting.cpp', 82 'procedures/common/cfam_overrides.cpp', 83 'procedures/common/cfam_reset.cpp', 84 'procedures/common/enter_mpreboot.cpp', 85 'procedures/common/collect_sbe_hb_data.cpp', 86 ] + extra_sources, 87 dependencies: [ 88 dependency('libgpiodcxx'), 89 cxx.find_library('pdbg'), 90 dependency('phosphor-dbus-interfaces'), 91 dependency('phosphor-logging'), 92 dependency('sdbusplus'), 93 dependency('threads'), 94 ] + extra_dependencies, 95 install: true 96) 97 98executable( 99 'openpower-proc-nmi', 100 [ 101 'nmi_main.cpp', 102 'nmi_interface.cpp', 103 ], 104 dependencies: [ 105 cxx.find_library('pdbg'), 106 dependency('phosphor-dbus-interfaces'), 107 dependency('phosphor-logging'), 108 dependency('sdbusplus'), 109 ], 110 install: true 111) 112 113unit_files = [ 114 'pcie-poweroff@.service', 115 'xyz.openbmc_project.Control.Host.NMI.service', 116 'op-stop-instructions@.service', 117 'op-cfam-reset.service', 118 'op-continue-mpreboot@.service', 119 'op-enter-mpreboot@.service', 120] + extra_unit_files 121 122systemd_system_unit_dir = dependency('systemd').get_pkgconfig_variable( 123 'systemdsystemunitdir', 124 define_variable: ['prefix', get_option('prefix')]) 125foreach u : unit_files 126 configure_file( 127 configuration: unit_subs, 128 input: u + '.in', 129 install: true, 130 install_dir: systemd_system_unit_dir, 131 output: u 132 ) 133endforeach 134 135if not get_option('tests').disabled() 136 test( 137 'utest', 138 executable( 139 'utest', 140 'test/utest.cpp', 141 'targeting.cpp', 142 'filedescriptor.cpp', 143 dependencies: [ 144 dependency('gtest', main: true), 145 dependency('phosphor-logging'), 146 ], 147 implicit_include_directories: false, 148 include_directories: '.', 149 ) 150 ) 151endif 152