Finally got eCAL to build, including all dependencies.

This commit is contained in:
Stephan Menzel
2025-06-25 17:49:34 +02:00
parent 62747bab18
commit ab11f36e72
22 changed files with 605 additions and 59 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ from package.package_info import get_package_info
def build_abseil(prefix: Path | str, sbom: dict):
print_banner("Building Abseil (Protobuf Dependency)")
print_banner("Building Abseil")
package_info = get_package_info("abseil-cpp")
package_info.add_to_sbom(sbom)
+86
View File
@@ -0,0 +1,86 @@
# (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
+48
View File
@@ -0,0 +1,48 @@
# (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
+2 -2
View File
@@ -24,7 +24,7 @@ def build_eigen(prefix: Path | str, sbom: dict):
# but I can't switch to master for a medical device.
global cpp_standard
prev_cpp_standard = common.settings.cpp_standard
cpp_standard = "11"
common.settings.cpp_standard = "11"
package_info.add_to_sbom(sbom)
@@ -35,6 +35,6 @@ def build_eigen(prefix: Path | str, sbom: dict):
install_dir = cmake_build_install(eigen_dir, package_info, cmake_args=eigen_cmake_args)
write_package_version_batch(package_info.version)
cpp_standard = prev_cpp_standard
common.settings.cpp_standard = prev_cpp_standard
return install_dir
+31
View File
@@ -0,0 +1,31 @@
# (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 common.settings import temporarily_set_shared
from package.package_info import get_package_info
def build_ftxui(prefix: Path | str, sbom: dict):
print_banner("Building ftxui")
package_info = get_package_info("ftxui")
package_info.add_to_sbom(sbom)
cmake_args = [
("FTXUI_BUILD_DOCS:BOOL", "OFF"),
("FTXUI_BUILD_EXAMPLES:BOOL", "OFF"),
("FTXUI_BUILD_MODULES:BOOL", "OFF"),
("FTXUI_BUILD_TESTS:BOOL", "OFF"),
("FTXUI_BUILD_TESTS_FUZZER:BOOL", "OFF")
]
src_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+33
View File
@@ -0,0 +1,33 @@
# (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 common.settings import temporarily_set_shared
from package.package_info import get_package_info
def build_pcapplusplus(prefix: Path | str, sbom: dict):
print_banner("Building PCapPlusPlus")
package_info = get_package_info("pcapplusplus")
package_info.add_to_sbom(sbom)
cmake_args = [
("UDPCAP_BUILD_SAMPLES:BOOL", "OFF"),
("UDPCAP_BUILD_TESTS:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_ENABLED:BOOL", "ON"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_NPCAP:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_PCAPPLUSPLUS:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_ASIO:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_GTEST:BOOL", "OFF"),
]
src_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+33
View File
@@ -0,0 +1,33 @@
# (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 common.settings import temporarily_set_shared
from package.package_info import get_package_info
def build_pcapplusplus(prefix: Path | str, sbom: dict):
print_banner("Building PCapPlusPlus")
package_info = get_package_info("pcapplusplus")
package_info.add_to_sbom(sbom)
cmake_args = [
("UDPCAP_BUILD_SAMPLES:BOOL", "OFF"),
("UDPCAP_BUILD_TESTS:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_ENABLED:BOOL", "ON"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_NPCAP:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_PCAPPLUSPLUS:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_ASIO:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_GTEST:BOOL", "OFF"),
]
src_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+8 -9
View File
@@ -6,7 +6,7 @@ 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.cmake import cmake_build_install, assemble_prefix_path
from common.git_helpers import clone_git_tag
import common.settings
from package.package_info import get_package_info
@@ -18,24 +18,23 @@ def build_protobuf(prefix: Path | str, sbom: dict):
package_info = get_package_info("protobuf")
package_info.add_to_sbom(sbom)
abseil_install_path = package_info.dependency_path("abseil-cpp")
zlib_install_path = package_info.dependency_path("zlib")
deps = [
package_info.dependency("abseil-cpp"),
package_info.dependency("zlib")
]
protobuf_cmake_args = [
("BUILD_SHARED_LIBS:BOOL", "OFF"),
("BUILD_TESTING:BOOL", "OFF"),
("protobuf_BUILD_TESTS:BOOL", "OFF"),
("protobuf_WITH_ZLIB:BOOL", "ON"),
("ABSL_PROPAGATE_CXX_STD:BOOL", "ON"),
# ("ABSL_PROPAGATE_CXX_STD:BOOL", "ON"),
("protobuf_MSVC_STATIC_RUNTIME:BOOL", "OFF"),
("protobuf_ABSL_PROVIDER:STRING", "package"),
("absl_DIR:PATH", str(abseil_install_path / "lib" / "cmake" / "absl")),
("protobuf_INSTALL:BOOL", "ON"),
("protobuf_ZLIB_PROVIDER:STRING", "package"),
("ZLIB_ROOT:PATH", str(zlib_install_path)),
("CMAKE_PREFIX_PATH:STRING", assemble_prefix_path(deps)),
("protobuf_INSTALL:BOOL", "ON"),
("ZLIB_USE_STATIC_LIBS:BOOL", "ON"), # doesn't appear to do its job
("ZLIB_LIBRARY_RELEASE:FILEPATH", str(zlib_install_path / "lib" / common.settings.zlib_static_lib_name)),
("ZLIB_LIBRARY_DEBUG:FILEPATH", str(zlib_install_path / "lib" / common.settings.zlib_static_lib_name))
# We are on fake debug
]
protobuf_dir = clone_git_tag(package_info, recursive=False)
+7 -1
View File
@@ -1,7 +1,7 @@
# (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
@@ -24,4 +24,10 @@ def build_recycle(prefix: Path | str, sbom: dict):
src_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
write_package_version_batch(package_info.version)
# Recycle doesn't have a CMake package file, even though a PR to that effect has been
# open for 3 years: https://github.com/steinwurf/recycle/pull/36
# I will use the same workaround as with asio and fake one myself
shutil.copy(Path(__file__).parent.parent / "patches" / "recycle" / "recycleConfig.cmake", install_dir)
return install_dir
+48
View File
@@ -0,0 +1,48 @@
# (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 common.settings import temporarily_set_shared
from package.package_info import get_package_info
def build_udpcap(prefix: Path | str, sbom: dict):
print_banner("Building udpcap")
package_info = get_package_info("udpcap")
package_info.add_to_sbom(sbom)
# this is a can of worms here...
#
# This depends on pcapplusplus which in turn depends on npcap.
# But npcap can only be built with spectre mitigated VS SDK libraries,
# which I don't want to impose on the user. I will
# leave this out until I know for sure what this is needed for
asio_install_path = package_info.dependency_path("asio")
pcapplusplus_install_path = package_info.dependency_path("pcapplusplus")
cmake_args = [
("UDPCAP_BUILD_SAMPLES:BOOL", "OFF"),
("UDPCAP_BUILD_TESTS:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_ENABLED:BOOL", "ON"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_NPCAP:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_PCAPPLUSPLUS:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_ASIO:BOOL", "OFF"),
("UDPCAP_THIRDPARTY_USE_BUILTIN_GTEST:BOOL", "OFF"),
("asio_DIR:PATH", str(asio_install_path)),
("asio_INCLUDE_DIR:PATH", str(asio_install_path / "include")),
]
src_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
write_package_version_batch(package_info.version)
return install_dir