blob: f581fcee877ffc5610e5d134c2c4eebc26b9c102 [file]
load("@rules_cc//cc:cc_library.bzl", "cc_library")
package(default_visibility = ["//visibility:public"])
filegroup(
name = "all_srcs",
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
# Codegen for phosphor-dbus-interfaces using sdbus++
genrule(
name = "gen_phosphor_dbus_interfaces",
srcs = [
"yaml/xyz/openbmc_project/Software/Activation.interface.yaml",
":all_srcs",
"@sdbusplus//:sdbusplus_executable",
"@sdbusplus//:sdbusplus_tools",
],
outs = [
"xyz/openbmc_project/Software/Activation/server.hpp",
"xyz/openbmc_project/Software/Activation/server.cpp",
"xyz/openbmc_project/Software/Activation/common.hpp",
"xyz/openbmc_project/Software/ActivationProgress/server.hpp",
"xyz/openbmc_project/Software/ActivationProgress/server.cpp",
"xyz/openbmc_project/Software/ActivationProgress/common.hpp",
"xyz/openbmc_project/Software/Version/server.hpp",
"xyz/openbmc_project/Software/Version/server.cpp",
"xyz/openbmc_project/Software/Version/common.hpp",
"xyz/openbmc_project/Association/Definitions/server.hpp",
"xyz/openbmc_project/Association/Definitions/server.cpp",
"xyz/openbmc_project/Association/Definitions/common.hpp",
"xyz/openbmc_project/Inventory/Decorator/Asset/server.hpp",
"xyz/openbmc_project/Inventory/Decorator/Asset/server.cpp",
"xyz/openbmc_project/Inventory/Decorator/Asset/common.hpp",
"xyz/openbmc_project/Object/Enable/server.hpp",
"xyz/openbmc_project/Object/Enable/server.cpp",
"xyz/openbmc_project/Object/Enable/common.hpp",
"xyz/openbmc_project/Common/error.hpp",
"xyz/openbmc_project/Common/error.cpp",
"xyz/openbmc_project/Software/Image/error.hpp",
"xyz/openbmc_project/Software/Image/error.cpp",
],
cmd = """
SDBUS_DIR=$$(dirname $(location @sdbusplus//:sdbusplus_executable))
OUT_DIR=$(RULEDIR)
YAML_DIR=$$(dirname $$(dirname $$(dirname $$(dirname $(location yaml/xyz/openbmc_project/Software/Activation.interface.yaml)))))
for iface in "xyz.openbmc_project.Software.Activation" \
"xyz.openbmc_project.Software.ActivationProgress" \
"xyz.openbmc_project.Software.Version" \
"xyz.openbmc_project.Association.Definitions" \
"xyz.openbmc_project.Inventory.Decorator.Asset" \
"xyz.openbmc_project.Object.Enable"; do
dir_path=$$(echo $$iface | tr '.' '/')
mkdir -p $$OUT_DIR/$$dir_path
PYTHONPATH=$$SDBUS_DIR python3 $$SDBUS_DIR/sdbus++ -r $$YAML_DIR interface server-header $$iface > $$OUT_DIR/$$dir_path/server.hpp
PYTHONPATH=$$SDBUS_DIR python3 $$SDBUS_DIR/sdbus++ -r $$YAML_DIR interface server-cpp $$iface > $$OUT_DIR/$$dir_path/server.cpp
PYTHONPATH=$$SDBUS_DIR python3 $$SDBUS_DIR/sdbus++ -r $$YAML_DIR interface common-header $$iface > $$OUT_DIR/$$dir_path/common.hpp
done
for err in "xyz.openbmc_project.Common" \
"xyz.openbmc_project.Software.Image"; do
dir_path=$$(echo $$err | tr '.' '/')
mkdir -p $$OUT_DIR/$$dir_path
PYTHONPATH=$$SDBUS_DIR python3 $$SDBUS_DIR/sdbus++ -r $$YAML_DIR error exception-header $$err > $$OUT_DIR/$$dir_path/error.hpp
PYTHONPATH=$$SDBUS_DIR python3 $$SDBUS_DIR/sdbus++ -r $$YAML_DIR error exception-cpp $$err > $$OUT_DIR/$$dir_path/error.cpp
done
""",
)
cc_library(
name = "phosphor_dbus_interfaces",
srcs = [
"xyz/openbmc_project/Software/Activation/server.cpp",
"xyz/openbmc_project/Software/ActivationProgress/server.cpp",
"xyz/openbmc_project/Software/Version/server.cpp",
"xyz/openbmc_project/Association/Definitions/server.cpp",
"xyz/openbmc_project/Inventory/Decorator/Asset/server.cpp",
"xyz/openbmc_project/Object/Enable/server.cpp",
"xyz/openbmc_project/Common/error.cpp",
"xyz/openbmc_project/Software/Image/error.cpp",
],
hdrs = [
"xyz/openbmc_project/Software/Activation/server.hpp",
"xyz/openbmc_project/Software/Activation/common.hpp",
"xyz/openbmc_project/Software/ActivationProgress/server.hpp",
"xyz/openbmc_project/Software/ActivationProgress/common.hpp",
"xyz/openbmc_project/Software/Version/server.hpp",
"xyz/openbmc_project/Software/Version/common.hpp",
"xyz/openbmc_project/Association/Definitions/server.hpp",
"xyz/openbmc_project/Association/Definitions/common.hpp",
"xyz/openbmc_project/Inventory/Decorator/Asset/server.hpp",
"xyz/openbmc_project/Inventory/Decorator/Asset/common.hpp",
"xyz/openbmc_project/Object/Enable/server.hpp",
"xyz/openbmc_project/Object/Enable/common.hpp",
"xyz/openbmc_project/Common/error.hpp",
"xyz/openbmc_project/Software/Image/error.hpp",
],
copts = ["-std=c++23"],
includes = ["."],
deps = [
"@sdbusplus//:sdbusplus",
"@systemd//:libsystemd",
],
visibility = ["//visibility:public"],
)