DepperDan/build_functions/build_tcp_pubsub.py

39 lines
1.5 KiB
Python

# (c) 2025 by Stephan Menzel
# Licensed under the Apache License, Version 2.0.
# See attached file LICENSE for full details
from pathlib import Path
from build_functions.build_utils import print_banner
from common.azure import write_package_version_batch
from common.cmake import cmake_build_install
from common.git_helpers import clone_git_tag
from package.package_info import get_package_info
def build_tcp_pubsub(prefix: Path | str, sbom: dict):
print_banner("Building tcp_pubsub")
package_info = get_package_info("tcp_pubsub")
package_info.add_to_sbom(sbom)
asio_install_path = package_info.dependency_path("asio")
recycle_install_path = package_info.dependency_path("recycle")
cmake_args = [
("BUILD_TESTING:BOOL", "OFF"),
("asio_DIR:PATH", str(asio_install_path)),
("asio_INCLUDE_DIR:PATH", str(asio_install_path / "include")),
# Try to use recycle from here but it's fetched as submodule and these are disregarded.
("recycle_DIR:PATH", str(recycle_install_path)),
("recycle_INCLUDE_DIR:PATH", str(recycle_install_path / "include")),
]
# This fetches recycle as submodule but doesn't allow recycle to be used from install
# As recycle is header only I guess that may be okayish
src_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
write_package_version_batch(package_info.version)
return install_dir