mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[cppwinrt] Update port for January 2024 release (#37452)
This updates the cppwinrt port to use the latest Microsoft.Windows.CppWinRT package from NuGet. Includes clean up of the portfile for modern best practices. This also cleans up the cmake integration: * Uses `cppwinrt_FOUND` instead of the nonstandard `CppWinRT_FOUND` * Provides `CPPWINRT_TOOL` for being able to generate C++/WinRT headers from .winmd files as custom commands
This commit is contained in:
parent
4aa53df947
commit
3a7cb341b8
@ -1,14 +0,0 @@
|
||||
set(CppWinRT_FOUND TRUE)
|
||||
|
||||
if(NOT TARGET Microsoft::CppWinRT)
|
||||
get_filename_component(cppwinrt_root "${CMAKE_CURRENT_LIST_DIR}" PATH)
|
||||
get_filename_component(cppwinrt_root "${cppwinrt_root}" PATH)
|
||||
|
||||
add_library(Microsoft::CppWinRT INTERFACE IMPORTED)
|
||||
set_target_properties(Microsoft::CppWinRT PROPERTIES
|
||||
INTERFACE_COMPILE_FEATURES cxx_std_17
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${cppwinrt_root}/include"
|
||||
INTERFACE_LINK_LIBRARIES "${cppwinrt_root}/lib/cppwinrt_fast_forwarder.lib"
|
||||
)
|
||||
unset(cppwinrt_root)
|
||||
endif()
|
24
ports/cppwinrt/cppwinrt-config.cmake.in
Normal file
24
ports/cppwinrt/cppwinrt-config.cmake.in
Normal file
@ -0,0 +1,24 @@
|
||||
get_filename_component(_cppwinrt_root "${CMAKE_CURRENT_LIST_DIR}" PATH)
|
||||
get_filename_component(_cppwinrt_root "${_cppwinrt_root}" PATH)
|
||||
|
||||
set(_cppwinrt_exe "${_cppwinrt_root}/@tool_path@")
|
||||
if (EXISTS "${_cppwinrt_exe}")
|
||||
|
||||
add_library(Microsoft::CppWinRT INTERFACE IMPORTED)
|
||||
set_target_properties(Microsoft::CppWinRT PROPERTIES
|
||||
INTERFACE_COMPILE_FEATURES cxx_std_17
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_cppwinrt_root}/include"
|
||||
INTERFACE_LINK_LIBRARIES "${_cppwinrt_root}/lib/@lib_name@"
|
||||
)
|
||||
|
||||
set(cppwinrt_FOUND TRUE)
|
||||
set(CPPWINRT_TOOL ${_cppwinrt_exe})
|
||||
|
||||
else()
|
||||
|
||||
set(cppwinrt_FOUND FALSE)
|
||||
|
||||
endif()
|
||||
|
||||
unset(_cppwinrt_root)
|
||||
unset(_cppwinrt_exe)
|
@ -2,7 +2,7 @@
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://www.nuget.org/api/v2/package/Microsoft.Windows.CppWinRT/${VERSION}"
|
||||
FILENAME "cppwinrt.${VERSION}.zip"
|
||||
SHA512 6ce0764c3558d94b0ec72daa6d6d139df3942d33f51d1f3a670b888fbba2b556e35df831fa9eea42d4fc9a0a1f0ca94abef1c4013dcc9b51053bffe2af4dfd85
|
||||
SHA512 c6c38b81640d7d96d3ca76c321289d6f92eec9bb593a11824640c7dc3651dc69cce1e85ca0324396b4a4d55f790f2c16f835da261e7821137de1eb491b52ffc8
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive(
|
||||
@ -43,7 +43,8 @@ file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")
|
||||
file(WRITE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/cppwinrt.rsp" "${args}")
|
||||
|
||||
#--- Generate headers
|
||||
message(STATUS "Generating headers for Windows SDK $ENV{WindowsSDKVersion}")
|
||||
string(REGEX MATCH "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" SDKVersion $ENV{WindowsSDKVersion})
|
||||
message(STATUS "Generating headers for Windows SDK ${SDKVersion}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${CPPWINRT_TOOL}"
|
||||
"@${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/cppwinrt.rsp"
|
||||
@ -54,16 +55,18 @@ vcpkg_execute_required_process(
|
||||
)
|
||||
|
||||
set(CPPWINRT_LIB "${src}/build/native/lib/${CPPWINRT_ARCH}/cppwinrt_fast_forwarder.lib")
|
||||
file(COPY "${CPPWINRT_LIB}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
||||
if(NOT VCPKG_BUILD_TYPE)
|
||||
file(COPY "${CPPWINRT_LIB}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
||||
file(INSTALL "${CPPWINRT_LIB}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE)
|
||||
file(INSTALL "${CPPWINRT_LIB}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
||||
endif()
|
||||
file(COPY
|
||||
"${CPPWINRT_TOOL}"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/cppwinrt")
|
||||
file(COPY
|
||||
"${CMAKE_CURRENT_LIST_DIR}/cppwinrt-config.cmake"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/usage"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/share/cppwinrt")
|
||||
file(INSTALL "${CPPWINRT_TOOL}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/cppwinrt")
|
||||
|
||||
configure_file("${src}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
|
||||
set(tool_path "tools/cppwinrt/cppwinrt.exe")
|
||||
set(lib_name "cppwinrt_fast_forwarder.lib")
|
||||
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/cppwinrt-config.cmake.in"
|
||||
"${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake"
|
||||
@ONLY)
|
||||
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
vcpkg_install_copyright(FILE_LIST "${src}/LICENSE")
|
||||
|
@ -1,4 +1,6 @@
|
||||
cppwinrt provides CMake targets:
|
||||
The C++/WinRT package provides CMake targets:
|
||||
|
||||
find_package(cppwinrt CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE Microsoft::CppWinRT)
|
||||
|
||||
The CMake variable CPPWINRT_TOOL is also set to point to the .winmd to header command-line tool.
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cppwinrt",
|
||||
"version": "2.0.230207.1",
|
||||
"version": "2.0.240111.5",
|
||||
"description": "C++/WinRT is a standard C++ language projection for the Windows Runtime.",
|
||||
"homepage": "https://github.com/microsoft/cppwinrt",
|
||||
"documentation": "https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/",
|
||||
|
@ -1937,7 +1937,7 @@
|
||||
"port-version": 3
|
||||
},
|
||||
"cppwinrt": {
|
||||
"baseline": "2.0.230207.1",
|
||||
"baseline": "2.0.240111.5",
|
||||
"port-version": 0
|
||||
},
|
||||
"cppxaml": {
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "a2cf04c5162520cb5b3784e0cf09da9416929ab4",
|
||||
"version": "2.0.240111.5",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "a3c57356ebb8b59a5f12468f180728751d16581b",
|
||||
"version": "2.0.230207.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user