From 0598db2c6f56b981613c84a79e6cc3457903756e Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 22 Mar 2024 11:45:30 -0400 Subject: [PATCH] Try to apply fix that will make the image converter build. --- .github/workflows/windows-arm64-wheels.yml | 3 ++- Jenkinsfile | 1 + azure-pipelines-macos-steps.yml | 3 ++- azure-pipelines-windows-steps.yml | 3 ++- stb-cmake-fix.patch | 19 +++++++++++++++++++ 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 stb-cmake-fix.patch diff --git a/.github/workflows/windows-arm64-wheels.yml b/.github/workflows/windows-arm64-wheels.yml index aa0269d..849c6b8 100644 --- a/.github/workflows/windows-arm64-wheels.yml +++ b/.github/workflows/windows-arm64-wheels.yml @@ -87,10 +87,11 @@ jobs: git clone https://github.com/mlpack/mlpack cd mlpack git checkout $MLPACK_VERSION - # Apply patches to install Python headers. + # Apply patches to install Python headers and fix STB detection. cp ../ConfigureFileOnly.cmake CMake/ cp ../mlpack.pc.in src/mlpack/bindings/python/ patch -p1 < ../python-install-headers.patch + patch -p1 < ../stb-cmake-fix.patch - name: Generate setup.py shell: powershell diff --git a/Jenkinsfile b/Jenkinsfile index 6defd7f..84e0365 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,6 +31,7 @@ pipeline cp ../ConfigureFileOnly.cmake CMake/ cp ../mlpack.pc.in src/mlpack/bindings/python/ patch -p1 < ../python-install-headers.patch + patch -p1 < ../stb-cmake-fix.patch mkdir build/ cd build/ diff --git a/azure-pipelines-macos-steps.yml b/azure-pipelines-macos-steps.yml index 7544818..96ff377 100644 --- a/azure-pipelines-macos-steps.yml +++ b/azure-pipelines-macos-steps.yml @@ -16,10 +16,11 @@ steps: sed -i.bk 's/${PACKAGE_VERSION}/${PACKAGE_VERSION}.post1/g' src/mlpack/bindings/python/setup.py.in rm -f src/mlpack/bindings/python/setup.py.in.bk - # Apply patches to install Python headers. + # Apply patches to install Python headers and fix STB detection. cp ../ConfigureFileOnly.cmake CMake/ cp ../mlpack.pc.in src/mlpack/bindings/python/ patch -p1 < ../python-install-headers.patch + patch -p1 < ../stb-cmake-fix.patch displayName: Clone mlpack - bash: | diff --git a/azure-pipelines-windows-steps.yml b/azure-pipelines-windows-steps.yml index cde0be2..51e01dd 100644 --- a/azure-pipelines-windows-steps.yml +++ b/azure-pipelines-windows-steps.yml @@ -58,10 +58,11 @@ steps: sed -i.bk 's/${PACKAGE_VERSION}/${PACKAGE_VERSION}.post1/g' src/mlpack/bindings/python/setup.py.in rm -f src/mlpack/bindings/python/setup.py.in.bk - # Apply patches to install Python headers. + # Apply patches to install Python headers and fix STB detection. cp ../ConfigureFileOnly.cmake CMake/ cp ../mlpack.pc.in src/mlpack/bindings/python/ patch -p1 < ../python-install-headers.patch + patch -p1 < ../stb-cmake-fix.patch displayName: Clone mlpack - powershell: | diff --git a/stb-cmake-fix.patch b/stb-cmake-fix.patch new file mode 100644 index 0000000..d60b76d --- /dev/null +++ b/stb-cmake-fix.patch @@ -0,0 +1,19 @@ +--- mlpack-4.3.0/CMakeLists.txt 2023-11-27 13:27:20.000000000 -0500 ++++ mlpack-4.3.0-mod/CMakeLists.txt 2024-03-22 11:41:28.569175709 -0400 +@@ -312,14 +312,14 @@ + find_package(StbImage) + else() + find_package(StbImage) +- if (NOT STB_IMAGE_FOUND) ++ if (NOT StbImage_FOUND) + get_deps(https://mlpack.org/files/stb.tar.gz stb stb.tar.gz) + set(STB_IMAGE_INCLUDE_DIR ${GENERIC_INCLUDE_DIR}) + find_package(StbImage REQUIRED) + endif() + endif() + +-if (STB_IMAGE_FOUND) ++if (StbImage_FOUND) + set(STB_AVAILABLE "1") + set(MLPACK_INCLUDE_DIRS ${MLPACK_INCLUDE_DIRS} "${STB_IMAGE_INCLUDE_DIR}") +