From 03f8323b99a62b5027d8d85f435dbac5e57ac589 Mon Sep 17 00:00:00 2001 From: Jared Irwin Date: Fri, 16 Oct 2020 15:20:32 -0400 Subject: [PATCH 1/4] Update cppwinrt --- ports/cppwinrt/CMakeLists.txt | 27 +++++++++++++++++++++++ ports/cppwinrt/CONTROL | 4 ---- ports/cppwinrt/portfile.cmake | 40 +++++++++++++++++++++-------------- ports/cppwinrt/vcpkg.json | 7 ++++++ 4 files changed, 58 insertions(+), 20 deletions(-) create mode 100644 ports/cppwinrt/CMakeLists.txt delete mode 100644 ports/cppwinrt/CONTROL create mode 100644 ports/cppwinrt/vcpkg.json diff --git a/ports/cppwinrt/CMakeLists.txt b/ports/cppwinrt/CMakeLists.txt new file mode 100644 index 00000000000000..ebf40f8b54d5fc --- /dev/null +++ b/ports/cppwinrt/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.15) +project(cppwinrt VERSION ${VERSION} LANGUAGES C CXX ASM_MASM) + +if ("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x86") + set(VCPKG_TARGET_ARCHITECTURE win32) +endif() + +add_library(cppwinrt INTERFACE) +target_include_directories(cppwinrt + INTERFACE + $ + $ +) +target_link_libraries(cppwinrt + INTERFACE + windowsapp.lib + cppwinrt_fast_forwarder.lib +) +target_link_directories(cppwinrt + INTERFACE + $ +) + +install(TARGETS cppwinrt EXPORT cppwinrt) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/winrt TYPE INCLUDE CONFIGURATIONS Release) +install(FILES build/native/lib/${VCPKG_TARGET_ARCHITECTURE}/cppwinrt_fast_forwarder.lib TYPE LIB) +install(EXPORT cppwinrt DESTINATION share/cppwinrt NAMESPACE cppwinrt:: FILE cppwinrtConfig.cmake) diff --git a/ports/cppwinrt/CONTROL b/ports/cppwinrt/CONTROL deleted file mode 100644 index df7cff03ea37f1..00000000000000 --- a/ports/cppwinrt/CONTROL +++ /dev/null @@ -1,4 +0,0 @@ -Source: cppwinrt -Version: fall_2017_creators_update_for_vs_15.3-2 -Homepage: https://github.com/Microsoft/cppwinrt -Description: C++/WinRT is a standard C++ language projection for the Windows Runtime. diff --git a/ports/cppwinrt/portfile.cmake b/ports/cppwinrt/portfile.cmake index ec1cb060395ca0..a0ba09732290b4 100644 --- a/ports/cppwinrt/portfile.cmake +++ b/ports/cppwinrt/portfile.cmake @@ -1,21 +1,29 @@ -include(vcpkg_common_functions) +if(NOT VCPKG_TARGET_IS_WINDOWS) + message(FATAL_ERROR "\n${PORT} does not support your system, only Windows for now. Please open a ticket issue on github.com/microsoft/vcpkg if necessary\n") +endif() -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO Microsoft/cppwinrt - REF fall_2017_creators_update_for_vs_15.3 - SHA512 e3f987ed3f3dce019b8bf9f5451e53b42357473a003b8c14f9009e1848ee0463286bd46fdc3c739c8f7c2d232707e8018f5c087ffae784c745d51a8143f9a294 - HEAD_REF master +set(PACKAGE_NAME Microsoft.Windows.CppWinRT) +set(VERSION 2.0.201008.2) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src) + +vcpkg_find_acquire_program(NUGET) +vcpkg_execute_required_process( + ALLOW_IN_DOWNLOAD_MODE + COMMAND ${NUGET} install ${PACKAGE_NAME} -ExcludeVersion -Version ${VERSION} -NonInteractive -OutputDirectory ${SOURCE_PATH} + LOGNAME nuget-${TARGET_TRIPLET} ) -# Put the licence file where vcpkg expects it -file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cppwinrt) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/cppwinrt/LICENSE ${CURRENT_PACKAGES_DIR}/share/cppwinrt/copyright) +set(SOURCE_PATH ${SOURCE_PATH}/${PACKAGE_NAME}) -# Copy the cppwinrt header files -file(GLOB HEADER_FILES ${SOURCE_PATH}/10.0.16299.0/winrt/*) -file( - COPY ${HEADER_FILES} - DESTINATION ${CURRENT_PACKAGES_DIR}/include/winrt - REGEX "\.(gitattributes|gitignore)$" EXCLUDE +vcpkg_execute_required_process( + COMMAND ${SOURCE_PATH}/bin/cppwinrt.exe -input sdk -output ${SOURCE_PATH}/include +) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets() + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file diff --git a/ports/cppwinrt/vcpkg.json b/ports/cppwinrt/vcpkg.json new file mode 100644 index 00000000000000..a76c22e63bc603 --- /dev/null +++ b/ports/cppwinrt/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "cppwinrt", + "version-string": "2.0.201008.2", + "description": "C++/WinRT is a standard C++ language projection for the Windows Runtime.", + "homepage": "https://github.com/Microsoft/cppwinrt", + "supports": "!(osx | linux)" +} From 0ed07f68722c704e0b644774ce56affe1bad7372 Mon Sep 17 00:00:00 2001 From: Jared Irwin Date: Tue, 20 Oct 2020 10:26:18 -0400 Subject: [PATCH 2/4] Update with suggestions --- ports/cppwinrt/CMakeLists.txt | 2 +- ports/cppwinrt/portfile.cmake | 16 +++++++--------- ports/cppwinrt/vcpkg.json | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ports/cppwinrt/CMakeLists.txt b/ports/cppwinrt/CMakeLists.txt index ebf40f8b54d5fc..e2b2077033e09e 100644 --- a/ports/cppwinrt/CMakeLists.txt +++ b/ports/cppwinrt/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.15) -project(cppwinrt VERSION ${VERSION} LANGUAGES C CXX ASM_MASM) +project(cppwinrt VERSION ${VERSION} LANGUAGES) if ("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x86") set(VCPKG_TARGET_ARCHITECTURE win32) diff --git a/ports/cppwinrt/portfile.cmake b/ports/cppwinrt/portfile.cmake index a0ba09732290b4..e746e4593bac5e 100644 --- a/ports/cppwinrt/portfile.cmake +++ b/ports/cppwinrt/portfile.cmake @@ -1,6 +1,4 @@ -if(NOT VCPKG_TARGET_IS_WINDOWS) - message(FATAL_ERROR "\n${PORT} does not support your system, only Windows for now. Please open a ticket issue on github.com/microsoft/vcpkg if necessary\n") -endif() +vcpkg_fail_port_install(ON_TARGET linux osx) set(PACKAGE_NAME Microsoft.Windows.CppWinRT) set(VERSION 2.0.201008.2) @@ -9,21 +7,21 @@ set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src) vcpkg_find_acquire_program(NUGET) vcpkg_execute_required_process( ALLOW_IN_DOWNLOAD_MODE - COMMAND ${NUGET} install ${PACKAGE_NAME} -ExcludeVersion -Version ${VERSION} -NonInteractive -OutputDirectory ${SOURCE_PATH} + COMMAND ${NUGET} install ${PACKAGE_NAME} -ExcludeVersion -Version ${VERSION} -NonInteractive -OutputDirectory "${SOURCE_PATH}" LOGNAME nuget-${TARGET_TRIPLET} ) -set(SOURCE_PATH ${SOURCE_PATH}/${PACKAGE_NAME}) +set(PACKAGE_PATH ${SOURCE_PATH}/${PACKAGE_NAME}) vcpkg_execute_required_process( - COMMAND ${SOURCE_PATH}/bin/cppwinrt.exe -input sdk -output ${SOURCE_PATH}/include + COMMAND "${PACKAGE_PATH}/bin/cppwinrt.exe" -input sdk -output "${PACKAGE_PATH}/include" ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${PACKAGE_PATH}) vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH ${PACKAGE_PATH} PREFER_NINJA ) vcpkg_install_cmake() vcpkg_fixup_cmake_targets() -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file +file(INSTALL ${PACKAGE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file diff --git a/ports/cppwinrt/vcpkg.json b/ports/cppwinrt/vcpkg.json index a76c22e63bc603..eb267a41951e5c 100644 --- a/ports/cppwinrt/vcpkg.json +++ b/ports/cppwinrt/vcpkg.json @@ -3,5 +3,5 @@ "version-string": "2.0.201008.2", "description": "C++/WinRT is a standard C++ language projection for the Windows Runtime.", "homepage": "https://github.com/Microsoft/cppwinrt", - "supports": "!(osx | linux)" + "supports": "windows" } From e42075afae8c43cdf588f38651bb6958e53e2767 Mon Sep 17 00:00:00 2001 From: Jared Irwin Date: Thu, 22 Oct 2020 19:23:16 -0400 Subject: [PATCH 3/4] Convert cppwinrt to an empty port --- ports/cppwinrt/CMakeLists.txt | 27 --------------------------- ports/cppwinrt/portfile.cmake | 31 +++++++------------------------ 2 files changed, 7 insertions(+), 51 deletions(-) delete mode 100644 ports/cppwinrt/CMakeLists.txt diff --git a/ports/cppwinrt/CMakeLists.txt b/ports/cppwinrt/CMakeLists.txt deleted file mode 100644 index e2b2077033e09e..00000000000000 --- a/ports/cppwinrt/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(cppwinrt VERSION ${VERSION} LANGUAGES) - -if ("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x86") - set(VCPKG_TARGET_ARCHITECTURE win32) -endif() - -add_library(cppwinrt INTERFACE) -target_include_directories(cppwinrt - INTERFACE - $ - $ -) -target_link_libraries(cppwinrt - INTERFACE - windowsapp.lib - cppwinrt_fast_forwarder.lib -) -target_link_directories(cppwinrt - INTERFACE - $ -) - -install(TARGETS cppwinrt EXPORT cppwinrt) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/winrt TYPE INCLUDE CONFIGURATIONS Release) -install(FILES build/native/lib/${VCPKG_TARGET_ARCHITECTURE}/cppwinrt_fast_forwarder.lib TYPE LIB) -install(EXPORT cppwinrt DESTINATION share/cppwinrt NAMESPACE cppwinrt:: FILE cppwinrtConfig.cmake) diff --git a/ports/cppwinrt/portfile.cmake b/ports/cppwinrt/portfile.cmake index e746e4593bac5e..a875a5a5e84b84 100644 --- a/ports/cppwinrt/portfile.cmake +++ b/ports/cppwinrt/portfile.cmake @@ -1,27 +1,10 @@ -vcpkg_fail_port_install(ON_TARGET linux osx) - -set(PACKAGE_NAME Microsoft.Windows.CppWinRT) -set(VERSION 2.0.201008.2) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src) - -vcpkg_find_acquire_program(NUGET) -vcpkg_execute_required_process( - ALLOW_IN_DOWNLOAD_MODE - COMMAND ${NUGET} install ${PACKAGE_NAME} -ExcludeVersion -Version ${VERSION} -NonInteractive -OutputDirectory "${SOURCE_PATH}" - LOGNAME nuget-${TARGET_TRIPLET} +find_path(CPPWINRT_BASE_H + NAMES winrt/base.h + PATHS $ENV{INCLUDE} ) -set(PACKAGE_PATH ${SOURCE_PATH}/${PACKAGE_NAME}) - -vcpkg_execute_required_process( - COMMAND "${PACKAGE_PATH}/bin/cppwinrt.exe" -input sdk -output "${PACKAGE_PATH}/include" -) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${PACKAGE_PATH}) -vcpkg_configure_cmake( - SOURCE_PATH ${PACKAGE_PATH} - PREFER_NINJA -) -vcpkg_install_cmake() -vcpkg_fixup_cmake_targets() +if(NOT CPPWINRT_BASE_H) + message(FATAL_ERROR "Unable to locate cppwinrt. Please install Windows SDK version 10.0.17134.0 or newer.") +endif() -file(INSTALL ${PACKAGE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) \ No newline at end of file From ffc3799fde6ed6bdeff13202d32ed6d2a19b34ae Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 23 Oct 2020 19:06:12 -0700 Subject: [PATCH 4/4] Fix version-string to indicate that the version comes from the Windows SDK. --- ports/cppwinrt/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/cppwinrt/vcpkg.json b/ports/cppwinrt/vcpkg.json index eb267a41951e5c..7ff77b5d7502a7 100644 --- a/ports/cppwinrt/vcpkg.json +++ b/ports/cppwinrt/vcpkg.json @@ -1,6 +1,6 @@ { "name": "cppwinrt", - "version-string": "2.0.201008.2", + "version-string": "windows-sdk", "description": "C++/WinRT is a standard C++ language projection for the Windows Runtime.", "homepage": "https://github.com/Microsoft/cppwinrt", "supports": "windows"