From 72ee11d37a63f03b9941626375fbd17d8072ea9a Mon Sep 17 00:00:00 2001 From: Alex Reinking Date: Thu, 1 Jul 2021 07:24:48 -0700 Subject: [PATCH] [halide] Fix several issues with the Halide port after v12 (#18747) * Fix several issues with the Halide port after v12 1. Use vcpkg-cmake and vcpkg-cmake-config ports 2. Fix usage file to point to relevant documentation 3. Remove OpenGL feature (Halide 12 dropped support) 4. Drop VCPKG_POLICY_EMPTY_PACKAGE 5. Set new Halide packaging variables for better vcpkg compliance. * update versions --- ports/halide/portfile.cmake | 28 ++++++++++++++++------------ ports/halide/usage | 2 +- ports/halide/vcpkg.json | 13 +++++++++---- versions/baseline.json | 2 +- versions/h-/halide.json | 5 +++++ 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/ports/halide/portfile.cmake b/ports/halide/portfile.cmake index 83e8399aa58..486726c289e 100644 --- a/ports/halide/portfile.cmake +++ b/ports/halide/portfile.cmake @@ -1,10 +1,5 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) -# Halide distributes some loadable modules that belong in lib on all platforms. -# CMake defaults module DLLs into the lib folder, which is incompatible with -# vcpkg’s current policy. This sidesteps that issue, a bit bluntly. -set(VCPKG_POLICY_EMPTY_PACKAGE enabled) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO halide/Halide @@ -25,15 +20,13 @@ vcpkg_check_features( target-mips TARGET_MIPS target-nvptx TARGET_NVPTX target-opencl TARGET_OPENCL - target-opengl TARGET_OPENGL target-powerpc TARGET_POWERPC target-riscv TARGET_RISCV target-x86 TARGET_X86 ) -vcpkg_configure_cmake( +vcpkg_cmake_configure( SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA OPTIONS ${FEATURE_OPTIONS} -DWITH_DOCS=NO -DWITH_PYTHON_BINDINGS=NO @@ -42,10 +35,14 @@ vcpkg_configure_cmake( -DWITH_UTILS=NO -DCMAKE_INSTALL_LIBDIR=bin -DCMAKE_INSTALL_DATADIR=share/${PORT} - -DHALIDE_INSTALL_CMAKEDIR=share/${PORT} + -DHalide_INSTALL_CMAKEDIR=share/${PORT} + -DHalide_INSTALL_HELPERSDIR=share/HalideHelpers + -DHalide_INSTALL_PLUGINDIR=bin ) -vcpkg_install_cmake(ADD_BIN_TO_PATH) +# ADD_BIN_TO_PATH needed to compile autoschedulers, +# which use Halide.dll (and deps) during the build. +vcpkg_cmake_install(ADD_BIN_TO_PATH) vcpkg_copy_tools( TOOL_NAMES @@ -56,9 +53,16 @@ vcpkg_copy_tools( AUTO_CLEAN ) -vcpkg_copy_pdbs() +# Release mode MODULE targets in CMake don't get PDBs. +# Exclude those to avoid warning with default globs. +vcpkg_copy_pdbs( + BUILD_PATHS + "${CURRENT_PACKAGES_DIR}/bin/Halide.dll" + "${CURRENT_PACKAGES_DIR}/debug/bin/*.dll" +) -vcpkg_fixup_cmake_targets() +vcpkg_cmake_config_fixup() +vcpkg_cmake_config_fixup(PACKAGE_NAME HalideHelpers) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) diff --git a/ports/halide/usage b/ports/halide/usage index 117e243b6c0..591e497db45 100644 --- a/ports/halide/usage +++ b/ports/halide/usage @@ -11,4 +11,4 @@ The package halide provides CMake targets: target_link_libraries(main PRIVATE filter) For more information see: - https://github.com/halide/Halide/blob/v11.0.1/README_cmake.md + https://github.com/halide/Halide/blob/v12.0.1/README_cmake.md diff --git a/ports/halide/vcpkg.json b/ports/halide/vcpkg.json index c66fef61b0d..baa99449ae8 100644 --- a/ports/halide/vcpkg.json +++ b/ports/halide/vcpkg.json @@ -1,6 +1,7 @@ { "name": "halide", "version": "12.0.1", + "port-version": 1, "description": "Halide is a programming language designed to make it easier to write high-performance image and array processing code on modern machines.", "homepage": "https://github.com/halide/Halide", "supports": "!uwp", @@ -12,6 +13,14 @@ "enable-rtti", "tools" ] + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true } ], "default-features": [ @@ -82,7 +91,6 @@ "target-mips", "target-nvptx", "target-opencl", - "target-opengl", "target-powerpc", "target-riscv", "target-x86" @@ -159,9 +167,6 @@ "target-opencl": { "description": "Include OpenCL-C target" }, - "target-opengl": { - "description": "Include OpenGL/GLSL target" - }, "target-powerpc": { "description": "Include PowerPC target", "dependencies": [ diff --git a/versions/baseline.json b/versions/baseline.json index a63cc64c31e..8b8873fec91 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2458,7 +2458,7 @@ }, "halide": { "baseline": "12.0.1", - "port-version": 0 + "port-version": 1 }, "happly": { "baseline": "2021-03-19", diff --git a/versions/h-/halide.json b/versions/h-/halide.json index 9d1bf20db20..8a2628d869f 100644 --- a/versions/h-/halide.json +++ b/versions/h-/halide.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "512cb4dd40ca40afbf0c6a35f7bdc595589a0b10", + "version": "12.0.1", + "port-version": 1 + }, { "git-tree": "50e2c4835a57bb4a172c4b82b2a0e0a3077088ab", "version": "12.0.1",