Initial commit of revamped build scripts. All set to Apache License

This commit is contained in:
Stephan Menzel
2025-06-23 15:39:05 +02:00
commit d62319e14b
52 changed files with 2661 additions and 0 deletions
View File
+42
View File
@@ -0,0 +1,42 @@
# (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 package.package_info import get_package_info
def build_abseil(prefix: Path | str, sbom: dict):
print_banner("Building Abseil (Protobuf Dependency)")
package_info = get_package_info("abseil-cpp")
package_info.add_to_sbom(sbom)
abseil_cmake_args = [
("BUILD_SHARED_LIBS:BOOL", "OFF"),
("BUILD_TESTING:BOOL", "OFF"),
("ABSL_PROPAGATE_CXX_STD:BOOL", "ON"),
("ABSL_BUILD_TESTING:BOOL", "OFF"),
("ABSL_BUILD_TEST_HELPERS", "OFF"),
("ABSL_ENABLE_INSTALL:BOOL", "ON"),
("ABSL_RUN_TESTS:BOOL", "OFF"),
]
abseil_dir = clone_git_tag(package_info, recursive=True)
# Abseil LTS doesn't build with CMake>=3.30 due to some imported GTest target.
# Gotta patch that shit until this situation is resolved. https://github.com/abseil/abseil-cpp/issues/690
with pushd(abseil_dir):
subprocess.run(["git", "apply", "..\\..\\gtest_fix.patch"])
install_dir = cmake_build_install(abseil_dir, package_info, cmake_args=abseil_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+38
View File
@@ -0,0 +1,38 @@
# (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
+71
View File
@@ -0,0 +1,71 @@
# (c) 2025 by Stephan Menzel
# Licensed under the Apache License, Version 2.0.
# See attached file LICENSE for full details
import os
from pathlib import Path
from build_functions.build_utils import run_in_shell, print_banner, file_and_console_log
from common.azure import write_package_version_batch
from common.directory_helpers import pushd, get_local_prefix
from common.git_helpers import clone_git_tag
import common.settings
from package.package_info import get_package_info
def build_boost(prefix: Path | str, sbom: dict):
print_banner("Building Boost")
package_info = get_package_info("boost")
package_info.add_to_sbom(sbom)
boost_dir = clone_git_tag(package_info, recursive=True)
with pushd(boost_dir):
prefix = package_info.install_location()
if not common.settings.rebuild and os.path.exists("built_and_installed.txt"):
file_and_console_log("already built, exiting")
return prefix
if os.name == 'nt':
bootstrap_suffix = "bat"
b2_suffix = ".exe"
cmdprefix = ""
flags = "define=BOOST_USE_WINAPI_VERSION=0x0A00 define=_WIN32_WINNT=0x0A00"
else:
cmdprefix = "./"
bootstrap_suffix = "sh"
b2_suffix = ""
flags = "cxxflags=-fPIC cflags=-fPIC"
if os.name != 'nt':
run_in_shell('chmod +x bootstrap.sh')
run_in_shell('chmod +x ./tools/build/src/engine/build.sh')
run_in_shell(
f"{cmdprefix}bootstrap.{bootstrap_suffix} {common.settings.boost_bootstrap_toolset} --prefix={prefix}")
# Normally I wouldn't exclude this many (or indeed any) libs from the build
# but I have to save time to get the pipeline run below 1h
run_in_shell(
f"{cmdprefix}b2{b2_suffix} {flags} {common.settings.boost_toolset} cxxstd={common.settings.cpp_standard} -j {common.settings.num_cores} "
f"--prefix={prefix} "
"--without-mpi "
"--without-graph_parallel "
# "--without-python "
"address-model=64 architecture=x86 link=static runtime-link=shared "
"variant=release threading=multi install")
with open("built_and_installed.txt", "w") as lockfile:
lockfile.write("built")
write_package_version_batch(package_info.version)
# This stopped working somehow...
# if run_in_buildpipeline:
# shutil.rmtree(local_directory)
return prefix
+34
View File
@@ -0,0 +1,34 @@
# (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_cares(prefix: Path | str, sbom: dict):
print_banner("Building C-Ares (gRPC Dependency)")
package_info = get_package_info("c-ares")
package_info.add_to_sbom(sbom)
cares_cmake_args = [
("BUILD_SHARED_LIBS:BOOL", "OFF"),
("CARES_BUILD_TESTS:BOOL", "OFF"),
("CARES_BUILD_CONTAINER_TESTS:BOOL", "OFF"),
("CARES_BUILD_TOOLS:BOOL", "OFF"),
("CARES_SHARED:BOOL", "OFF"),
("CARES_STATIC:BOOL", "ON"),
("CARES_STATIC_PIC:BOOL", "ON"),
("CARES_MSVC_STATIC_RUNTIME:BOOL", "OFF")
]
cares_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(cares_dir, package_info, cmake_args=cares_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+34
View File
@@ -0,0 +1,34 @@
# (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_ceres(prefix: Path | str, sbom: dict):
print_banner("Building Ceres")
package_info = get_package_info("ceres-solver")
package_info.add_to_sbom(sbom)
eigen_install_path = package_info.dependency_path("eigen")
glog_install_path = package_info.dependency_path("glog")
ceres_cmake_args = [
("EIGENSPARSE:BOOL", "ON"),
("BUILD_EXAMPLES:BOOL", "OFF"),
("BUILD_TESTING:BOOL", "OFF"),
("SCHUR_SPECIALIZATIONS:BOOL", "OFF"),
("USE_CUDA:BOOL", "OFF"),
("Eigen3_DIR:PATH", str(eigen_install_path / "share" / "eigen3" / "cmake")),
("glog_DIR:PATH", str(glog_install_path / "lib" / "cmake" / "glog"))
]
eigen_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(eigen_dir, package_info, cmake_args=ceres_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+29
View File
@@ -0,0 +1,29 @@
# (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_cppzmq(prefix: Path | str, sbom: dict):
print_banner("Building Lib cppzmq")
package_info = get_package_info("cppzmq")
package_info.add_to_sbom(sbom)
libzmq_install_path = package_info.dependency_path("libzmq")
cppzmq_cmake_args = [
("CPPZMQ_BUILD_TESTS:BOOL", "OFF"),
("ZeroMQ_DIR:PATH", str(libzmq_install_path / "CMake"))
]
cppzmq_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(cppzmq_dir, package_info, cmake_args=cppzmq_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+60
View File
@@ -0,0 +1,60 @@
# (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
import common.settings
from package.package_info import get_package_info
def build_curl(prefix: Path | str, sbom: dict):
print_banner("Building CURL")
package_info = get_package_info("curl")
package_info.add_to_sbom(sbom)
zlib_install_path = package_info.dependency_path("zlib")
# It only appears to depend on gtest when I enable tests, which I don't
# googletest_install_path = package_info.dependency_path(prefix, "googletest")
curl_cmake_args = [
("BUILD_LIBCURL_DOCS:BOOL", "OFF"),
("BUILD_MISC_DOCS:BOOL", "OFF"),
("BUILD_CURL_EXE:BOOL", "OFF"),
("BUILD_EXAMPLES:BOOL", "OFF"),
("BUILD_STATIC_LIBS:BOOL", "ON"),
# This is only optional until 8.11, which is why this is not using a more recent version
# Libpsl has no Windows build support. https://github.com/curl/curl/issues/16486
# This means, you're probably not able to upgrade beyond 8.11.x
("CURL_USE_LIBPSL:BOOL", "OFF"),
("CURL_USE_LIBIDN2:BOOL", "OFF"),
("CURL_USE_LIBSSH2:BOOL", "OFF"),
("ENABLE_CURL_MANUAL:BOOL", "OFF"),
# Many optional dependencies. I switch off as many as I can get away with.
# Once we know for sure which ones we need we can always bring them in
("USE_HTTPSRR:BOOL", "OFF"),
("USE_ECH:BOOL", "OFF"),
("USE_LIBIDN2:BOOL", "OFF"),
("USE_MSH3:BOOL", "OFF"),
("USE_NGHTTP2:BOOL", "OFF"),
("USE_NGTCP2:BOOL", "OFF"),
("ZLIB_ROOT:PATH", str(zlib_install_path)),
("ZLIB_USE_STATIC_LIBS:BOOL", "ON"),
("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))
]
curl_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(curl_dir, package_info, cmake_args=curl_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+40
View File
@@ -0,0 +1,40 @@
# (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
import common.settings
from package.package_info import get_package_info
def build_eigen(prefix: Path | str, sbom: dict):
print_banner("Building Eigen")
package_info = get_package_info("eigen")
# Eigen's build system has weird bugs
# https://stackoverflow.com/questions/71876437/cmake-error-compiler-does-not-support-c11-when-configuring-eigen-with-visual
# which make it fail with anything but explicitly set C++11. Sad, really. It appears to be fixed in master
# but I can't switch to master for a medical device.
global cpp_standard
prev_cpp_standard = common.settings.cpp_standard
cpp_standard = "11"
package_info.add_to_sbom(sbom)
eigen_cmake_args = [
("CMAKE_Fortran_COMPILER_NOT_FOUND:BOOL", "ON")
]
eigen_dir = clone_git_tag(package_info, recursive=False)
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
return install_dir
+37
View File
@@ -0,0 +1,37 @@
# (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_fineftp(prefix: Path | str, sbom: dict):
print_banner("Building fineftp")
package_info = get_package_info("fineftp")
package_info.add_to_sbom(sbom)
asio_install_path = package_info.dependency_path("asio")
# It only appears to depend on gtest when I enable tests, which I don't
# googletest_install_path = package_info.dependency_path(prefix, "googletest")
fineftp_cmake_args = [
("FINEFTP_SERVER_BUILD_SAMPLES:BOOL", "OFF"),
("FINEFTP_SERVER_BUILD_TESTS:BOOL", "OFF"),
("FINEFTP_SERVER_USE_BUILTIN_ASIO:BOOL", "OFF"),
("asio_INCLUDE_DIR:PATH", (asio_install_path / "include").as_posix()),
("asio_DIR:PATH", asio_install_path.as_posix()),
]
fineftp_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(fineftp_dir, package_info, cmake_args=fineftp_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+30
View File
@@ -0,0 +1,30 @@
# (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_glog(prefix: Path | str, sbom: dict):
print_banner("Building Glog")
package_info = get_package_info("glog")
package_info.add_to_sbom(sbom)
cmake_args = [
("WITH_GFLAGS:BOOL", "OFF"),
("WITH_GMOCK:BOOL", "OFF"),
("WITH_GTEST:BOOL", "OFF"),
("WITH_UNWIND: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
+29
View File
@@ -0,0 +1,29 @@
# (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_googletest(prefix: Path | str, sbom: dict):
print_banner("Building googletest")
package_info = get_package_info("googletest")
package_info.add_to_sbom(sbom)
googletest_cmake_args = [
# Debatable
("GTEST_HAS_ABSL:BOOL", "OFF"),
]
googletest_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(googletest_dir, package_info, cmake_args=googletest_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+71
View File
@@ -0,0 +1,71 @@
# (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
import common.settings
from package.package_info import get_package_info
def build_grpc(prefix: Path | str, sbom: dict):
print_banner("Building gRPC")
package_info = get_package_info("grpc")
# Gotta reduce this for gRPC. The build agent keeps running out of mem
global num_cores
num_cores = 1 if common.settings.run_in_buildpipeline else 6
package_info.add_to_sbom(sbom)
zlib_install_path = package_info.dependency_path("zlib")
re2_install_path = package_info.dependency_path("re2")
openssl_install_path = package_info.dependency_path("openssl")
abseil_install_path = package_info.dependency_path("abseil-cpp")
cares_install_path = package_info.dependency_path("c-ares")
protobuf_install_path = package_info.dependency_path("protobuf")
grpc_cmake_args = [
("BUILD_SHARED_LIBS:BOOL", "OFF"),
("BUILD_TESTING:BOOL", "OFF"),
("ABSL_PROPAGATE_CXX_STD:BOOL", "ON"),
("gRPC_BUILD_GRPC_CPP_PLUGIN:BOOL", "ON"),
("gRPC_BUILD_GRPC_CSHARP_PLUGIN:BOOL", "ON"),
("gRPC_BUILD_GRPC_PYTHON_PLUGIN:BOOL", "ON"),
("gRPC_BUILD_GRPC_NODE_PLUGIN:BOOL", "OFF"),
("gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN:BOOL", "OFF"),
("gRPC_BUILD_GRPC_PHP_PLUGIN:BOOL", "OFF"),
("gRPC_BUILD_GRPC_RUBY_PLUGIN:BOOL", "OFF"),
# ("gRPC_BUILD_MSVC_MP_COUNT:STRING", "1"),
# ("gRPC_DOWNLOAD_ARCHIVES:BOOL", "ON"),
("gRPC_ABSL_PROVIDER:STRING", "package"),
("absl_DIR:PATH", str(abseil_install_path / "lib" / "cmake" / "absl")),
("gRPC_CARES_PROVIDER:STRING", "package"),
("c-ares_DIR:PATH", str(cares_install_path / "lib" / "cmake" / "c-ares")),
("gRPC_PROTOBUF_PROVIDER:STRING", "package"),
("Protobuf_DIR:PATH", str(protobuf_install_path / "cmake")),
("utf8_range_DIR:PATH", str(protobuf_install_path / "lib" / "cmake" / "utf8_range")),
("gRPC_SSL_PROVIDER", "package"),
("OPENSSL_ROOT_DIR:PATH", openssl_install_path),
("OPENSSL_USE_STATIC_LIBS:BOOL", "ON"),
("gRPC_RE2_PROVIDER", "package"),
("re2_DIR:PATH", str(re2_install_path / "lib" / "cmake" / "re2")),
("gRPC_ZLIB_PROVIDER:STRING", "package"),
("ZLIB_ROOT:PATH", str(zlib_install_path)),
("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))
]
grpc_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(grpc_dir, package_info, cmake_args=grpc_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+43
View File
@@ -0,0 +1,43 @@
# (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
import common.settings
from package.package_info import get_package_info
def build_hdf5(prefix: Path | str, sbom: dict):
print_banner("Building hdf5")
package_info = get_package_info("hdf5")
package_info.add_to_sbom(sbom)
zlib_install_path = package_info.dependency_path("zlib")
hdf5_cmake_args = [
("H5EX_BUILD_EXAMPLES:BOOL", "OFF"),
("H5EX_BUILD_HL:BOOL", "OFF"),
("HDF5_BUILD_CPP_LIB:BOOL", "ON"),
("HDF5_BUILD_EXAMPLES:BOOL", "OFF"),
("HDF5_BUILD_TOOLS:BOOL", "OFF"),
("HDF5_BUILD_UTILS:BOOL", "OFF"),
# This might come in handy
("HDF5_ENABLE_SZIP_ENCODING:BOOL", "OFF"),
("ZLIB_ROOT:PATH", str(zlib_install_path)),
("ZLIB_USE_STATIC_LIBS:BOOL", "ON"),
("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))
]
hdf5_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(hdf5_dir, package_info, cmake_args=hdf5_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+27
View File
@@ -0,0 +1,27 @@
# (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_jpeg(prefix: Path | str, sbom: dict):
print_banner("Building Jpeg-Turbo")
package_info = get_package_info("libjpeg-turbo")
package_info.add_to_sbom(sbom)
jpeg_cmake_args = [
("ENABLE_SHARED:BOOL", "OFF"),
("WITH_CRT_DLL:BOOL", "ON")
]
jpeg_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(jpeg_dir, package_info, cmake_args=jpeg_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+30
View File
@@ -0,0 +1,30 @@
# (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_libzmq(prefix: Path | str, sbom: dict):
print_banner("Building Lib ZeroMQ")
package_info = get_package_info("libzmq")
package_info.add_to_sbom(sbom)
libzmq_cmake_args = [
("BUILD_SHARED:BOOL", "OFF"), # yes, they seem to have their own
("BUILD_TESTS:BOOL", "OFF"), # yes, they seem to have their own
("ZMQ_BUILD_TESTS:BOOL", "OFF"), # correction! It would appear as if they have _two_
("WITH_PERF_TOOL:BOOL", "OFF")
]
libzmq_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(libzmq_dir, package_info, cmake_args=libzmq_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+40
View File
@@ -0,0 +1,40 @@
# (c) 2025 by Stephan Menzel
# Licensed under the Apache License, Version 2.0.
# See attached file LICENSE for full details
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
from common.git_helpers import clone_git_tag
from package.package_info import get_package_info
def build_matplot(prefix: Path | str, sbom: dict):
print_banner("Building for Matplot++")
package_info = get_package_info("matplotplusplus")
package_info.add_to_sbom(sbom)
jpeg_install_path = package_info.dependency_path("libjpeg-turbo")
# Matplot won't build with C++23
prev_cpp_standard = common.settings.cpp_standard
common.settings.cpp_standard = "17"
matplot_cmake_args = [
("MATPLOTPP_BUILD_TESTS:BOOL", "OFF"),
("MATPLOTPP_BUILD_EXAMPLES:BOOL", "OFF"),
("JPEG_INCLUDE_DIR:PATH", str(jpeg_install_path / "include")),
("JPEG_LIBRARY_RELEASE:FILEPATH", str(jpeg_install_path / "lib" / "jpeg-static.lib")),
("JPEG_LIBRARY_DEBUG:FILEPATH", str(jpeg_install_path / "lib" / "jpeg-static.lib"))
]
matplot_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(matplot_dir, package_info, cmake_args=matplot_cmake_args)
write_package_version_batch(package_info.version)
common.settings.cpp_standard = prev_cpp_standard
return install_dir
+32
View File
@@ -0,0 +1,32 @@
# (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_onetbb(prefix: Path | str, sbom: dict):
print_banner("Building oneTBB")
package_info = get_package_info("onetbb")
package_info.add_to_sbom(sbom)
# While we build everything static, we cannot do that with oneTBB. They issue a very strong
# warning if we try. Since we have to live with a number of DLL's anyway (possibly Qt)
# I think we just have to take one for the team, considering how low level tbb is.
with temporarily_set_shared():
cmake_args = [
("TBB_TEST: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
+110
View File
@@ -0,0 +1,110 @@
# (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
import common.settings
from package.package_info import get_package_info
def build_opencv(prefix: Path | str, sbom: dict):
print_banner("Building OpenCV")
package_info = get_package_info("opencv")
package_info.add_to_sbom(sbom)
eigen_install_path = package_info.dependency_path("eigen")
zlib_install_path = package_info.dependency_path("zlib")
opencv_cmake_args = [
# Those two undocumented lines are necessary to make the install target use the correct
# subdir for the libraries
# ("OpenCV_ARCH:STRING", "x64"),
# ("OpenCV_RUNTIME:STRING", "vc17"),
("BUILD_SHARED_LIBS:BOOL", "OFF"),
("BUILD_TESTS:BOOL", "OFF"),
("BUILD_PERF_TESTS:BOOL", "OFF"),
("BUILD_WITH_STATIC_CRT:BOOL", "OFF"),
("BUILD_OPENJPEG:BOOL", "OFF"),
("BUILD_IPP_IW:BOOL", "OFF"),
("BUILD_ITT:BOOL", "OFF"),
("BUILD_JASPER:BOOL", "OFF"),
("BUILD_JPEG:BOOL", "OFF"),
("BUILD_ITT:BOOL", "OFF"),
("BUILD_JAVA:BOOL", "OFF"),
("BUILD_PNG:BOOL", "OFF"),
("BUILD_PROTOBUF:BOOL", "OFF"),
("BUILD_TIFF:BOOL", "OFF"),
("BUILD_WEBP:BOOL", "OFF"),
("BUILD_VTK:BOOL", "OFF"),
("BUILD_ZLIB:BOOL", "OFF"),
("BUILD_opencv_apps:BOOL", "OFF"),
("BUILD_opencv_calib3d:BOOL", "OFF"),
("BUILD_opencv_dnn:BOOL", "OFF"),
("BUILD_opencv_features2d:BOOL", "OFF"),
("BUILD_opencv_flann:BOOL", "OFF"),
("BUILD_opencv_imgcodecs:BOOL", "ON"),
("BUILD_opencv_java_bindings_generator:BOOL", "OFF"),
("BUILD_opencv_js_bindings_generator:BOOL", "OFF"),
("BUILD_opencv_objc_bindings_generator:BOOL", "OFF"),
("BUILD_opencv_objdetect:BOOL", "OFF"),
("BUILD_opencv_ml:BOOL", "OFF"),
("BUILD_opencv_photo:BOOL", "OFF"),
("BUILD_opencv_python3:BOOL", "OFF"),
("BUILD_opencv_python_bindings_generator:BOOL", "OFF"),
("BUILD_opencv_python_tests:BOOL", "OFF"),
("DNN_ENABLE_PLUGINS:BOOL", "OFF"),
("HIGHGUI_ENABLE_PLUGINS:BOOL", "OFF"),
("WITH_ADE:BOOL", "OFF"),
("WITH_DIRECTML:BOOL", "OFF"),
("WITH_DIRECTX:BOOL", "OFF"),
("WITH_DSHOW:BOOL", "OFF"),
("WITH_EIGEN:BOOL", "ON"),
("Eigen3_DIR:PATH", str(eigen_install_path / "share" / "eigen3" / "cmake")),
("WITH_FLATBUFFERS:BOOL", "OFF"),
("WITH_WITH_GSTREAMER", "OFF"),
("WITH_IMGCODEC_HDR:BOOL", "OFF"),
("WITH_IMGCODEC_PFM:BOOL", "OFF"),
("WITH_IMGCODEC_PXM:BOOL", "OFF"),
("WITH_IMGCODEC_SUNRASTER:BOOL", "OFF"),
("WITH_IPP:BOOL", "OFF"),
("WITH_ITT:BOOL", "OFF"),
("WITH_JASPER:BOOL", "OFF"),
("WITH_JPEG:BOOL", "OFF"),
("WITH_LAPACK:BOOL", "OFF"),
("WITH_MSMF:BOOL", "OFF"),
("WITH_MSMF_DXVA:BOOL", "OFF"),
("WITH_OBSENSOR:BOOL", "OFF"),
("WITH_OPENCL:BOOL", "OFF"),
("WITH_OPENCLAMDBLAS:BOOL", "OFF"),
("WITH_OPENCLAMDFFT:BOOL", "OFF"),
("WITH_OPENEXR:BOOL", "OFF"),
("WITH_OPENJPEG:BOOL", "OFF"),
("WITH_PNG:BOOL", "OFF"),
("WITH_PROTOBUF:BOOL", "OFF"),
("WITH_TIFF:BOOL", "OFF"),
("WITH_WEBP:BOOL", "OFF"),
("WITH_WIN32UI:BOOL", "OFF"),
("WITH_VTK:BOOL", "OFF"),
("ZLIB_ROOT:PATH", str(zlib_install_path)),
("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))
]
opencv_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(opencv_dir, package_info, cmake_args=opencv_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+114
View File
@@ -0,0 +1,114 @@
# (c) 2025 by Stephan Menzel
# Licensed under the Apache License, Version 2.0.
# See attached file LICENSE for full details
import os
import zipfile
from pathlib import Path
# we need requests to download perl package but I don't want to install a venv just for that
# with this trick we can use requests that comes bundled with pip
try:
import requests
except ImportError:
import pip._vendor.requests as requests
from build_functions.build_utils import run_in_shell, print_banner, file_and_console_log
from common.azure import write_package_version_batch
from common.directory_helpers import pushd, get_local_prefix
from common.git_helpers import clone_git_tag
import common.settings
from package.package_info import get_package_info
def build_openssl(prefix: Path | str, sbom: dict):
print_banner("Building OpenSSL")
package_info = get_package_info("openssl")
package_info.add_to_sbom(sbom)
zlib_install_path = package_info.dependency_path("zlib")
zlib_include_path = zlib_install_path / "include"
zlib_library_path = zlib_install_path / "lib" / common.settings.zlib_static_lib_name
openssl_dir = clone_git_tag(package_info, recursive=False)
with pushd(openssl_dir):
install_prefix = get_local_prefix(prefix)
if not common.settings.rebuild and Path("built_and_installed.txt").exists():
file_and_console_log("already built, exiting")
return install_prefix
# In the azure devops pipeline there's no Perl available, yet we need it to compile OpenSSL
# So I download the portable package and use this
perl_package_filename = "strawberry-perl-5.38.2.2-64bit-portable.zip"
url = f"https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_53822_64bit/{perl_package_filename}"
r = requests.get(url, allow_redirects=True)
with open(perl_package_filename, "wb") as package_file:
package_file.write(r.content)
with zipfile.ZipFile(perl_package_filename, "r") as zip_ref:
os.mkdir("perl_portable")
zip_ref.extractall("perl_portable")
path_amend = Path("./perl_portable/c/bin").resolve()
os.environ["PATH"] += os.pathsep + str(path_amend)
# This requires not only perl but also assumes we are in a "Developer Shell" on Windows,
# meaning we have nmake in the path
if os.name == "nt":
run_in_shell("perl.exe .\\Configure no-shared no-legacy zlib no-zlib-dynamic "
"threads no-unit-test no-egd "
f"--with-zlib-include={str(zlib_include_path)} "
f"--with-zlib-lib={str(zlib_library_path)} "
f"--prefix={str(install_prefix)} --openssldir={str(install_prefix)} "
"VC-WIN64A")
# OpenSSL always assumes /MT when building statically. Looks like this cannot be overridden
# So we change the makefile by replacing the occurrences
#
# Update: This trick used to work but no longer does with 3.2.1 / recent MSVC
# I have failed to find a solution but found this source: https://github.com/openssl/openssl/discussions/22668
# arguing this is not necessary (anymore?) because of the /Zl switch which defers the selection
# of the runtime to executable link time. I'm not really buying it but there's little
# I can do about that right now and I will try if it really works when we use OpenSSL with static
# runtime selection. We we only relly know once the egm links against this warning free and works.
# If such is not the case and you end up here looking at this, try again to modify the selected
# runtime like I do below.
#
with open('makefile', 'r') as file:
filedata = file.read()
# Replace the MT flags
filedata = filedata.replace("/MT", "/MD")
# Write the file out again
with open('makefile', 'w') as lockfile:
lockfile.write(filedata)
# If you are here debugging why this doesn't work, you are probably not starting
# this in a x64 native tools command prompt shell
run_in_shell("nmake install")
# I know, dirty, but building openssl takes for evah
with open("built_and_installed.txt", "w") as lockfile:
lockfile.write("built")
elif os.name == "posix":
run_in_shell("perl ./Configure no-shared zlib no-zlib-dynamic threads no-unit-test "
f"--with-zlib-include={str(zlib_include_path)} "
f"--with-zlib-lib={str(zlib_library_path)} "
f"--prefix={str(install_prefix)} --openssldir={str(install_prefix)} "
"")
run_in_shell(f"make -j{common.settings.num_cores} install")
with open("built_and_installed.txt", "w") as lockfile:
lockfile.write("built")
write_package_version_batch(package_info.version)
return install_prefix
+43
View File
@@ -0,0 +1,43 @@
# (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
import common.settings
from common.git_helpers import clone_git_tag
from package.package_info import get_package_info
def build_opensubdiv(prefix: Path | str, sbom: dict):
print_banner("Building OpenSubdiv")
package_info = get_package_info("opensubdiv")
package_info.add_to_sbom(sbom)
onetbb_install_path = package_info.dependency_path("onetbb")
zlib_install_path = package_info.dependency_path("zlib")
# This library is quite a beast. It has a lot of additional acceleration dependencies
# such as OpenCL, CUDA, you name it. This is meant to provide a mininmal build to get OpenUSD
# to work. Once it does, we may look into accelerating things
cmake_args = [
("NO_EXAMPLES:BOOL", "ON"),
("NO_TUTORIALS:BOOL", "ON"),
("NO_REGRESSION:BOOL", "ON"),
("NO_CUDA:BOOL", "ON"),
("NO_OPENCL:BOOL", "ON"),
("TBB_DIR:PATH", str(onetbb_install_path / "lib" / "cmake" / "TBB")),
("ZLIB_ROOT:PATH", str(zlib_install_path)),
("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))
]
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
+46
View File
@@ -0,0 +1,46 @@
# (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
import common.settings
from common.git_helpers import clone_git_tag
from package.package_info import get_package_info
def build_openusd(prefix: Path | str, sbom: dict):
print_banner("Building OpenUSD")
package_info = get_package_info("openusd")
package_info.add_to_sbom(sbom)
onetbb_install_path = package_info.dependency_path("onetbb")
opensubdiv_install_path = package_info.dependency_path("opensubdiv")
zlib_install_path = package_info.dependency_path("zlib")
cmake_args = [
# We're gonna need Python but I had trouble compiling the bindings.
# Disabled for the first tests
("PXR_ENABLE_PYTHON_SUPPORT:BOOL", "OFF"),
("PXR_BUILD_EXAMPLES:BOOL", "OFF"),
("PXR_BUILD_TESTS:BOOL", "OFF"),
("PXR_BUILD_TUTORIALS:BOOL", "ON"),
("PXR_BUILD_HTML_DOCUMENTATION:BOOL", "OFF"),
("TBB_DIR:PATH", str(onetbb_install_path / "lib" / "cmake" / "TBB")),
("OpenSubdiv_DIR:PATH", str(opensubdiv_install_path / "lib" / "cmake" / "OpenSubdiv")),
("ZLIB_ROOT:PATH", str(zlib_install_path)),
("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))
]
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
+44
View File
@@ -0,0 +1,44 @@
# (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
import common.settings
from package.package_info import get_package_info
def build_protobuf(prefix: Path | str, sbom: dict):
print_banner("Building Protobuf")
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")
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"),
("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)),
("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)
install_dir = cmake_build_install(protobuf_dir, package_info, cmake_args=protobuf_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+87
View File
@@ -0,0 +1,87 @@
# (c) 2025 by Stephan Menzel
# Licensed under the Apache License, Version 2.0.
# See attached file LICENSE for full details
import os
from pathlib import Path
from build_functions.build_utils import run_in_shell, print_banner, file_and_console_log
from common.azure import write_package_version_batch
from common.directory_helpers import pushd, get_local_prefix
from common.git_helpers import clone_git_tag
from package.package_info import get_package_info
def build_qt5(prefix: Path | str, sbom: dict):
print_banner("Building Qt5")
package_info = get_package_info("qt5")
package_info.add_to_sbom(sbom)
zlib_install_path = package_info.dependency_path("zlib")
# Protobuf may not be such a strong dependency
protobuf_install_path = package_info.dependency_path("protobuf")
qt_src_dir = clone_git_tag(package_info, recursive=True)
with pushd(qt_src_dir):
install_dir = package_info.install_location()
build_folder = "_build"
if not os.path.isdir(build_folder):
os.makedirs(build_folder)
with pushd(build_folder):
configure = Path("..") / "configure.bat"
zlib_include = zlib_install_path / 'include'
zlib_lib = zlib_install_path / 'lib' / 'zlibstatic.lib'
run_in_shell(
f"{configure} "
f"-prefix {install_dir} "
"-release "
"-mp "
"-confirm-license "
"-c++std c++2b "
"-opensource "
# Specify exactly which modules we need. This is way better than excluding
# what we don't need, assuming this is a lot
# "-submodules qtbase,qtsvg "
"-gui -widgets -no-dbus "
"-D QT_BUILD_TESTS_BY_DEFAULT=OFF "
# f"-system-zlib -I {str((zlib_install_path / 'include').as_posix())} -L {str(zlib_lib.as_posix())} "
"-nomake examples "
"-nomake tests "
"-skip qtlottie "
"-skip qtmultimedia "
"-skip qtpurchasing "
"-skip qtwebengine "
"-skip qtwebchannel "
"-skip qtwayland "
"-skip qtspeech "
"-skip qtdatavis3d "
"-skip qtlocation "
"-skip qtdeclarative "
"-skip qtconnectivity "
"-skip qtsystems "
"-skip qtxmlpatterns "
"-skip qtscript "
# "-- "
# This should not be necessary but the -system-zlib parameter above appears bugged.
# It should help CMake to find ZLib
# f"-DZLIB_INCLUDE_DIR=\"{zlib_include.as_posix()}\" "
# f"-DZLIB_LIBRARY=\"{zlib_lib.as_posix()}\" "
)
run_in_shell(f'nmake')
run_in_shell(f'nmake install')
with open("built_and_installed.txt", "w") as lockfile:
lockfile.write(f"built release")
write_package_version_batch(package_info.version)
return install_dir
+73
View File
@@ -0,0 +1,73 @@
# (c) 2025 by Stephan Menzel
# Licensed under the Apache License, Version 2.0.
# See attached file LICENSE for full details
import os
from pathlib import Path
from build_functions.build_utils import run_in_shell, print_banner, file_and_console_log
from common.azure import write_package_version_batch
from common.directory_helpers import pushd, get_local_prefix
from common.git_helpers import clone_git_tag
import common.settings
from package.package_info import get_package_info
def build_qt6(prefix: Path | str, sbom: dict):
print_banner("Building Qt6")
package_info = get_package_info("qt6")
package_info.add_to_sbom(sbom)
zlib_install_path = package_info.dependency_path("zlib")
# Protobuf may not be such a strong dependency
protobuf_install_path = package_info.dependency_path("protobuf")
qt_src_dir = clone_git_tag(package_info, recursive=True)
with pushd(qt_src_dir):
install_dir = package_info.install_location()
build_folder = "_build"
if not os.path.isdir(build_folder):
os.makedirs(build_folder)
with pushd(build_folder):
configure = Path("..") / "configure.bat"
zlib_include = zlib_install_path / 'include'
zlib_lib = zlib_install_path / 'lib' / 'zlibstatic.lib'
run_in_shell(
f"{configure} "
f"-prefix {install_dir} "
"-release "
"-confirm-license "
"-c++std c++2b "
"-opensource "
# Specify exactly which modules we need. This is way better than excluding
# what we don't need, assuming this is a lot
"-submodules qtbase,qtsvg "
"-D QT_BUILD_TESTS_BY_DEFAULT=OFF "
f"-system-zlib -I {str((zlib_install_path / 'include').as_posix())} -L {str(zlib_lib.as_posix())} "
"-nomake examples "
"-nomake tests "
"-- "
# This should not be necessary but the -system-zlib parameter above appears bugged.
# It should help CMake to find ZLib
f"-DZLIB_INCLUDE_DIR=\"{zlib_include.as_posix()}\" "
f"-DZLIB_LIBRARY=\"{zlib_lib.as_posix()}\" "
)
# Qt6 can use Cmake, Qt5 cannot
run_in_shell(f'cmake --build . --parallel {common.settings.num_cores}')
run_in_shell(f'cmake --install .')
with open("built_and_installed.txt", "w") as lockfile:
lockfile.write(f"built release")
write_package_version_batch(package_info.version)
return install_dir
+94
View File
@@ -0,0 +1,94 @@
# (c) 2025 by Stephan Menzel
# Licensed under the Apache License, Version 2.0.
# See attached file LICENSE for full details
import os
import re
from pathlib import Path
from build_functions.build_utils import run_in_shell, print_banner, file_and_console_log
from common.azure import write_package_version_batch
from common.directory_helpers import pushd
from common.errors import BuildError
from common.git_helpers import clone_git_tag
import common.settings
from package.package_info import get_package_info
def build_qwt(prefix: Path | str, sbom: dict):
"""This gave me a lot of headaches. Very unusual build system, if that term is applicable at all.
Also, they seemed to have moved _from_ github _to_ Sourceforge prior to the 6.3.0 tag.
They have also changed the build config files a bit, so this will only work with 6.3.0
"""
print_banner("Building Qwt")
if not os.name == "nt":
raise BuildError(f"qwt is only implemented on windows. Please implement me for your system")
package_info = get_package_info("qwt")
package_info.add_to_sbom(sbom)
qt_install_path = package_info.dependency_path("qt5")
qmake_path = qt_install_path / "bin" / "qmake.exe" if os.name == "nt" else "qmake"
if not qmake_path.is_file():
raise BuildError(f"Qmake executable at {qmake_path} doesn't seem to be present")
src_dir = clone_git_tag(package_info, recursive=False)
with pushd(src_dir):
if not common.settings.rebuild and os.path.exists("built_and_installed.txt"):
file_and_console_log("already built, exiting")
return prefix
install_dir = package_info.install_location()
# I don't think this old hand-rolled build system supports out-of-src builds.
# I will try to build it right here.
# It looks like as if configuring this involves two modifications to local files.
buildfile = Path("qwtbuild.pri")
buildfile_bak = Path("qwtbuild.pri.bak")
buildfile_bak.unlink(missing_ok=True)
buildfile.rename(buildfile_bak)
# I'm trying to set the build config to release here but that doesn't work.
# It still builds debug as well. No idea how to fix this
with open(buildfile_bak, 'r') as fi, open(buildfile, 'w') as fo:
found = False
regex = re.compile(R"^\s+CONFIG\s+\+=\s(debug_and_release)$")
for line in fi:
if not found:
if m := regex.match(line):
line = line.replace(m.group(1),"release")
found = True
fo.write(line)
else:
fo.write(line)
configfile = Path("qwtconfig.pri")
configfile_bak = Path("qwtconfig.pri.bak")
configfile_bak.unlink(missing_ok=True)
configfile.rename(configfile_bak)
with open(configfile_bak, 'r') as fi, open(configfile, 'w') as fo:
found = False
regex = re.compile(R"^\s*QWT_INSTALL_PREFIX\s+=\s+(C:/Qwt-\$\$QWT_VERSION-dev)$")
for line in fi:
if not found:
if m := regex.match(line):
line = line.replace(m.group(1), str(install_dir.as_posix()))
found = True
fo.write(line)
else:
fo.write(line)
run_in_shell(f'{qmake_path} qwt.pro')
run_in_shell("nmake")
run_in_shell("nmake install")
with open("built_and_installed.txt", "w") as lockfile:
lockfile.write(f"built release")
write_package_version_batch(package_info.version)
return install_dir
+30
View File
@@ -0,0 +1,30 @@
# (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_re2(prefix: Path | str, sbom: dict):
print_banner("Building re2")
package_info = get_package_info("re2")
package_info.add_to_sbom(sbom)
abseil_install_path = package_info.dependency_path("abseil-cpp")
re2_cmake_args = [
("RE2_BUILD_TESTING", "OFF"),
("absl_DIR:PATH", str(abseil_install_path / "lib" / "cmake" / "absl")),
]
re2_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(re2_dir, package_info, cmake_args=re2_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+27
View File
@@ -0,0 +1,27 @@
# (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_recycle(prefix: Path | str, sbom: dict):
print_banner("Building recycle")
package_info = get_package_info("recycle")
package_info.add_to_sbom(sbom)
cmake_args = [
("BUILD_TESTING", "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
+30
View File
@@ -0,0 +1,30 @@
# (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_spdlog(prefix: Path | str, sbom: dict):
print_banner("Building spdlog")
package_info = get_package_info("spdlog")
package_info.add_to_sbom(sbom)
spdlog_cmake_args = [
("SPDLOG_BUILD_PIC:BOOL", "ON"),
("SPDLOG_BUILD_SHARED:BOOL", "OFF"),
("SPDLOG_BUILD_BENCH:BOOL", "OFF"),
("SPDLOG_BUILD_TESTS:BOOL", "OFF"),
("SPDLOG_BUILD_EXAMPLE:BOOL", "OFF"),
]
spdlog_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(spdlog_dir, package_info, cmake_args=spdlog_cmake_args)
write_package_version_batch(package_info.version)
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.git_helpers import clone_git_tag
from common.headers_only import headers_install
from package.package_info import get_package_info
def build_tclap(prefix: Path | str, sbom: dict):
print_banner("Building Tclap")
package_info = get_package_info("tclap")
package_info.add_to_sbom(sbom)
# This is what happens when you don't include boost. You end up with tons of small
# and eventually unmaintained libraries for every little thing even though
# Boost.ProgramOptions exists.
# This doesn't seem to be needing build, judging by its Conanfile
tclap_dir = clone_git_tag(package_info, recursive=True)
install_dir = headers_install(tclap_dir, package_info, subdir=Path("include"))
write_package_version_batch(package_info.version)
return install_dir
+38
View File
@@ -0,0 +1,38 @@
# (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
+28
View File
@@ -0,0 +1,28 @@
# (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_termcolor(prefix: Path | str, sbom: dict):
print_banner("Building termcolor")
package_info = get_package_info("termcolor")
package_info.add_to_sbom(sbom)
termcolor_cmake_args = [
("TERMCOLOR_TESTS:BOOL", "OFF"),
]
termcolor_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(termcolor_dir, package_info, cmake_args=termcolor_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+28
View File
@@ -0,0 +1,28 @@
# (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_tinyxml2(prefix: Path | str, sbom: dict):
print_banner("Building tinyxml2")
package_info = get_package_info("tinyxml2")
package_info.add_to_sbom(sbom)
tinyxml2_cmake_args = [
# No additional args known
]
tinyxml2_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(tinyxml2_dir, package_info, cmake_args=tinyxml2_cmake_args)
write_package_version_batch(package_info.version)
return install_dir
+37
View File
@@ -0,0 +1,37 @@
# (c) 2025 by Stephan Menzel
# Licensed under the Apache License, Version 2.0.
# See attached file LICENSE for full details
import datetime
import os
import subprocess
logfile = 'build.log'
def file_and_console_log(*args, **kwargs):
print(*args, **kwargs)
with open(logfile, 'a') as f:
f.write(*args)
f.write('\n')
def print_banner(text: str):
file_and_console_log("#########################################################")
file_and_console_log(" " + text)
file_and_console_log("#########################################################")
def run_in_shell(*args, **kwargs):
cmd = ' '.join(args)
print("> " + cmd)
with open(logfile, 'a') as f:
f.write('[cwd] ' + os.getcwd() + '\n')
f.write(cmd + '\n')
try:
start = datetime.datetime.now()
subprocess.run(*args, **kwargs, shell=True, check=True)
with open(logfile, 'a') as f:
f.write(f' took {(datetime.datetime.now() - start).total_seconds()} seconds.\n\n')
except Exception as e:
file_and_console_log("Error: " + str(e))
raise e
+27
View File
@@ -0,0 +1,27 @@
# (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_yaml_cpp(prefix: Path | str, sbom: dict):
print_banner("Building yaml-cpp")
package_info = get_package_info("yaml-cpp")
package_info.add_to_sbom(sbom)
cmake_args = [
("YAML_BUILD_SHARED_LIBS: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
+30
View File
@@ -0,0 +1,30 @@
# (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_zlib(prefix: Path | str, sbom: dict):
print_banner("Building Zlib")
package_info = get_package_info("zlib")
package_info.add_to_sbom(sbom)
zlib_cmake_args = [
("BUILD_SHARED_LIBS:BOOL", "OFF"),
("BUILD_TESTING:BOOL", "OFF"),
("ZLIB_BUILD_EXAMPLES:BOOL", "OFF"),
]
zlib_dir = clone_git_tag(package_info, recursive=True)
install_dir = cmake_build_install(zlib_dir, package_info, cmake_args=zlib_cmake_args)
write_package_version_batch(package_info.version)
return install_dir