41 lines
1.5 KiB
Python
41 lines
1.5 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
|
|
|
|
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
|