vcpkg/ports/openni2/portfile.cmake
Billy O'Neal ae76307e4b
Audit use of TO_NATIVE_PATH. (#26201)
* Audit use of TO_NATIVE_PATH.

TO_NATIVE_PATH should only be used when (1) pasting a path into a command line, or (2) displaying a path to a user. It must not be used before calling other CMake operations like file(WRITE.

Fixes https://github.com/microsoft/vcpkg/issues/26178

ports/ffmpeg/portfile.cmake:
Both uses are being embedded into a command line 

ports/gdal/dependency_win.cmake
117: This used TO_NATIVE_PATH but didn't actually connect the result. It's going on a command line so TO_NATIVE_PATH is appropriate.
Drive by: Added quotes around other uses (all of which seem to be going to command lines).
202: ${EXPAT_LIBRARY_REL} ${ZLIB_LIBRARY_REL} don't seem to be set even though they are used; I think this is wrong but I don't know for sure that it is so I'm leaving it alone for now.

ports/msmpi/portfile.cmake
All 3 uses are being embedded into a command line 

ports/jemalloc/fix-utilities.patch
ports/libproxy/fix-dependency-libmodman.patch
ports/qtbase/env.patch
These are in upstream content / context so it is not edited.

ports/opengl/portfile.cmake
Broken! Drive by fixes:
* Modernized checking VCPKG_BUILD_TYPE
* Ordered things consistently to be release then debug.
* Removed funny newlines.

ports/openni2/portfile.cmake
Borderline OK; it goes into an MSBuild / vcxproj. I'm leaving it alone. Drive by fixes:
* Guarded debug-only copies for VCPKG_BUILD_TYPE
* Fixed supports expression

ports/openssl/unix/CMakeLists.txt:
Unused!

ports/pthreads/portfile.cmake:
Both uses are being embedded into a command line 

ports/qt5-base/cmake/qt_fix_makefile_install.cmake
I'm not sure if this one is OK but it's being embedded into a file so it's probably fine.

ports/qtapplicationmanager/portfile.cmake:
I'm pretty sure this one is wrong, but it's guarded by VCPKG_TARGET_IS_WINDOWS so the ability to create damage is limited.

ports/readosm/portfile.cmake:
The use is being embedded into a command line 

ports/spatialite-tools/portfile.cmake:
The use is being embedded into a command line 

ports/sqlcipher/portfile.cmake:
Both uses are being embedded into a command line 

scripts/ports.cmake:
Some uses were unused, others are immediately used and printed to the console. 

scripts/buildsystems/vcpkg.cmake:
Fixed :)

scripts/cmake/vcpkg_build_qmake:
Looks unused.

scripts/cmake/vcpkg_build_process.cmake:
Added to console message only. 

scripts/cmake/vcpkg_execute_required_process_repeat.cmake:
Added to console message only. 
Drive by: Fixed typo in variable name in the message.

scripts/cmake/vcpkg_execute_required_process.cmake:
Added to console message only. 

* Fix missing license.
2022-08-12 15:21:20 -07:00

213 lines
6.2 KiB
CMake

find_path(COR_H_PATH cor.h)
if(COR_H_PATH MATCHES "NOTFOUND")
message(FATAL_ERROR "Could not find <cor.h>. Ensure the NETFXSDK is installed.")
endif()
get_filename_component(NETFXSDK_PATH "${COR_H_PATH}/../.." ABSOLUTE)
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO OpenNI/OpenNI2
REF 2.2-beta2
SHA512 60a3a3043679f3069aea869e92dc5881328ce4393d4140ea8d089027321ac501ae27d283657214e2834d216d0d49bf4f29a4b3d3e43df27a6ed21f889cd0083f
HEAD_REF master
PATCHES upgrade_projects.patch
inherit_from_parent_or_project_defaults.patch
replace_environment_variable.patch
)
file(TO_NATIVE_PATH ${CURRENT_INSTALLED_DIR} NATIVE_INSTALLED_DIR)
configure_file("${SOURCE_PATH}/Source/Drivers/Kinect/Kinect.vcxproj" "${SOURCE_PATH}/Source/Drivers/Kinect/Kinect.vcxproj" @ONLY)
# Build OpenNI2
vcpkg_build_msbuild(
PROJECT_PATH "${SOURCE_PATH}/OpenNI.sln"
OPTIONS "/p:DotNetSdkRoot=${NETFXSDK_PATH}/"
)
# Install OpenNI2
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(PLATFORM Win32)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(PLATFORM x64)
endif()
set(SOURCE_INCLUDE_PATH "${SOURCE_PATH}/Include")
set(SOURCE_BIN_PATH_RELEASE "${SOURCE_PATH}/Bin/${PLATFORM}-Release")
set(SOURCE_BIN_PATH_DEBUG "${SOURCE_PATH}/Bin/${PLATFORM}-Debug")
set(SOURCE_CONFIG_PATH "${SOURCE_PATH}/Config")
set(SOURCE_THIRDPARTY_PATH "${SOURCE_PATH}/ThirdParty")
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/Android-Arm/OniPlatformAndroid-Arm.h"
DESTINATION
"${CURRENT_PACKAGES_DIR}/include/openni2/Android-Arm"
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/Driver/OniDriverAPI.h"
"${SOURCE_INCLUDE_PATH}/Driver/OniDriverTypes.h"
DESTINATION
"${CURRENT_PACKAGES_DIR}/include/openni2/Driver"
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/Linux-Arm/OniPlatformLinux-Arm.h"
DESTINATION
"${CURRENT_PACKAGES_DIR}/include/openni2/Linux-Arm"
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/Linux-x86/OniPlatformLinux-x86.h"
DESTINATION
"${CURRENT_PACKAGES_DIR}/include/openni2/Linux-x86"
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/MacOSX/OniPlatformMacOSX.h"
DESTINATION
"${CURRENT_PACKAGES_DIR}/include/openni2/MacOSX"
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/Win32/OniPlatformWin32.h"
DESTINATION
"${CURRENT_PACKAGES_DIR}/include/openni2/Win32"
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/OniCAPI.h"
"${SOURCE_INCLUDE_PATH}/OniCEnums.h"
"${SOURCE_INCLUDE_PATH}/OniCProperties.h"
"${SOURCE_INCLUDE_PATH}/OniCTypes.h"
"${SOURCE_INCLUDE_PATH}/OniEnums.h"
"${SOURCE_INCLUDE_PATH}/OniPlatform.h"
"${SOURCE_INCLUDE_PATH}/OniProperties.h"
"${SOURCE_INCLUDE_PATH}/OniVersion.h"
"${SOURCE_INCLUDE_PATH}/OpenNI.h"
"${SOURCE_INCLUDE_PATH}/PrimeSense.h"
"${SOURCE_INCLUDE_PATH}/PS1080.h"
"${SOURCE_INCLUDE_PATH}/PSLink.h"
DESTINATION
"${CURRENT_PACKAGES_DIR}/include/openni2"
)
file(
INSTALL
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2.lib"
DESTINATION
"${CURRENT_PACKAGES_DIR}/lib"
)
if(NOT VCPKG_BUILD_TYPE)
file(
INSTALL
"${SOURCE_BIN_PATH_DEBUG}/OpenNI2.lib"
DESTINATION
"${CURRENT_PACKAGES_DIR}/debug/lib"
)
endif()
file(
INSTALL
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/Kinect.dll"
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/OniFile.dll"
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/PS1080.dll"
"${SOURCE_CONFIG_PATH}/OpenNI2/Drivers/PS1080.ini"
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/PSLink.dll"
"${SOURCE_CONFIG_PATH}/OpenNI2/Drivers/PSLink.ini"
DESTINATION
"${CURRENT_PACKAGES_DIR}/bin/OpenNI2/Drivers"
)
file(
INSTALL
"${SOURCE_CONFIG_PATH}/OpenNI.ini"
DESTINATION
"${CURRENT_PACKAGES_DIR}/bin/OpenNI2"
)
file(
INSTALL
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2.dll"
DESTINATION
"${CURRENT_PACKAGES_DIR}/bin"
)
if(NOT VCPKG_BUILD_TYPE)
file(
INSTALL
"${SOURCE_BIN_PATH_DEBUG}/OpenNI2/Drivers/Kinect.dll"
"${SOURCE_BIN_PATH_DEBUG}/OpenNI2/Drivers/OniFile.dll"
"${SOURCE_BIN_PATH_DEBUG}/OpenNI2/Drivers/PS1080.dll"
"${SOURCE_CONFIG_PATH}/OpenNI2/Drivers/PS1080.ini"
"${SOURCE_BIN_PATH_DEBUG}/OpenNI2/Drivers/PSLink.dll"
"${SOURCE_CONFIG_PATH}/OpenNI2/Drivers/PSLink.ini"
DESTINATION
"${CURRENT_PACKAGES_DIR}/debug/bin/OpenNI2/Drivers"
)
endif()
file(
INSTALL
"${SOURCE_CONFIG_PATH}/OpenNI.ini"
DESTINATION
"${CURRENT_PACKAGES_DIR}/debug/bin/OpenNI2"
)
if(NOT VCPKG_BUILD_TYPE)
file(
INSTALL
"${SOURCE_BIN_PATH_DEBUG}/OpenNI2.dll"
DESTINATION
"${CURRENT_PACKAGES_DIR}/debug/bin"
)
endif()
file(
INSTALL
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/Kinect.dll"
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/OniFile.dll"
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/PS1080.dll"
"${SOURCE_CONFIG_PATH}/OpenNI2/Drivers/PS1080.ini"
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/PSLink.dll"
"${SOURCE_CONFIG_PATH}/OpenNI2/Drivers/PSLink.ini"
DESTINATION
"${CURRENT_PACKAGES_DIR}/tools/openni2/OpenNI2/Drivers"
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(NUMBEROFBIT 32)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(NUMBEROFBIT 64)
endif()
file(
INSTALL
"${SOURCE_THIRDPARTY_PATH}/GL/glut${NUMBEROFBIT}.dll"
"${SOURCE_BIN_PATH_RELEASE}/NiViewer.exe"
"${SOURCE_CONFIG_PATH}/OpenNI.ini"
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2.dll"
"${SOURCE_BIN_PATH_RELEASE}/PS1080Console.exe"
"${SOURCE_BIN_PATH_RELEASE}/PSLinkConsole.exe"
DESTINATION
"${CURRENT_PACKAGES_DIR}/tools/openni2"
)
# Deploy Script
file(COPY "${CMAKE_CURRENT_LIST_DIR}/openni2deploy.ps1" DESTINATION "${CURRENT_PACKAGES_DIR}/bin/OpenNI2")
if(NOT VCPKG_BUILD_TYPE)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/openni2deploy.ps1" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin/OpenNI2")
endif()
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)