DepperDan/build_functions/build_ceres.py

35 lines
1.3 KiB
Python

# (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