Skip to content

Commit

Permalink
[libfreenect2] Fix MACOS build error (#24265)
Browse files Browse the repository at this point in the history
* [libfreenect2] Fix MACOS build error

* update vcpkg.json

* update version

* Disable build example

* update version

Co-authored-by: Lily Wang <v-lilywang@microsoft.com>
  • Loading branch information
LilyWangLL and Lily Wang committed Apr 20, 2022
1 parent ac6a9dc commit 8223177
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 21 deletions.
22 changes: 22 additions & 0 deletions ports/libfreenect2/fix-macbuild.patch
Original file line number Diff line number Diff line change
@@ -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)
28 changes: 12 additions & 16 deletions ports/libfreenect2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
15 changes: 12 additions & 3 deletions ports/libfreenect2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 0 additions & 1 deletion scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3558,7 +3558,7 @@
},
"libfreenect2": {
"baseline": "0.2.0",
"port-version": 7
"port-version": 8
},
"libftdi": {
"baseline": "0.20",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libfreenect2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "ce8aefbc76e982371258202989111294d9a5221d",
"version": "0.2.0",
"port-version": 8
},
{
"git-tree": "cdedefe776984f442e8af70b0e0738d12d56fafa",
"version-string": "0.2.0",
Expand Down

0 comments on commit 8223177

Please sign in to comment.