Add natvis file, include in nuget (#237)

* Add natvis file, include in nuget

* Include natvis in test build

* Include natvis in nupkg

* Add natvis for vcpkg
This commit is contained in:
Jon Wiswall 2022-04-29 16:01:51 -07:00 коммит произвёл GitHub
Родитель 18c1ebd901
Коммит aee497ee2e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 118 добавлений и 0 удалений

Просмотреть файл

@ -44,6 +44,12 @@ target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
# Include the .natvis files
if (MSVC)
target_sources(${PROJECT_NAME} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/natvis/wil.natvis>")
endif()
# Install Package Configuration
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME_LOWER}_targets)

105
natvis/wil.natvis Normal file
Просмотреть файл

@ -0,0 +1,105 @@
<!--
Copyright (c) Microsoft. All rights reserved.
This code is licensed under the MIT License.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT.
-->
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="wistd::_Func_impl&lt;*&gt;">
<DisplayString>{_Callee._Object}</DisplayString>
<Expand>
</Expand>
</Type>
<Type Name="wistd::function&lt;*&gt;">
<DisplayString Condition="_Impl == 0">empty</DisplayString>
<DisplayString Condition="_Impl != 0">{*_Impl}</DisplayString>
<Expand>
<ExpandedItem Condition="_Impl != 0">*_Impl</ExpandedItem>
</Expand>
</Type>
<Type Name="wistd::unique_ptr&lt;*&gt;">
<DisplayString Condition="_Myptr == 0">empty</DisplayString>
<DisplayString Condition="_Myptr != 0">{*_Myptr}</DisplayString>
<StringView>_Myptr</StringView>
<Expand>
<Item Name="[pointer]" Condition="_Myptr != 0">_Myptr</Item>
</Expand>
</Type>
<Type Name="wistd::unique_ptr&lt;wchar_t[*],*&gt;">
<DisplayString Condition="_Myptr == 0">empty</DisplayString>
<DisplayString Condition="_Myptr != 0">{_Myptr,su}</DisplayString>
<StringView>_Myptr</StringView>
<Expand>
<Item Name="[pointer]" Condition="_Myptr != 0">_Myptr</Item>
<Item Name="[length]" Condition="_Myptr != 0">wcslen(_Myptr)</Item>
</Expand>
</Type>
<Type Name="wistd::unique_ptr&lt;char[*],*&gt;">
<DisplayString Condition="_Myptr == 0">empty</DisplayString>
<DisplayString Condition="_Myptr != 0">{_Myptr,s}</DisplayString>
<StringView>_Myptr</StringView>
<Expand>
<Item Name="[pointer]" Condition="_Myptr != 0">_Myptr</Item>
<Item Name="[length]" Condition="_Myptr != 0">strlen(_Myptr)</Item>
</Expand>
</Type>
<Type Name="wil::details::shared_storage&lt;*&gt;">
<DisplayString Condition="m_ptr == 0">empty</DisplayString>
<DisplayString Condition="m_ptr != 0">{*m_ptr}</DisplayString>
<StringView>m_ptr</StringView>
<Expand>
<Item Name="[pointer]" Condition="m_ptr != 0">m_ptr</Item>
</Expand>
</Type>
<Type Name="wil::details::unique_storage&lt;wil::details::handle_null_resource_policy&lt;*&gt;&gt;">
<DisplayString Condition="m_ptr == 0">empty</DisplayString>
<DisplayString Condition="m_ptr != 0">{m_ptr}</DisplayString>
<Expand>
</Expand>
</Type>
<Type Name="wil::details::unique_storage&lt;wil::details::handle_invalid_resource_policy&lt;*&gt;&gt;">
<DisplayString Condition="m_ptr == 0">empty</DisplayString>
<DisplayString Condition="m_ptr != 0">{m_ptr}</DisplayString>
<Expand>
</Expand>
</Type>
<Type Name="wil::details::unique_storage&lt;wil::details::resource_policy&lt;*&gt;&gt;">
<DisplayString Condition="m_ptr == 0">empty</DisplayString>
<DisplayString Condition="m_ptr != 0">{m_ptr}</DisplayString>
<StringView>m_ptr</StringView>
<Expand>
</Expand>
</Type>
<Type Name="wil::details::unique_storage&lt;wil::details::resource_policy&lt;wchar_t *,*&gt;&gt;">
<DisplayString Condition="m_ptr == 0">empty</DisplayString>
<DisplayString Condition="m_ptr != 0">{m_ptr,su}</DisplayString>
<StringView>m_ptr</StringView>
<Expand>
<Item Name="[length]" Condition="m_ptr != 0">wcslen(m_ptr)</Item>
</Expand>
</Type>
<Type Name="wil::details::unique_storage&lt;wil::details::resource_policy&lt;char *,*&gt;&gt;">
<DisplayString Condition="m_ptr == 0">empty</DisplayString>
<DisplayString Condition="m_ptr != 0">{m_ptr,s}</DisplayString>
<StringView>m_ptr</StringView>
<Expand>
<Item Name="[length]" Condition="m_ptr != 0">strlen(m_ptr)</Item>
</Expand>
</Type>
<Type Name="wil::com_ptr_t&lt;*&gt;">
<DisplayString>{m_ptr}</DisplayString>
<Expand>
<ExpandedItem>m_ptr</ExpandedItem>
</Expand>
</Type>
</AutoVisualizer>

Просмотреть файл

@ -7,6 +7,7 @@ file(TO_NATIVE_PATH "${nupkg_dir}/Microsoft.Windows.ImplementationLibrary.${WIL_
file(DOWNLOAD https://dist.nuget.org/win-x86-commandline/latest/nuget.exe ${nuget_exe})
file(GLOB_RECURSE wil_headers ${CMAKE_SOURCE_DIR}/include/*.h)
file(GLOB_RECURSE wil_natvis ${CMAKE_SOURCE_DIR}/natvis/*.natvis)
add_custom_command(OUTPUT ${wil_nupkg}
COMMAND ${nuget_exe} pack ${CMAKE_CURRENT_SOURCE_DIR}/Microsoft.Windows.ImplementationLibrary.nuspec -OutputDirectory ${nupkg_dir} -Version ${WIL_BUILD_VERSION} -NonInteractive
@ -14,6 +15,7 @@ add_custom_command(OUTPUT ${wil_nupkg}
${CMAKE_CURRENT_SOURCE_DIR}/Microsoft.Windows.ImplementationLibrary.nuspec
${CMAKE_CURRENT_SOURCE_DIR}/Microsoft.Windows.ImplementationLibrary.targets
${wil_headers}
${wil_natvis}
${CMAKE_SOURCE_DIR}/LICENSE
${CMAKE_SOURCE_DIR}/ThirdPartyNotices.txt)

Просмотреть файл

@ -16,6 +16,7 @@
<file src="..\..\LICENSE"/>
<file src="..\..\ThirdPartyNotices.txt"/>
<file src="..\..\include\**" target="include\" />
<file src="..\..\natvis\wil.natvis" target="natvis\" />
<file src="Microsoft.Windows.ImplementationLibrary.targets" target="build\native\" />
</files>
</package>

Просмотреть файл

@ -5,4 +5,7 @@
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis"/>
</ItemGroup>
</Project>

Просмотреть файл

@ -50,6 +50,7 @@ set(COMMON_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/SafeCastTests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/WistdTests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wiTest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../natvis/wil.natvis
)
add_subdirectory(app)