From 0ef4e7136315db4d4c56cf6916c9b2274f99c8c8 Mon Sep 17 00:00:00 2001 From: Nicolas Hake Date: Tue, 29 Dec 2015 13:58:15 +0100 Subject: [PATCH] MSVC 2015: Add natvis file to solution This employs a rather ugly hack to make CMake do what we want. CMake doesn't allow us to add items directly to the solution (as opposed to one of the projects inside it), and thus requires us to abuse its lack of parameter validation to manually add the file. --- CMakeLists.txt | 20 +++ tools/openclonk.vs14.natvis | 242 ++++++++++++++++++++++++++++++++++++ 2 files changed, 262 insertions(+) create mode 100644 tools/openclonk.vs14.natvis diff --git a/CMakeLists.txt b/CMakeLists.txt index e9a134025..e190df177 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1331,6 +1331,26 @@ if(MSVC_VERSION EQUAL 1600) file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln" "\n# reload me\n") endif() +# For MSVC 2015, add a Solution Items folder to the solution that contains +# a reference to the debugger visualization file. +if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015") + file(RELATIVE_PATH NATVIS_SOURCE_PATH "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/tools/openclonk.vs14.natvis") + file(TO_NATIVE_PATH "${NATVIS_SOURCE_PATH}" NATVIS_SOURCE_PATH) + # We need to set the GUID of this to the cache, so CMake uses it for + # dependency resolution. As a special bonus, this makes it so the + # project has an actual version 4 GUID instead of the CMake-generated + # almost-version-3 (actually just a bunch of MD5 hex output with dashes). + set(VS_SolutionItems_GUID "9570CE35-9E26-4091-AF06-6B0C7F9D8F69") + set("Solution Items_GUID_CMAKE" "${VS_SolutionItems_GUID}" CACHE INTERNAL "Stored GUID") + # Unfortunately CMake doesn't allow us to add solution items directly, so + # instead we abuse that it doesn't validate the TYPE parameter and instead + # passes it straight through into the .sln file. + include_external_msproject( + "Solution Items" "Solution Items" + TYPE "2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{${VS_SolutionItems_GUID}}\"\n ProjectSection(SolutionItems) = preProject\n ${NATVIS_SOURCE_PATH} = ${NATVIS_SOURCE_PATH}\n EndProjectSection\n#" + ) +endif() + ############################################################################ # Precompiled header support, gcc part (it needs the cxx flags) ############################################################################ diff --git a/tools/openclonk.vs14.natvis b/tools/openclonk.vs14.natvis new file mode 100644 index 000000000..8a8835b7c --- /dev/null +++ b/tools/openclonk.vs14.natvis @@ -0,0 +1,242 @@ + + + + + {pData,s} + (const char*)pData + + + {C4ID::names[v],sb} + {C4ID::names[v],sb} ({v}) + + + {id,view(name)} + {id} + + + + {Data} + + + + + iSize + iCapacity + + iSize + pData + + + + + + + {bccType,en} {Par.s,na} + + {bccType,en} {Par.i} + + {bccType,en} {Par.f} + + {bccType,en} {Par.p} + + {bccType,en} {Par.a} + + {bccType,en} + + {bccType,en} {Par,na} + + + + nil + {Data.Int} + {(bool)Data.Int} + {Data.PropList,na} + {Data.Str,na} + {Data.Array,na} + {Data.Fn,na} + {Type,en} {Data} + + Type + Data.Int + (bool)Data.Int + Data.PropList + Data.Str + Data.Array + Data.Fn + + + + + {(const char*)Key->Data.pData,na}: {Value} + + + + + prototype + Properties + + + + + + Size + Capacity + + + Size + + + Table[slot] + + ++slot + + + + + + + + {*Owner,view(name)}::{Name,sb} + + + + + + ParCount + ParType + + + + + + + + {*Def,view(name)} + {*Def} + + + {{scenario}} + {ScriptName} + + + + {*p} + + + + + + + + Num + Map + + + + + + + + + + + ppReactionMap[(ls + 1)*(Num + 1) + pxs + 1] + ++pxs + + + pxs = 0 + ++ls + + + + + + + + + {Name,sb} + +