49 lines
1.8 KiB
Python
49 lines
1.8 KiB
Python
# (c) 2025 by Stephan Menzel
|
|
# Licensed under the Apache License, Version 2.0.
|
|
# See attached file LICENSE for full details
|
|
import subprocess
|
|
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.directory_helpers import pushd
|
|
from common.git_helpers import clone_git_tag
|
|
from common.settings import temporarily_set_shared, build_dir
|
|
from package.package_info import get_package_info
|
|
|
|
def build_ecaludp(prefix: Path | str, sbom: dict):
|
|
|
|
print_banner("Building ecaludp")
|
|
|
|
package_info = get_package_info("ecaludp")
|
|
package_info.add_to_sbom(sbom)
|
|
|
|
asio_install_path = package_info.dependency_path("asio")
|
|
recycle_install_path = package_info.dependency_path("recycle")
|
|
|
|
cmake_args = [
|
|
("ECALUDP_ENABLE_NPCAP:BOOL", "OFF"),
|
|
("ECALUDP_BUILD_SAMPLES:BOOL", "OFF"),
|
|
("ECALUDP_BUILD_TESTS:BOOL", "OFF"),
|
|
("ECALUDP_USE_BUILTIN_ASIO:BOOL", "OFF"),
|
|
("ECALUDP_USE_BUILTIN_RECYCLE:BOOL", "OFF"),
|
|
("ECALUDP_USE_BUILTIN_GTEST:BOOL", "OFF"),
|
|
|
|
("asio_DIR:PATH", str(asio_install_path)),
|
|
("recycle_DIR:PATH", str(recycle_install_path))
|
|
]
|
|
src_dir = clone_git_tag(package_info, recursive=False)
|
|
|
|
# I didn't manage to build it using the present asio because of what I think is a bug
|
|
# in their CMake structure. They treat asio as an imported target (with binaries?), yet it is header only.
|
|
# I try to patch that out.
|
|
patchfile = Path(__file__).resolve().parent.parent / "patches" / "ecal" / "ecal_asio_cmake_fix.patch"
|
|
|
|
with pushd(src_dir):
|
|
subprocess.run(["git", "apply", str(patchfile)])
|
|
|
|
install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
|
|
write_package_version_batch(package_info.version)
|
|
return install_dir
|