# (c) 2025 by Stephan Menzel # Licensed under the Apache License, Version 2.0. # See attached file LICENSE for full details import shutil from pathlib import Path from build_functions.build_utils import print_banner from common.azure import write_package_version_batch from common.git_helpers import clone_git_tag from common.headers_only import headers_install from package.package_info import get_package_info def build_asio(prefix: Path | str, sbom: dict): print_banner("Building Asio") package_info = get_package_info("asio") package_info.add_to_sbom(sbom) # Asio has no build steps. It also has no CMake support. # It assumes to be included header only. How we will go about the missing # CMake finder remains to be seen asio_dir = clone_git_tag(package_info, recursive=True) install_dir = headers_install(asio_dir, package_info, subdir=Path("asio") / "include") write_package_version_batch(package_info.version) # Asio doesn't come with CMake support. Depending modules such as fineftp seemed to # entirely ignore this unless you use the bundled version. To make this happen anyway, # we copy a little cmake module finder to where we just installed it. # This should enable depending modules to set asio_DIR to that install dir shutil.copy(Path(__file__).parent.parent / "patches" / "asio" / "asioConfig.cmake", install_dir) return install_dir