vcpkg/ports/openvr/portfile.cmake

55 lines
2.1 KiB
CMake
Raw Normal View History

2017-02-09 16:33:02 +08:00
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
include(vcpkg_common_functions)
2017-07-28 12:17:34 +08:00
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openvr-1.0.9)
2017-02-09 16:33:02 +08:00
vcpkg_download_distfile(ARCHIVE
2017-07-28 12:17:34 +08:00
URLS "https://github.com/ValveSoftware/openvr/archive/v1.0.9.zip"
FILENAME "openvr-v1.0.9.zip"
SHA512 969cf6bf94802553bb4f1e5d6a2348566847b3d60efee9d8f83233d1d85e44a870e388028be956950d4f8ecb79f8e0bcf0a6b987b0ab3083060ece5ea48b8fa7
2017-02-09 16:33:02 +08:00
)
vcpkg_extract_source_archive(${ARCHIVE})
set(VCPKG_LIBRARY_LINKAGE dynamic)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(ARCH_PATH "win64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(ARCH_PATH "win32")
else()
message(FATAL_ERROR "Package only supports x64 and x86 windows.")
endif()
if(VCPKG_CMAKE_SYSTEM_NAME)
message(FATAL_ERROR "Package only supports windows desktop.")
endif()
file(MAKE_DIRECTORY
${CURRENT_PACKAGES_DIR}/lib
${CURRENT_PACKAGES_DIR}/bin
${CURRENT_PACKAGES_DIR}/debug/lib
${CURRENT_PACKAGES_DIR}/debug/bin
)
file(COPY ${SOURCE_PATH}/lib/${ARCH_PATH}/openvr_api.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(COPY ${SOURCE_PATH}/lib/${ARCH_PATH}/openvr_api.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY
${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.dll
${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
)
file(COPY
${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.dll
${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
)
file(COPY ${SOURCE_PATH}/headers DESTINATION ${CURRENT_PACKAGES_DIR})
file(RENAME ${CURRENT_PACKAGES_DIR}/headers ${CURRENT_PACKAGES_DIR}/include)
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openvr)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/openvr/LICENSE ${CURRENT_PACKAGES_DIR}/share/openvr/copyright)