87 lines
3.3 KiB
Python
87 lines
3.3 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
|
|
|
|
import common.settings
|
|
from build_functions.build_utils import print_banner
|
|
from common.azure import write_package_version_batch
|
|
from common.cmake import cmake_build_install, assemble_prefix_path
|
|
from common.directory_helpers import pushd
|
|
from common.git_helpers import clone_git_tag
|
|
from package.package_info import get_package_info, PackageInfo
|
|
|
|
|
|
def build_ecal(prefix: Path | str, sbom: dict):
|
|
|
|
print_banner("Building eCAL")
|
|
|
|
package_info = get_package_info("ecal")
|
|
package_info.add_to_sbom(sbom)
|
|
|
|
asio_install_path = package_info.dependency_path("asio")
|
|
|
|
deps = [
|
|
package_info.dependency("abseil-cpp"),
|
|
package_info.dependency("asio"),
|
|
package_info.dependency("curl"),
|
|
package_info.dependency("ecaludp"),
|
|
package_info.dependency("fineftp"),
|
|
package_info.dependency("ftxui"),
|
|
package_info.dependency("hdf5"),
|
|
package_info.dependency("protobuf"),
|
|
package_info.dependency("qt5"),
|
|
package_info.dependency("qwt"),
|
|
package_info.dependency("recycle"),
|
|
package_info.dependency("spdlog"),
|
|
package_info.dependency("tclap"),
|
|
package_info.dependency("tcp_pubsub"),
|
|
package_info.dependency("termcolor"),
|
|
package_info.dependency("tinyxml2"),
|
|
package_info.dependency("yaml-cpp"),
|
|
package_info.dependency("zlib")
|
|
]
|
|
|
|
src_dir = clone_git_tag(package_info, recursive=False)
|
|
|
|
global cpp_standard
|
|
prev_cpp_standard = common.settings.cpp_standard
|
|
common.settings.cpp_standard = "17"
|
|
|
|
# We have a little problem here. They use a module called CMakeFunctions, which is not
|
|
# really a standalone dependency but checked in directly. This needs to be built before
|
|
# the actual build can start. Quite ugly, since this doesn't have a PackageInfo. I have to fake this
|
|
# To make things worse, this module also needs a patch. But so does the rest of ecal, so we apply it before
|
|
cmf_fake_info = PackageInfo.__new__(PackageInfo)
|
|
cmf_fake_info.name = "cmakefunctions"
|
|
cmf_fake_info.version = "0.0.1"
|
|
|
|
patchfile = Path(__file__).resolve().parent.parent / "patches" / "ecal" / "ecal_6.0.0_rc3_windows.patch"
|
|
with pushd(src_dir):
|
|
subprocess.run(["git", "apply", str(patchfile)])
|
|
|
|
cmake_functions_src_dir = src_dir / "thirdparty" / "cmakefunctions" / "cmake_functions"
|
|
cmake_functions_install_dir = cmake_build_install(cmake_functions_src_dir, cmf_fake_info, cmake_args=[])
|
|
|
|
cmake_args = [
|
|
("ECAL_BUILD_APPS:BOOL", "OFF"),
|
|
("ECAL_BUILD_DOCS:BOOL", "OFF"),
|
|
("ECAL_BUILD_SAMPLES:BOOL", "OFF"),
|
|
("ECAL_BUILD_TIMEPLUGINS:BOOL", "OFF"),
|
|
("ECAL_BUILD_CSHARP_BINDING:BOOL", "OFF"),
|
|
("ECAL_USE_NPCAP:BOOL", "OFF"),
|
|
("CMakeFunctions_DIR:PATH", str(cmake_functions_install_dir / "cmake")),
|
|
("asio_DIR:PATH", str(asio_install_path)),
|
|
("CMAKE_PREFIX_PATH:STRING", assemble_prefix_path(deps)),
|
|
]
|
|
|
|
install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
|
|
write_package_version_batch(package_info.version)
|
|
|
|
common.settings.cpp_standard = prev_cpp_standard
|
|
|
|
return install_dir
|