project(
    'openpower-occ-control', 'cpp',
    version : '1.0.0',
    meson_version: '>=1.1.1',
    default_options: [
        'warning_level=3',
        'werror=true',
        'cpp_std=c++23',
        'buildtype=debugoptimized'
    ]
)

cxx = meson.get_compiler('cpp')

conf_data = configuration_data()
conf_data.set_quoted('OCC_CONTROL_BUSNAME', 'org.open_power.OCC.Control')
conf_data.set_quoted('OCC_CONTROL_ROOT', '/org/open_power/control')
conf_data.set_quoted('OCC_SENSORS_ROOT', '/xyz/openbmc_project/sensors')
conf_data.set_quoted('CPU_NAME', 'cpu')
conf_data.set_quoted('OCC_NAME', 'occ')
conf_data.set_quoted('OCC_MASTER_NAME', 'occ-hwmon.1')
conf_data.set_quoted('OCC_DEV_PATH', '/dev/occ')
conf_data.set_quoted('CPU_SUBPATH', '/xyz/openbmc_project/inventory/system/chassis/motherboard')
conf_data.set_quoted('OCC_CONTROL_PERSIST_PATH', '/var/lib/openpower-occ-control')
conf_data.set_quoted('OP_DUMP_OBJ_PATH', get_option('op_dump_obj_path'))

conf_data.set('MAX_CPUS', get_option('max-cpus'))
conf_data.set('OCC_CPU_TEMP_SENSOR_TYPE', 0xC0)
conf_data.set('OCC_DIMM_TEMP_SENSOR_TYPE', 0xD0)
conf_data.set('PS_DERATING_FACTOR', get_option('ps-derating-factor'))

if get_option('i2c-occ').allowed()
    conf_data.set_quoted('OCC_HWMON_PATH', '/sys/bus/i2c/drivers/occ-hwmon/')
    conf_data.set_quoted('DEV_PATH', '/sys/bus/i2c/devices')
    conf_data.set_quoted('I2C_OCC_DEVICE_NAME', 'p8-occ-hwmon')
else
    conf_data.set_quoted('OCC_HWMON_PATH', '/sys/bus/platform/drivers/occ-hwmon/')
    conf_data.set_quoted('DEV_PATH', '/sys/bus/platform/devices/')
endif

conf_data.set('I2C_OCC', get_option('i2c-occ').allowed())
conf_data.set('READ_OCC_SENSORS', get_option('read-occ-sensors').allowed())
conf_data.set('PLDM', get_option('with-host-communication-protocol')=='pldm')
conf_data.set('POWER10', get_option('power10-support').allowed())

if get_option('transport-implementation') == 'mctp-demux'
    conf_data.set('PLDM_TRANSPORT_WITH_MCTP_DEMUX', 1)
elif get_option('transport-implementation') == 'af-mctp'
    conf_data.set('PLDM_TRANSPORT_WITH_AF_MCTP', 1)
endif

if cxx.has_header('poll.h')
    conf_data.set('PLDM_HAS_POLL', 1)
endif

configure_file(output: 'config.h',
    configuration: conf_data
)

install_data('occ-active.sh',
    install_mode: 'rwxr-xr-x',
    install_dir: get_option('bindir')
)

systemd = dependency('systemd')
systemd_system_unit_dir = systemd.get_variable(
    'systemdsystemunitdir')
subdir('service_files')

sdbusplus_dep = dependency('sdbusplus')

python_prog = find_program('python3', required: true)

deps = []
sources = []

cereal_dep = dependency('cereal', required: false)
has_cereal = cxx.has_header_symbol(
    'cereal/cereal.hpp',
    'cereal::specialize',
    dependencies: cereal_dep,
    required: false)
if not has_cereal
    cereal_opts = import('cmake').subproject_options()
    cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
    cereal_proj = import('cmake').subproject(
        'cereal',
        options: cereal_opts,
        required: false)
    assert(cereal_proj.found(), 'cereal is required')
    cereal_dep = cereal_proj.dependency('cereal')
endif

nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
phosphor_logging_dep = dependency('phosphor-logging')
sdeventplus_dep = dependency('sdeventplus')

deps += [
    cereal_dep,
    nlohmann_json_dep,
    phosphor_dbus_interfaces_dep,
    phosphor_logging_dep,
    sdbusplus_dep,
    sdeventplus_dep,
]

sources += [
    'app.cpp',
    'occ_pass_through.cpp',
    'occ_manager.cpp',
    'occ_status.cpp',
    'occ_device.cpp',
    'occ_errors.cpp',
    'occ_ffdc.cpp',
    'occ_presence.cpp',
    'occ_command.cpp',
    'occ_dbus.cpp',
    'powercap.cpp',
    'i2c_occ.cpp',
    'utils.cpp',
]

if get_option('with-host-communication-protocol')=='pldm'
    libpldm_dep = dependency('libpldm')
    deps += [
        libpldm_dep,
        cxx.find_library('pdbg'),
        cxx.find_library('phal'),
    ]
    sources += [
        'pldm.cpp',
    ]
endif

if get_option('power10-support').allowed()
    sources += [
        'powermode.cpp',
    ]
endif

yamldir = get_option('yamldir')
if yamldir == ''
    yamldir = meson.project_source_root() / 'example'
endif

# Generate occ-sensor.hpp.
occ_sensor_hpp = custom_target(
    'occ-sensor.hpp',
    command : [
        python_prog,
        meson.project_source_root() + '/sensor_gen.py',
        '-i', yamldir,
    ],
    output : 'occ-sensor.hpp')
    sources += [occ_sensor_hpp]

    executable(
        'openpower-occ-control',
        sources,
        include_directories: '.',
        implicit_include_directories: true,
        dependencies: deps,
        install: true,
        install_dir: get_option('bindir')
    )

if not get_option('tests').disabled()
  subdir('test')
endif
