Skip to content

Commit

Permalink
[kinectsdk1][kinectsdk2] Add Config.cmake.in (#24877)
Browse files Browse the repository at this point in the history
* [kinectsdk1, kinectsdk2] Add Config.cmake.in

* change version-string to version

* x-add-version

* update supports

* x-add-version

* [kinectsdk1][kinectsdk2] Switch to lessmsi

Co-authored-by: Lily Wang <v-lilywang@microsoft.com>
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
  • Loading branch information
3 people authored May 24, 2022
1 parent c40e73f commit 93b3854
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 59 deletions.
33 changes: 33 additions & 0 deletions ports/kinectsdk1/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

get_filename_component(_kinectsdk1_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_kinectsdk1_root "${_kinectsdk1_root}" PATH)
get_filename_component(_kinectsdk1_root "${_kinectsdk1_root}" PATH)

set(_kinectsdk1_rel_lib "${_kinectsdk1_root}/lib/Kinect10.lib")
set(_kinectsdk1_dbg_lib "${_kinectsdk1_root}/debug/lib/Kinect10.lib")
if (EXISTS "${_kinectsdk1_rel_lib}" OR EXISTS "${_kinectsdk1_dbg_lib}")

add_library(unofficial::kinectsdk1::kinectsdk1 INTERFACE IMPORTED)
set_target_properties(unofficial::kinectsdk1::kinectsdk1 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_kinectsdk1_root}/include")

if (EXISTS "${_kinectsdk1_rel_lib}")
set_target_properties(unofficial::kinectsdk1::kinectsdk1
PROPERTIES IMPORTED_LOCATION_RELEASE "${_kinectsdk1_rel_lib}")
set_property(TARGET unofficial::kinectsdk1::kinectsdk1 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
endif()
if (EXISTS "${_kinectsdk1_dbg_lib}")
set_target_properties(unofficial::kinectsdk1::kinectsdk1
PROPERTIES IMPORTED_LOCATION_DEBUG "${_kinectsdk1_dbg_lib}")
set_property(TARGET unofficial::kinectsdk1::kinectsdk1 APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
endif()

else()

set(kinectsdk1_FOUND FALSE)

endif()

unset(_kinectsdk1_rel_lib)
unset(_kinectsdk1_dbg_lib)

unset(_kinectsdk1_root)
50 changes: 26 additions & 24 deletions ports/kinectsdk1/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
set(KINECTSDK10_VERSION "v1.8")

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(ARCHITECTURE x86)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(ARCHITECTURE amd64)
else()
message(FATAL_ERROR "This port does not currently support architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()

vcpkg_download_distfile(KINECTSDK10_INSTALLER
URLS "https://download.microsoft.com/download/E/1/D/E1DEC243-0389-4A23-87BF-F47DE869FC1A/KinectSDK-${KINECTSDK10_VERSION}-Setup.exe"
FILENAME "KinectSDK-${KINECTSDK10_VERSION}-Setup.exe"
Expand All @@ -10,23 +19,22 @@ vcpkg_find_acquire_program(DARK)
set(KINECTSDK10_WIX_INSTALLER "${KINECTSDK10_INSTALLER}")
set(KINECTSDK10_WIX_EXTRACT_DIR "${CURRENT_BUILDTREES_DIR}/src/installer/wix")
vcpkg_execute_required_process(
COMMAND ${DARK} -x ${KINECTSDK10_WIX_EXTRACT_DIR} ${KINECTSDK10_WIX_INSTALLER}
COMMAND "${DARK}" -x "${KINECTSDK10_WIX_EXTRACT_DIR}" "${KINECTSDK10_WIX_INSTALLER}"
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME extract_wix_installer
LOGNAME extract-wix-${TARGET_TRIPLET}
)

file(TO_NATIVE_PATH "${KINECTSDK10_WIX_EXTRACT_DIR}/AttachedContainer/KinectSDK-${KINECTSDK10_VERSION}-${VCPKG_TARGET_ARCHITECTURE}.msi" KINECTSDK10_MSI_INSTALLER)
file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/src/installer/msi/${VCPKG_TARGET_ARCHITECTURE}" KINECTSDK10_MSI_EXTRACT_DIR)
file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/msiexec.log" MSIEXEC_LOG_PATH)
set(BATCH_FILE ${CURRENT_BUILDTREES_DIR}/msiextract-msmpi.bat)
file(WRITE ${BATCH_FILE} "msiexec.exe /a \"${KINECTSDK10_MSI_INSTALLER}\" /qn /log \"${MSIEXEC_LOG_PATH}\" TARGETDIR=\"${KINECTSDK10_MSI_EXTRACT_DIR}\"")
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/src/KinectSDK-${KINECTSDK10_VERSION}-${VCPKG_TARGET_ARCHITECTURE}")
set(KINECTSDK10_MSI_INSTALLER "installer\\wix\\AttachedContainer\\KinectSDK-${KINECTSDK10_VERSION}-${VCPKG_TARGET_ARCHITECTURE}.msi")
vcpkg_execute_required_process(
COMMAND ${BATCH_FILE}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME extract_msi_installer_${VCPKG_TARGET_ARCHITECTURE}
COMMAND
"${CURRENT_HOST_INSTALLED_DIR}/tools/vcpkg-tool-lessmsi/lessmsi.exe"
x
"${KINECTSDK10_MSI_INSTALLER}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src"
LOGNAME extract-msi-${TARGET_TRIPLET}
)

set(KINECTSDK10_DIR "${CURRENT_BUILDTREES_DIR}/src/installer/msi/${VCPKG_TARGET_ARCHITECTURE}/Microsoft SDKs/Kinect/${KINECTSDK10_VERSION}")
set(KINECTSDK10_DIR "${CURRENT_BUILDTREES_DIR}/src/KinectSDK-${KINECTSDK10_VERSION}-${VCPKG_TARGET_ARCHITECTURE}/SourceDir/Microsoft SDKs/Kinect/${KINECTSDK10_VERSION}")

file(
INSTALL
Expand All @@ -35,30 +43,24 @@ file(
"${KINECTSDK10_DIR}/inc/NuiSensor.h"
"${KINECTSDK10_DIR}/inc/NuiSkeleton.h"
DESTINATION
${CURRENT_PACKAGES_DIR}/include
"${CURRENT_PACKAGES_DIR}/include"
)

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(ARCHITECTURE x86)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(ARCHITECTURE amd64)
else()
message(FATAL_ERROR "This port does not currently support architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()

file(
INSTALL
"${KINECTSDK10_DIR}/lib/${ARCHITECTURE}/Kinect10.lib"
DESTINATION
${CURRENT_PACKAGES_DIR}/lib
"${CURRENT_PACKAGES_DIR}/lib"
)

file(
INSTALL
"${KINECTSDK10_DIR}/lib/${ARCHITECTURE}/Kinect10.lib"
DESTINATION
${CURRENT_PACKAGES_DIR}/debug/lib
"${CURRENT_PACKAGES_DIR}/debug/lib"
)

configure_file("${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake" @ONLY)

# Handle copyright
file(INSTALL ${KINECTSDK10_DIR}/SDKEula.rtf DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${KINECTSDK10_DIR}/SDKEula.rtf" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
11 changes: 9 additions & 2 deletions ports/kinectsdk1/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"name": "kinectsdk1",
"version": "1.8",
"port-version": 4,
"port-version": 5,
"description": "Kinect for Windows SDK for Kinect v1 sensor.",
"supports": "!arm"
"license": null,
"supports": "!arm & windows",
"dependencies": [
{
"name": "vcpkg-tool-lessmsi",
"host": true
}
]
}
33 changes: 33 additions & 0 deletions ports/kinectsdk2/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

get_filename_component(_kinectsdk2_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_kinectsdk2_root "${_kinectsdk2_root}" PATH)
get_filename_component(_kinectsdk2_root "${_kinectsdk2_root}" PATH)

set(_kinectsdk2_rel_lib "${_kinectsdk2_root}/lib/Kinect20.lib")
set(_kinectsdk2_dbg_lib "${_kinectsdk2_root}/debug/lib/Kinect20.lib")
if (EXISTS "${_kinectsdk2_rel_lib}" OR EXISTS "${_kinectsdk2_dbg_lib}")

add_library(unofficial::kinectsdk2::kinectsdk2 INTERFACE IMPORTED)
set_target_properties(unofficial::kinectsdk2::kinectsdk2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_kinectsdk2_root}/include")

if (EXISTS "${_kinectsdk2_rel_lib}")
set_target_properties(unofficial::kinectsdk2::kinectsdk2
PROPERTIES IMPORTED_LOCATION_RELEASE "${_kinectsdk2_rel_lib}")
set_property(TARGET unofficial::kinectsdk2::kinectsdk2 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
endif()
if (EXISTS "${_kinectsdk2_dbg_lib}")
set_target_properties(unofficial::kinectsdk2::kinectsdk2
PROPERTIES IMPORTED_LOCATION_DEBUG "${_kinectsdk2_dbg_lib}")
set_property(TARGET unofficial::kinectsdk2::kinectsdk2 APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
endif()

else()

set(kinectsdk2_FOUND FALSE)

endif()

unset(_kinectsdk2_rel_lib)
unset(_kinectsdk2_dbg_lib)

unset(_kinectsdk2_root)
36 changes: 16 additions & 20 deletions ports/kinectsdk2/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
vcpkg_buildpath_length_warning(37)

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
message(FATAL_ERROR "This port does not currently support architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()

set(KINECTSDK20_VERSION "v2.0_1409")
vcpkg_download_distfile(KINECTSDK20_INSTALLER
URLS "https://download.microsoft.com/download/F/2/D/F2D1012E-3BC6-49C5-B8B3-5ACFF58AF7B8/KinectSDK-${KINECTSDK20_VERSION}-Setup.exe"
Expand All @@ -18,43 +14,43 @@ set(KINECTSDK20_WIX_EXTRACT_DIR "${CURRENT_BUILDTREES_DIR}/src/installer/wix")
vcpkg_execute_required_process(
COMMAND ${DARK} -x ${KINECTSDK20_WIX_EXTRACT_DIR} ${KINECTSDK20_WIX_INSTALLER}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME extract_wix_installer
LOGNAME extract-wix-${TARGET_TRIPLET}
)

file(TO_NATIVE_PATH "${KINECTSDK20_WIX_EXTRACT_DIR}/AttachedContainer/KinectSDK-${KINECTSDK20_VERSION}-x64.msi" KINECTSDK20_MSI_INSTALLER)
file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/src/installer/msi" KINECTSDK20_MSI_EXTRACT_DIR)
file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/msiexec.log" MSIEXEC_LOG_PATH)
set(BATCH_FILE ${CURRENT_BUILDTREES_DIR}/msiextract-msmpi.bat)
file(WRITE ${BATCH_FILE} "msiexec.exe /a \"${KINECTSDK20_MSI_INSTALLER}\" /qn /log \"${MSIEXEC_LOG_PATH}\" TARGETDIR=\"${KINECTSDK20_MSI_EXTRACT_DIR}\"")
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/src/KinectSDK-${KINECTSDK20_VERSION}-x64")
set(KINECTSDK20_MSI_INSTALLER "installer\\wix\\AttachedContainer\\KinectSDK-${KINECTSDK20_VERSION}-x64.msi")
vcpkg_execute_required_process(
COMMAND ${BATCH_FILE}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME extract_msi_installer
COMMAND
"${CURRENT_HOST_INSTALLED_DIR}/tools/vcpkg-tool-lessmsi/lessmsi.exe"
x
"${KINECTSDK20_MSI_INSTALLER}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src"
LOGNAME extract-msi-${TARGET_TRIPLET}
)

set(KINECTSDK20_DIR "${CURRENT_BUILDTREES_DIR}/src/installer/msi/Microsoft SDKs/Kinect/${KINECTSDK20_VERSION}")
set(KINECTSDK20_DIR "${CURRENT_BUILDTREES_DIR}/src/KinectSDK-${KINECTSDK20_VERSION}-x64/SourceDir/Microsoft SDKs/Kinect/${KINECTSDK20_VERSION}")

file(
INSTALL
"${KINECTSDK20_DIR}/inc/"
DESTINATION
${CURRENT_PACKAGES_DIR}/include
"${CURRENT_PACKAGES_DIR}/include"
)

file(
INSTALL
"${KINECTSDK20_DIR}/Lib/${VCPKG_TARGET_ARCHITECTURE}/Kinect20.lib"
DESTINATION
${CURRENT_PACKAGES_DIR}/lib
"${CURRENT_PACKAGES_DIR}/lib"
)

file(
INSTALL
"${KINECTSDK20_DIR}/Lib/${VCPKG_TARGET_ARCHITECTURE}/Kinect20.lib"
DESTINATION
${CURRENT_PACKAGES_DIR}/debug/lib
"${CURRENT_PACKAGES_DIR}/debug/lib"
)

configure_file("${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake" @ONLY)

# Handle copyright
file(COPY "${KINECTSDK20_DIR}/SDKEula.rtf" DESTINATION ${CURRENT_PACKAGES_DIR}/share/kinectsdk2)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/kinectsdk2/SDKEula.rtf ${CURRENT_PACKAGES_DIR}/share/kinectsdk2/copyright)
file(INSTALL "${KINECTSDK20_DIR}/SDKEula.rtf" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
13 changes: 10 additions & 3 deletions ports/kinectsdk2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"name": "kinectsdk2",
"version-string": "2.0",
"port-version": 3,
"version": "2.0",
"port-version": 4,
"description": "Kinect for Windows SDK for Kinect v2 sensor.",
"supports": "!arm"
"license": null,
"supports": "!arm & windows",
"dependencies": [
{
"name": "vcpkg-tool-lessmsi",
"host": true
}
]
}
8 changes: 0 additions & 8 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,6 @@ jinja2cpplight:x64-uwp=fail
kfr:arm64-windows=fail
kfr:arm-uwp=fail
kfr:x64-linux=fail
kinectsdk1:arm64-windows=fail
kinectsdk1:arm-uwp=fail
kinectsdk1:x64-linux=fail
kinectsdk1:x64-osx=fail
kinectsdk2:arm64-windows=fail
kinectsdk2:arm-uwp=fail
kinectsdk2:x64-linux=fail
kinectsdk2:x64-osx=fail
lastools:arm-uwp=fail
lastools:x64-uwp=fail
laszip:arm-uwp=fail
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3278,11 +3278,11 @@
},
"kinectsdk1": {
"baseline": "1.8",
"port-version": 4
"port-version": 5
},
"kinectsdk2": {
"baseline": "2.0",
"port-version": 3
"port-version": 4
},
"kissfft": {
"baseline": "2021-11-14",
Expand Down
5 changes: 5 additions & 0 deletions versions/k-/kinectsdk1.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "688e49039e9c86fcb57c431b527a7f125a996857",
"version": "1.8",
"port-version": 5
},
{
"git-tree": "d49f0532a6e9776666ef3960a9b267f32ff3cfc4",
"version": "1.8",
Expand Down
5 changes: 5 additions & 0 deletions versions/k-/kinectsdk2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2fc9568898ab7f14edea8ffb65da87161c9c0b6c",
"version": "2.0",
"port-version": 4
},
{
"git-tree": "a0a13df11c972355370eef866bd266e2ae7c90d5",
"version-string": "2.0",
Expand Down

0 comments on commit 93b3854

Please sign in to comment.