From 8223177f4d0e475e4a71466ebbd4a08785d14016 Mon Sep 17 00:00:00 2001 From: LilyWangLL <94091114+LilyWangLL@users.noreply.github.com> Date: Wed, 20 Apr 2022 14:43:38 -0700 Subject: [PATCH] [libfreenect2] Fix MACOS build error (#24265) * [libfreenect2] Fix MACOS build error * update vcpkg.json * update version * Disable build example * update version Co-authored-by: Lily Wang --- ports/libfreenect2/fix-macbuild.patch | 22 +++++++++++++++++++++ ports/libfreenect2/portfile.cmake | 28 ++++++++++++--------------- ports/libfreenect2/vcpkg.json | 15 +++++++++++--- scripts/ci.baseline.txt | 1 - versions/baseline.json | 2 +- versions/l-/libfreenect2.json | 5 +++++ 6 files changed, 52 insertions(+), 21 deletions(-) create mode 100644 ports/libfreenect2/fix-macbuild.patch diff --git a/ports/libfreenect2/fix-macbuild.patch b/ports/libfreenect2/fix-macbuild.patch new file mode 100644 index 00000000000000..cb675a6690439c --- /dev/null +++ b/ports/libfreenect2/fix-macbuild.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index aedc576..4f16abc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -165,6 +165,8 @@ SET(LIBFREENECT2_DLLS + SET(HAVE_VideoToolbox "no (Apple only)") + IF(APPLE) + FIND_LIBRARY(VIDEOTOOLBOX_LIBRARY VideoToolbox) ++ FIND_LIBRARY(CF_LIBRARY CoreFoundation) ++ FIND_LIBRARY(IOK_LIBRARY IOKit) + + SET(HAVE_VideoToolbox no) + IF(VIDEOTOOLBOX_LIBRARY) +@@ -184,6 +186,8 @@ IF(APPLE) + ${COREFOUNDATION_LIBRARY} + ${COREMEDIA_LIBRARY} + ${COREVIDEO_LIBRARY} ++ ${CF_LIBRARY} ++ ${IOK_LIBRARY} + ) + ENDIF(VIDEOTOOLBOX_LIBRARY) + ENDIF(APPLE) diff --git a/ports/libfreenect2/portfile.cmake b/ports/libfreenect2/portfile.cmake index ba35cee15a7216..32ea1a6889a294 100644 --- a/ports/libfreenect2/portfile.cmake +++ b/ports/libfreenect2/portfile.cmake @@ -4,41 +4,37 @@ vcpkg_from_github( REF v0.2.0 SHA512 3525e3f21462cecd3b198f64545786ffddc2cafdfd8146e5a46f0300b83f29f1ad0739618a07ab195c276149d7e2e909f7662e2d379a2880593cac75942b0666 HEAD_REF master - PATCHES fix-dependency-libusb.patch + PATCHES + fix-dependency-libusb.patch + fix-macbuild.patch ) -file(READ ${SOURCE_PATH}/cmake_modules/FindLibUSB.cmake FINDLIBUSB) +file(READ "${SOURCE_PATH}/cmake_modules/FindLibUSB.cmake" FINDLIBUSB) string(REPLACE "(WIN32)" "(WIN32_DISABLE)" FINDLIBUSB "${FINDLIBUSB}") -file(WRITE ${SOURCE_PATH}/cmake_modules/FindLibUSB.cmake "${FINDLIBUSB}") - -file(READ ${SOURCE_PATH}/examples/CMakeLists.txt EXAMPLECMAKE) -string(REPLACE "(WIN32)" - "(WIN32_DISABLE)" EXAMPLECMAKE "${EXAMPLECMAKE}") -file(WRITE ${SOURCE_PATH}/examples/CMakeLists.txt "${EXAMPLECMAKE}") +file(WRITE "${SOURCE_PATH}/cmake_modules/FindLibUSB.cmake" "${FINDLIBUSB}") vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS opengl ENABLE_OPENGL opencl ENABLE_OPENCL ) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DENABLE_CUDA=OFF - # FEATURES + -DBUILD_EXAMPLES=OFF ${FEATURE_OPTIONS} ) -vcpkg_install_cmake() +vcpkg_cmake_install() -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/freenect2 TARGET_PATH share/freenect2) +vcpkg_cmake_config_fixup(PACKAGE_NAME freenect2 CONFIG_PATH lib/cmake/freenect2) vcpkg_copy_pdbs() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -file(INSTALL ${SOURCE_PATH}/GPL2 DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +file(INSTALL "${SOURCE_PATH}/GPL2" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) vcpkg_fixup_pkgconfig() diff --git a/ports/libfreenect2/vcpkg.json b/ports/libfreenect2/vcpkg.json index fda7d64da6ee37..fd11f7991c6029 100644 --- a/ports/libfreenect2/vcpkg.json +++ b/ports/libfreenect2/vcpkg.json @@ -1,12 +1,21 @@ { "name": "libfreenect2", - "version-string": "0.2.0", - "port-version": 7, + "version": "0.2.0", + "port-version": 8, "description": "Open source drivers for the Kinect for Windows v2 device", "homepage": "https://github.com/OpenKinect/libfreenect2", + "license": "GPL-2.0-only", "dependencies": [ "libjpeg-turbo", - "libusb" + "libusb", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } ], "default-features": [ "opengl" diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index e5a026f2bc7a3f..3dbf567ed465bc 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -496,7 +496,6 @@ libevhtp:arm-uwp=fail libexif:arm-uwp=fail libexif:x64-uwp=fail libfreenect2:arm64-windows=fail -libfreenect2:x64-osx=fail libgit2:arm-uwp=fail libgit2:x64-uwp=fail libgo:arm-uwp=fail diff --git a/versions/baseline.json b/versions/baseline.json index 7cab02a702c758..fefaa4ef44a9e3 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3558,7 +3558,7 @@ }, "libfreenect2": { "baseline": "0.2.0", - "port-version": 7 + "port-version": 8 }, "libftdi": { "baseline": "0.20", diff --git a/versions/l-/libfreenect2.json b/versions/l-/libfreenect2.json index 51d96893507f44..9313d9c6c195b2 100644 --- a/versions/l-/libfreenect2.json +++ b/versions/l-/libfreenect2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "ce8aefbc76e982371258202989111294d9a5221d", + "version": "0.2.0", + "port-version": 8 + }, { "git-tree": "cdedefe776984f442e8af70b0e0738d12d56fafa", "version-string": "0.2.0",