diff --git a/ports/abseil/CMakeLists.txt b/ports/abseil/CMakeLists.txt new file mode 100644 index 0000000000..34b69817a3 --- /dev/null +++ b/ports/abseil/CMakeLists.txt @@ -0,0 +1,77 @@ +cmake_minimum_required(VERSION 3.8) +project(abseil CXX) + +add_definitions(-DNOMINMAX) + +set(CMAKE_DEBUG_POSTFIX d) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +option(INSTALL_HEADERS "Install header files" ON) + +function(add_sublibrary LIB) + file(GLOB_RECURSE SOURCES "absl/${LIB}/*.cc") + list(FILTER SOURCES EXCLUDE REGEX "_test") + file(GLOB HEADERS "absl/${LIB}/*.h") + file(GLOB INTERNAL_HEADERS "absl/${LIB}/internal/*.h") + + if(SOURCES) + add_library(${LIB} ${SOURCES}) + set_target_properties(${LIB} PROPERTIES OUTPUT_NAME "absl_${LIB}") + target_include_directories(${LIB} PUBLIC $ $) + else() + add_library(${LIB} INTERFACE) + target_include_directories(${LIB} INTERFACE $ $) + endif() + + + install(TARGETS ${LIB} EXPORT unofficial-abseil-targets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) + + if(INSTALL_HEADERS) + if(HEADERS) + install(FILES ${HEADERS} DESTINATION "include/absl/${LIB}") + endif() + if(INTERNAL_HEADERS) + install(FILES ${INTERNAL_HEADERS} DESTINATION "include/absl/${LIB}/internal") + endif() + endif() +endfunction() + +function(target_link_public_libraries A) + get_target_property(A_TYPE ${A} TYPE) + if(A_TYPE STREQUAL INTERFACE_LIBRARY) + target_link_libraries(${A} INTERFACE ${ARGN}) + else() + target_link_libraries(${A} PUBLIC ${ARGN}) + endif() +endfunction() + +add_sublibrary(base) +add_sublibrary(meta) +add_sublibrary(algorithm) +add_sublibrary(container) +add_sublibrary(memory) +add_sublibrary(strings) +add_sublibrary(debugging) +add_sublibrary(numeric) +add_sublibrary(types) +add_sublibrary(utility) + +target_link_public_libraries(algorithm base meta) +target_link_public_libraries(container algorithm base memory) +target_link_public_libraries(memory meta) +target_link_public_libraries(meta base) +target_link_public_libraries(numeric base) +target_link_public_libraries(strings base memory meta numeric) +target_link_public_libraries(types base utility meta algorithm strings) +target_link_public_libraries(utility base meta) + +install( + EXPORT unofficial-abseil-targets + FILE unofficial-abseil-config.cmake + NAMESPACE unofficial::abseil:: + DESTINATION share/unofficial-abseil +) \ No newline at end of file diff --git a/ports/abseil/CONTROL b/ports/abseil/CONTROL new file mode 100644 index 0000000000..fb37a8caed --- /dev/null +++ b/ports/abseil/CONTROL @@ -0,0 +1,6 @@ +Source: abseil +Version: 2017-09-28 +Description: an open-source collection designed to augment the C++ standard library. + Abseil is an open-source collection of C++ library code designed to augment the C++ standard library. The Abseil library code is collected from Google's own C++ code base, has been extensively tested and used in production, and is the same code we depend on in our daily coding lives. + In some cases, Abseil provides pieces missing from the C++ standard; in others, Abseil provides alternatives to the standard for special needs we've found through usage in the Google code base. We denote those cases clearly within the library code we provide you. + Abseil is not meant to be a competitor to the standard library; we've just found that many of these utilities serve a purpose within our code base, and we now want to provide those resources to the C++ community as a whole. diff --git a/ports/abseil/fix-intrin.patch b/ports/abseil/fix-intrin.patch new file mode 100644 index 0000000000..285adde0f2 --- /dev/null +++ b/ports/abseil/fix-intrin.patch @@ -0,0 +1,12 @@ +diff --git a/absl/base/optimization.h b/absl/base/optimization.h +index db8beaf..aaaffa4 100644 +--- a/absl/base/optimization.h ++++ b/absl/base/optimization.h +@@ -46,6 +46,7 @@ + // GCC will not tail call given inline volatile assembly. + #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("") + #elif defined(_MSC_VER) ++#include + // The __nop() intrinsic blocks the optimisation. + #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __nop() + #else diff --git a/ports/abseil/portfile.cmake b/ports/abseil/portfile.cmake new file mode 100644 index 0000000000..8c9e81aa37 --- /dev/null +++ b/ports/abseil/portfile.cmake @@ -0,0 +1,38 @@ +include(vcpkg_common_functions) + +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "Abseil currently only supports being built for desktop") +endif() + +message("NOTE: THIS PORT IS USING AN UNOFFICIAL BUILDSYSTEM. THE BINARY LAYOUT AND CMAKE INTEGRATION WILL CHANGE IN THE FUTURE.") +message("To use from cmake:\n find_package(unofficial-abseil REQUIRED)\n link_libraries(unofficial::abseil::strings)") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO abseil/abseil-cpp + REF cdf20caa491f59c0a35a8d8fbec0d948e4bc7e4c + SHA512 04889e7804b644821d0bf5d1b13f15a072e748bf0465442c64528e014c71f415544e9146c9518f9fe7bb14a295b18f293c3f7b672f6a51dba9909f3b74667fae + HEAD_REF master +) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-intrin.patch" +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG -DINSTALL_HEADERS=OFF +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-abseil) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/abseil ${CURRENT_PACKAGES_DIR}/share/unofficial-abseil) + +vcpkg_copy_pdbs() + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/abseil RENAME copyright) diff --git a/ports/enet/CMakeLists.txt b/ports/enet/CMakeLists.txt new file mode 100644 index 0000000000..012e21d645 --- /dev/null +++ b/ports/enet/CMakeLists.txt @@ -0,0 +1,81 @@ +cmake_minimum_required(VERSION 2.6) + +project(enet) + +# The "configure" step. +include(CheckFunctionExists) +include(CheckStructHasMember) +include(CheckTypeSize) +check_function_exists("fcntl" HAS_FCNTL) +check_function_exists("poll" HAS_POLL) +check_function_exists("getaddrinfo" HAS_GETADDRINFO) +check_function_exists("getnameinfo" HAS_GETNAMEINFO) +check_function_exists("gethostbyname_r" HAS_GETHOSTBYNAME_R) +check_function_exists("gethostbyaddr_r" HAS_GETHOSTBYADDR_R) +check_function_exists("inet_pton" HAS_INET_PTON) +check_function_exists("inet_ntop" HAS_INET_NTOP) +check_struct_has_member("struct msghdr" "msg_flags" "sys/types.h;sys/socket.h" HAS_MSGHDR_FLAGS) +set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h" "sys/socket.h") +check_type_size("socklen_t" HAS_SOCKLEN_T BUILTIN_TYPES_ONLY) +unset(CMAKE_EXTRA_INCLUDE_FILES) +if(MSVC) + add_definitions(-W3) +else() + add_definitions(-Wno-error) +endif() + +if(HAS_FCNTL) + add_definitions(-DHAS_FCNTL=1) +endif() +if(HAS_POLL) + add_definitions(-DHAS_POLL=1) +endif() +if(HAS_GETNAMEINFO) + add_definitions(-DHAS_GETNAMEINFO=1) +endif() +if(HAS_GETADDRINFO) + add_definitions(-DHAS_GETADDRINFO=1) +endif() +if(HAS_GETHOSTBYNAME_R) + add_definitions(-DHAS_GETHOSTBYNAME_R=1) +endif() +if(HAS_GETHOSTBYADDR_R) + add_definitions(-DHAS_GETHOSTBYADDR_R=1) +endif() +if(HAS_INET_PTON) + add_definitions(-DHAS_INET_PTON=1) +endif() +if(HAS_INET_NTOP) + add_definitions(-DHAS_INET_NTOP=1) +endif() +if(HAS_MSGHDR_FLAGS) + add_definitions(-DHAS_MSGHDR_FLAGS=1) +endif() +if(HAS_SOCKLEN_T) + add_definitions(-DHAS_SOCKLEN_T=1) +endif() + +include_directories(${PROJECT_SOURCE_DIR}/include) + +add_library(enet STATIC + callbacks.c + compress.c + host.c + list.c + packet.c + peer.c + protocol.c + unix.c + win32.c + ) + +if (WIN32) + target_link_libraries(enet winmm ws2_32) +endif() + +install(TARGETS enet ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) + +install(DIRECTORY include/ + DESTINATION include) \ No newline at end of file diff --git a/ports/enet/CONTROL b/ports/enet/CONTROL new file mode 100644 index 0000000000..f75b49de93 --- /dev/null +++ b/ports/enet/CONTROL @@ -0,0 +1,4 @@ +Source: enet +Version: 1.3.13 +Description: Reliable UDP networking library + diff --git a/ports/enet/portfile.cmake b/ports/enet/portfile.cmake new file mode 100644 index 0000000000..2a7fa4585c --- /dev/null +++ b/ports/enet/portfile.cmake @@ -0,0 +1,38 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) +vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH + REPO "lsalzman/enet" + REF f7c46f03fd8d883ac2811948aa71c7623069d070 + HEAD_REF master + SHA512 2d5593ea56473b38479921fd0849318bf3ecb233f92fa487ba395a0bb7e6a3997109287867a67c66721f761a30cceab4ba4709080a93ed977b7650b10cab1936 +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/enet RENAME copyright) + +vcpkg_copy_pdbs() \ No newline at end of file diff --git a/ports/gts/CONTROL b/ports/gts/CONTROL new file mode 100644 index 0000000000..faa4096194 --- /dev/null +++ b/ports/gts/CONTROL @@ -0,0 +1,4 @@ +Source: gts +Version: 0.7.6 +Description: A Library intended to provide a set of useful functions to deal with 3D surfaces meshed with interconnected triangles +Build-Depends: glib diff --git a/ports/gts/portfile.cmake b/ports/gts/portfile.cmake new file mode 100644 index 0000000000..d55f5dc669 --- /dev/null +++ b/ports/gts/portfile.cmake @@ -0,0 +1,36 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) +vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH + REPO "finetjul/gts" + REF c4da61ae075f355d9ecc9f2d4767acf777f54c2b + HEAD_REF master + SHA512 e53d11213c26cbda08ae62e6388aee0a14d2884de72268ad25d10a23e77baa53a2b1151c5cc7643b059ded82b8edf0da79144c3108949fdc515168cac13ffca9 +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gts RENAME copyright) + +vcpkg_copy_pdbs() \ No newline at end of file diff --git a/ports/lua/CMakeLists.txt b/ports/lua/CMakeLists.txt index faef8018b3..fc2e27e084 100644 --- a/ports/lua/CMakeLists.txt +++ b/ports/lua/CMakeLists.txt @@ -56,9 +56,10 @@ INSTALL ( TARGETS lua IF (NOT DEFINED SKIP_INSTALL_TOOLS) ADD_EXECUTABLE ( luac src/luac.c ${SRC_LIBLUA} ) # compiler - ADD_EXECUTABLE ( luai src/lua.c ${SRC_LIBLUA} ) # interpreter + ADD_EXECUTABLE ( luai src/lua.c ) # interpreter + TARGET_LINK_LIBRARIES ( luai lua ) SET_TARGET_PROPERTIES ( luai PROPERTIES OUTPUT_NAME lua PDB_NAME luai ) - INSTALL ( TARGETS luai luac RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/tools ) + INSTALL ( TARGETS luai luac lua RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/tools ) ENDIF () IF (NOT DEFINED SKIP_INSTALL_HEADERS) diff --git a/ports/lua/CONTROL b/ports/lua/CONTROL index e34436ad07..cf49dafe56 100644 --- a/ports/lua/CONTROL +++ b/ports/lua/CONTROL @@ -1,3 +1,3 @@ Source: lua -Version: 5.3.4-1 +Version: 5.3.4-2 Description: a powerful, fast, lightweight, embeddable scripting language diff --git a/ports/opengl/portfile.cmake b/ports/opengl/portfile.cmake index 2af9e6e3ba..36622393bc 100644 --- a/ports/opengl/portfile.cmake +++ b/ports/opengl/portfile.cmake @@ -4,18 +4,18 @@ vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT) vcpkg_get_windows_sdk(WINDOWS_SDK) if (WINDOWS_SDK MATCHES "10.") - set(OPENGLPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib") + set(LIBFILEPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib") set(LICENSEPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Licenses\\${WINDOWS_SDK}\\sdk_license.rtf") set(HEADERSPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Include\\${WINDOWS_SDK}\\um") elseif(WINDOWS_SDK MATCHES "8.") - set(OPENGLPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib") + set(LIBFILEPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib") set(HEADERSPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Include\\um") else() message(FATAL_ERROR "Portfile not yet configured for Windows SDK with version: ${WINDOWS_SDK}") endif() -if (NOT EXISTS "${OPENGLPATH}") - message(FATAL_ERROR "Cannot find Windows ${WINDOWS_SDK} SDK. File does not exist: ${OPENGLPATH}") +if (NOT EXISTS "${LIBFILEPATH}") + message(FATAL_ERROR "Cannot find Windows ${WINDOWS_SDK} SDK. File does not exist: ${LIBFILEPATH}") endif() file(MAKE_DIRECTORY @@ -30,8 +30,8 @@ file(COPY "${HEADERSPATH}\\gl\\GLU.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/gl ) -file(COPY ${OPENGLPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) -file(COPY ${OPENGLPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) +file(COPY ${LIBFILEPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) +file(COPY ${LIBFILEPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) if (DEFINED LICENSEPATH) file(COPY ${LICENSEPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/share/opengl) diff --git a/ports/openni2/CONTROL b/ports/openni2/CONTROL index 5dca7646a6..2f0e010e0e 100644 --- a/ports/openni2/CONTROL +++ b/ports/openni2/CONTROL @@ -1,3 +1,3 @@ Source: openni2 -Version: 2.2.0.33 +Version: 2.2.0.33-1 Description: OpenNI is open source library for access to Natural Interaction (NI) devices such as RGB-D camera. diff --git a/ports/openni2/inherit_from_parent_or_project_defaults.patch b/ports/openni2/inherit_from_parent_or_project_defaults.patch new file mode 100644 index 0000000000..73893f3b9f --- /dev/null +++ b/ports/openni2/inherit_from_parent_or_project_defaults.patch @@ -0,0 +1,41 @@ +diff --git a/Source/Drivers/Kinect/Kinect.vcxproj b/Source/Drivers/Kinect/Kinect.vcxproj +index 7f54d04..08a49fe 100644 +--- a/Source/Drivers/Kinect/Kinect.vcxproj ++++ b/Source/Drivers/Kinect/Kinect.vcxproj +@@ -72,28 +72,29 @@ + + $(SolutionDir)Bin\$(Platform)-$(Configuration)\OpenNI2\Drivers\ + $(SolutionDir)Bin\Intermediate\$(Platform)-$(Configuration)\$(ProjectName)\ +- $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include +- $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib; ++ $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(IncludePath) ++ $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;$(LibraryPath) + true + + + $(SolutionDir)Bin\$(Platform)-$(Configuration)\OpenNI2\Drivers\ + $(SolutionDir)Bin\Intermediate\$(Platform)-$(Configuration)\$(ProjectName)\ +- $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include; +- $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64; ++ $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(IncludePath) ++ $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;$(LibraryPath) + true + + + $(SolutionDir)Bin\$(Platform)-$(Configuration)\OpenNI2\Drivers\ + $(SolutionDir)Bin\Intermediate\$(Platform)-$(Configuration)\$(ProjectName)\ +- $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include; +- $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib; ++ $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(IncludePath) ++ $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;$(LibraryPath) + false + + + $(SolutionDir)Bin\$(Platform)-$(Configuration)\OpenNI2\Drivers\ + $(SolutionDir)Bin\Intermediate\$(Platform)-$(Configuration)\$(ProjectName)\ +- $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include ++ $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(IncludePath) ++ $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;$(LibraryPath) + false + + diff --git a/ports/openni2/portfile.cmake b/ports/openni2/portfile.cmake index 12ac4902b2..7c15b40ec7 100644 --- a/ports/openni2/portfile.cmake +++ b/ports/openni2/portfile.cmake @@ -36,12 +36,29 @@ vcpkg_download_distfile(ARCHIVE ) vcpkg_extract_source_archive(${ARCHIVE}) +get_filename_component(KINECTSDK10_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Kinect;SDKInstallPath]" ABSOLUTE CACHE) +set(KINECTSDK10_INSTALLED FALSE) +if(EXISTS "${KINECTSDK10_DIR}") + set(KINECTSDK10_INSTALLED TRUE) +endif() + +file(TO_NATIVE_PATH ${KINECTSDK10_DIR} KINECTSDK10_DIR) +configure_file("${CMAKE_CURRENT_LIST_DIR}/replace_environment_variable.patch.in" "${CMAKE_CURRENT_LIST_DIR}/replace_environment_variable.patch" @ONLY) + vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES "${CMAKE_CURRENT_LIST_DIR}/upgrade_projects.patch" - PATCHES "${CMAKE_CURRENT_LIST_DIR}/disable_kinect.patch" + "${CMAKE_CURRENT_LIST_DIR}/inherit_from_parent_or_project_defaults.patch" + "${CMAKE_CURRENT_LIST_DIR}/replace_environment_variable.patch" ) +if(NOT ${KINECTSDK10_INSTALLED}) + vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/disable_kinect.patch" + ) +endif() + # Build OpenNI2 vcpkg_build_msbuild( PROJECT_PATH "${SOURCE_PATH}/OpenNI.sln" @@ -146,6 +163,15 @@ file( ${CURRENT_PACKAGES_DIR}/bin/OpenNI2/Drivers ) +if(${KINECTSDK10_INSTALLED}) + file( + INSTALL + "${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/Kinect.dll" + DESTINATION + ${CURRENT_PACKAGES_DIR}/bin/OpenNI2/Drivers + ) +endif() + file( INSTALL "${SOURCE_CONFIG_PATH}/OpenNI.ini" @@ -165,6 +191,15 @@ file( ${CURRENT_PACKAGES_DIR}/debug/bin/OpenNI2/Drivers ) +if(${KINECTSDK10_INSTALLED}) + file( + INSTALL + "${SOURCE_BIN_PATH_DEBUG}/OpenNI2/Drivers/Kinect.dll" + DESTINATION + ${CURRENT_PACKAGES_DIR}/debug/bin/OpenNI2/Drivers + ) +endif() + file( INSTALL "${SOURCE_CONFIG_PATH}/OpenNI.ini" @@ -184,6 +219,15 @@ file( ${CURRENT_PACKAGES_DIR}/tools/openni2/OpenNI2/Drivers ) +if(${KINECTSDK10_INSTALLED}) + file( + INSTALL + "${SOURCE_BIN_PATH_RELEASE}/OpenNI2/Drivers/Kinect.dll" + DESTINATION + ${CURRENT_PACKAGES_DIR}/tools/openni2/OpenNI2/Drivers + ) +endif() + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") set(NUMBEROFBIT 32) elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") @@ -199,7 +243,7 @@ file( "${SOURCE_BIN_PATH_RELEASE}/PS1080Console.exe" "${SOURCE_BIN_PATH_RELEASE}/PSLinkConsole.exe" DESTINATION - ${CURRENT_PACKAGES_DIR}/tools/openni2/ + ${CURRENT_PACKAGES_DIR}/tools/openni2 ) # Handle copyright diff --git a/ports/openni2/replace_environment_variable.patch.in b/ports/openni2/replace_environment_variable.patch.in new file mode 100644 index 0000000000..25abe7edfd --- /dev/null +++ b/ports/openni2/replace_environment_variable.patch.in @@ -0,0 +1,76 @@ +diff --git a/Source/Drivers/Kinect/Kinect.vcxproj b/Source/Drivers/Kinect/Kinect.vcxproj +index 08a49fe..7fd8620 100644 +--- a/Source/Drivers/Kinect/Kinect.vcxproj ++++ b/Source/Drivers/Kinect/Kinect.vcxproj +@@ -101,7 +101,7 @@ + + Level3 + Disabled +- ..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;$(KINECTSDK10_DIR)\inc; ++ ..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@KINECTSDK10_DIR@\inc; + _WINDLL;%(PreprocessorDefinitions);_WINDOWS + false + false +@@ -109,7 +109,7 @@ + + true + Kinect10.lib;XnLib.lib;%(AdditionalDependencies) +- $(SolutionDir)Bin\$(Platform)-$(Configuration)\;$(KINECTSDK10_DIR)\lib\x86; ++ $(SolutionDir)Bin\$(Platform)-$(Configuration)\;@KINECTSDK10_DIR@\lib\x86; + true + + +@@ -117,7 +117,7 @@ + + Level3 + Disabled +- ..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;$(KINECTSDK10_DIR)\inc; ++ ..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@KINECTSDK10_DIR@\inc; + _WINDLL;%(PreprocessorDefinitions);_WINDOWS + false + false +@@ -125,7 +125,7 @@ + + true + Kinect10.lib;XnLib.lib;%(AdditionalDependencies) +- $(SolutionDir)Bin\$(Platform)-$(Configuration)\;$(KINECTSDK10_DIR)\lib\amd64; ++ $(SolutionDir)Bin\$(Platform)-$(Configuration)\;@KINECTSDK10_DIR@\lib\amd64; + + + +@@ -139,7 +139,7 @@ + MaxSpeed + true + true +- ..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;$(KINECTSDK10_DIR)\inc; ++ ..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@KINECTSDK10_DIR@\inc; + false + + +@@ -147,7 +147,7 @@ + true + true + Kinect10.lib;XnLib.lib;%(AdditionalDependencies) +- $(SolutionDir)Bin\$(Platform)-$(Configuration)\;$(KINECTSDK10_DIR)\lib\x86; ++ $(SolutionDir)Bin\$(Platform)-$(Configuration)\;@KINECTSDK10_DIR@\lib\x86; + true + + +@@ -157,7 +157,7 @@ + MaxSpeed + true + true +- ..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;$(KINECTSDK10_DIR)\inc; ++ ..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@KINECTSDK10_DIR@\inc; + false + + +@@ -165,7 +165,7 @@ + true + true + Kinect10.lib;XnLib.lib;%(AdditionalDependencies) +- $(SolutionDir)Bin\$(Platform)-$(Configuration)\;$(KINECTSDK10_DIR)\lib\amd64; ++ $(SolutionDir)Bin\$(Platform)-$(Configuration)\;@KINECTSDK10_DIR@\lib\amd64; + true + + diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/VcpkgPaths.cpp index 8892207bd8..4634a87c01 100644 --- a/toolsrc/src/VcpkgPaths.cpp +++ b/toolsrc/src/VcpkgPaths.cpp @@ -273,29 +273,10 @@ namespace vcpkg return nullopt; } - static std::vector detect_supported_architectures(const Files::Filesystem& fs, - const fs::path& vcvarsall_dir) - { - using CPU = System::CPUArchitecture; - std::vector supported_architectures; - - if (fs.exists(vcvarsall_dir / "vcvars32.bat")) supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); - if (fs.exists(vcvarsall_dir / "vcvars64.bat")) - supported_architectures.push_back({L"amd64", CPU::X64, CPU::X64}); - if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat")) - supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); - if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat")) - supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); - if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat")) - supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); - if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat")) - supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); - - return supported_architectures; - } - static std::vector find_toolset_instances(const VcpkgPaths& paths) { + using CPU = System::CPUArchitecture; + const auto& fs = paths.get_filesystem(); // Note: this will contain a mix of vcvarsall.bat locations and dumpbin.exe locations. @@ -316,8 +297,19 @@ namespace vcpkg paths_examined.push_back(vs2015_dumpbin_exe); const fs::path vs2015_bin_dir = vs2015_vcvarsall_bat.parent_path() / "bin"; - const std::vector supported_architectures = - detect_supported_architectures(fs, vs2015_bin_dir); + std::vector supported_architectures; + if (fs.exists(vs2015_bin_dir / "vcvars32.bat")) + supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); + if (fs.exists(vs2015_bin_dir / "amd64\\vcvars64.bat")) + supported_architectures.push_back({L"x64", CPU::X64, CPU::X64}); + if (fs.exists(vs2015_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat")) + supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); + if (fs.exists(vs2015_bin_dir / "x86_arm\\vcvarsx86_arm.bat")) + supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); + if (fs.exists(vs2015_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat")) + supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); + if (fs.exists(vs2015_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat")) + supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); if (fs.exists(vs2015_dumpbin_exe)) { @@ -342,8 +334,19 @@ namespace vcpkg if (!fs.exists(vcvarsall_bat)) continue; // Get all supported architectures - const std::vector supported_architectures = - detect_supported_architectures(fs, vcvarsall_dir); + std::vector supported_architectures; + if (fs.exists(vcvarsall_dir / "vcvars32.bat")) + supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); + if (fs.exists(vcvarsall_dir / "vcvars64.bat")) + supported_architectures.push_back({L"amd64", CPU::X64, CPU::X64}); + if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat")) + supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); + if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat")) + supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); + if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat")) + supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); + if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat")) + supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); // Locate the "best" MSVC toolchain version const fs::path msvc_path = vc_dir / "Tools" / "MSVC";