vcpkg/ports/openni2/portfile.cmake

220 lines
6.7 KiB
CMake
Raw Normal View History

include(vcpkg_common_functions)
2017-06-20 02:15:25 +08:00
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "Error: UWP builds are currently not supported.")
endif()
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)
2017-06-20 02:15:25 +08:00
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
2017-06-20 02:15:25 +08:00
)
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
file(COPY ${SOURCE_PATH} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
get_filename_component(SOURCE_DIR_NAME "${SOURCE_PATH}" NAME)
# Use fresh copy of sources for building and modification
set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${SOURCE_DIR_NAME}")
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)
2017-06-20 02:15:25 +08:00
# Build OpenNI2
vcpkg_build_msbuild(
PROJECT_PATH "${SOURCE_PATH}/OpenNI.sln"
OPTIONS "/p:DotNetSdkRoot=${NETFXSDK_PATH}/"
2017-06-20 02:15:25 +08:00
)
# 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")
[many ports] improvements for linux/wsl (#6730) * [many ports] improve compatibility with WSL and mixed case filesystems * [treehopper] express dependency on libusb, which was not working on non-win32 platforms and is still broken there * [libharu] add compatibility with non-win32 platforms * [geogram] fix openblas on linux [clapack] better integration with linux environment [visit-struct] put cmake config file in the expected folder [geogram] remove trailing underscore to enable compatibility with OpenBLAS * [openblas] playing with underscore, without success * [openblas/lapack] fix library integration * [clapack] improve target handling in cmake module * [openblas] promote self-generated config to default cmake module, otherwise internal ones thinks wrongly that openblas can also solve lapack libs * [clapack,openblas] improve libraries integration * [many ports] fix cmake unnecessary target paths, wrong config paths, empty default dependencies, unnecessary [core] tags * [suitesparse] improve integration with new lapack/openblas mechanism * [suitesparse] add no underscore postfix also for linux * [ceres] fix integration with newer openblas/lapack configs * [aws-c-event-stream] fix regression * [systemc] fix regression * [libwebp,geogram] trigger rebuild * [libwebp,pthread4w] fix regressions * [glbinding] fix cmake module installation * [globjects] disentangle unnecessary dependency from qt5 * [jasper] remove broken and unnecessary patches * [libwebp] fix regression * [many ports] avoid using BUILD_SHARED_LIBS which is uninitialized in port files * [clapack] correctly find dlls * [clapack] use a generic blas as dependency * [fizz,g2o] restore expected version * fix mistake * [many ports] remove WIN32, APPLE and UNIX (again, they keep creeping in) from ports since they are broken and usually break non-win32 ports * [libressl,openssl] do not try to build one if the other is already installed * [itk] update ref and patch to avoid regression * [libressl,openssl] implement full strategy to fix CI * [libwebp] disable components that are broken on macOS * [ogre] enable macOS build * [freeimage,jxrlib,ogre,openexr,protobuf] port patches from #5169 * [ogre] add missing install command * [ffmpeg] enable wrapper for cmake module * [ffmpeg] add avresample module finder * [ffmpeg] improve module detection and exported symbols * [ffmpeg] add variables to cache * [thrift] remove unnecessary build option * [allegro5] fix shared/static inversion * [protobuf] cleanup * [libressl] cleanup * [moos-core] cleanup * commented features must not be separated from other features, otherwise vcpkg complains * [itk] fix regression * [shogun,itk] fix regressions * [ogre] fix regression * [opusfile] add compatibility with non-win32 * [itk] fix regression * [sndfile,libsndfile] remove duplicate, redirect sndfile to libsndfile * add missing dependencies * [ismrmrd] fix regression * [ffmpeg] trigger rebuild * [clapack,openblas,libogg] fix regressions on macOS * [libtins] fix regression * force rebuild windows regressions, unable to reproduce locally * [mosquitto] enable non-win32 builds * [json-dto] force rebuild, unable to reproduce regression locally * [many ports] uniform naming and path length requests * fix regression * fix regression * [ffmpeg] fixes for downstream projects * clean up - thanks to reviewers * trigger rebuild of regressions on macOS * trigger rebuild of regressions on macOS - part2 * Add core back * Use VCPKG_CONCURRENCY * Add core back to suitesparse * Add core back to curl * Add core back to magnum * Add core back to magnum * Add core back to magnum * Add core back to cgal
2019-06-21 10:11:54 +08:00
set(SOURCE_CONFIG_PATH ${SOURCE_PATH}/Config)
2017-06-20 02:15:25 +08:00
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
2017-06-20 02:15:25 +08:00
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/Driver/OniDriverAPI.h"
"${SOURCE_INCLUDE_PATH}/Driver/OniDriverTypes.h"
DESTINATION
${CURRENT_PACKAGES_DIR}/include/openni2/Driver
2017-06-20 02:15:25 +08:00
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/Linux-Arm/OniPlatformLinux-Arm.h"
DESTINATION
${CURRENT_PACKAGES_DIR}/include/openni2/Linux-Arm
2017-06-20 02:15:25 +08:00
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/Linux-x86/OniPlatformLinux-x86.h"
DESTINATION
${CURRENT_PACKAGES_DIR}/include/openni2/Linux-x86
2017-06-20 02:15:25 +08:00
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/MacOSX/OniPlatformMacOSX.h"
DESTINATION
${CURRENT_PACKAGES_DIR}/include/openni2/MacOSX
2017-06-20 02:15:25 +08:00
)
file(
INSTALL
"${SOURCE_INCLUDE_PATH}/Win32/OniPlatformWin32.h"
DESTINATION
${CURRENT_PACKAGES_DIR}/include/openni2/Win32
2017-06-20 02:15:25 +08:00
)
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
2017-06-20 02:15:25 +08:00
)
file(
INSTALL
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2.lib"
DESTINATION
${CURRENT_PACKAGES_DIR}/lib
)
file(
INSTALL
"${SOURCE_BIN_PATH_DEBUG}/OpenNI2.lib"
DESTINATION
${CURRENT_PACKAGES_DIR}/debug/lib
)
file(
INSTALL
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/Kinect.dll"
2017-06-20 02:15:25 +08:00
"${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
2017-06-20 02:15:25 +08:00
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2.dll"
DESTINATION
${CURRENT_PACKAGES_DIR}/bin
)
file(
INSTALL
"${SOURCE_BIN_PATH_DEBUG}/OpenNI2/Drivers/Kinect.dll"
2017-06-20 02:15:25 +08:00
"${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
)
file(
INSTALL
"${SOURCE_CONFIG_PATH}/OpenNI.ini"
DESTINATION
${CURRENT_PACKAGES_DIR}/debug/bin/OpenNI2
)
file(
INSTALL
2017-06-20 02:15:25 +08:00
"${SOURCE_BIN_PATH_DEBUG}/OpenNI2.dll"
DESTINATION
${CURRENT_PACKAGES_DIR}/debug/bin
)
file(
INSTALL
"${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/Kinect.dll"
2017-06-20 02:15:25 +08:00
"${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
2017-06-20 02:15:25 +08:00
)
# Deploy Script
file(COPY ${CMAKE_CURRENT_LIST_DIR}/openni2deploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/bin/OpenNI2)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/openni2deploy.ps1 DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin/OpenNI2)
2017-06-20 02:15:25 +08:00
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openni2)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/openni2/LICENSE ${CURRENT_PACKAGES_DIR}/share/openni2/copyright)