mspertus created this revision. mspertus added reviewers: ariccio, aaron.ballman, zturner. mspertus added a subscriber: cfe-commits.
This change uses the [[ https://blogs.msdn.microsoft.com/vcblog/2014/06/12/project-support-for-natvis/ | Project Support for Natvis ]] added in VS2015 to eliminate the need to manually install natvis files. I am creating a similar diff for clang. I want to acknowledge ariccio for extensive advice on this change. http://reviews.llvm.org/D18497 Files: CMakeLists.txt utils/llvm.natvis Index: utils/llvm.natvis =================================================================== --- utils/llvm.natvis +++ utils/llvm.natvis @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -Visual Studio 2012 Native Debugging Visualizers for LLVM +Visual Studio Native Debugging Visualizers for LLVM -Put this file into "%USERPROFILE%\Documents\Visual Studio 2012\Visualizers" -or create a symbolic link so it updates automatically. +For Visual Studio 2013 only, put this file into +"%USERPROFILE%\Documents\Visual Studio 2013\Visualizers" or create a symbolic link so it updates automatically. + +For later versions of Visual Studio, no setup is required --> <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -398,6 +398,14 @@ set(LLVM_USE_HOST_TOOLS ON) endif() +if( MSVC_IDE ) + if (NOT (MSVC_VERSION LESS 1900)) + option(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION "Configure project to use Visual Studio native visualizers" TRUE) + else() + set(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION FALSE CACHE INTERNAL "For Visual Studio 2013, manually copy natvis files to Documents\\Visual Studio 2013\\Visualizers" FORCE) + endif() +endif() + # All options referred to from HandleLLVMOptions have to be specified # BEFORE this include, otherwise options will not be correctly set on # first cmake run @@ -728,6 +736,14 @@ add_subdirectory(cmake/modules) +# Do this by hand instead of using add_llvm_utilities(), which +# tries to create a corresponding executable, which we don't want +if(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION) + set( LLVM_VISUALIZERS utils/llvm.natvis) + add_custom_target( LLVMVisualizers SOURCES ${LLVM_VISUALIZERS}) + set_target_properties(LLVMVisualizers PROPERTIES FOLDER "Utils") +endif() + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(DIRECTORY include/llvm include/llvm-c DESTINATION include @@ -764,6 +780,7 @@ endif() endif() + # This must be at the end of the LLVM root CMakeLists file because it must run # after all targets are created. if(LLVM_DISTRIBUTION_COMPONENTS)
Index: utils/llvm.natvis =================================================================== --- utils/llvm.natvis +++ utils/llvm.natvis @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -Visual Studio 2012 Native Debugging Visualizers for LLVM +Visual Studio Native Debugging Visualizers for LLVM -Put this file into "%USERPROFILE%\Documents\Visual Studio 2012\Visualizers" -or create a symbolic link so it updates automatically. +For Visual Studio 2013 only, put this file into +"%USERPROFILE%\Documents\Visual Studio 2013\Visualizers" or create a symbolic link so it updates automatically. + +For later versions of Visual Studio, no setup is required --> <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -398,6 +398,14 @@ set(LLVM_USE_HOST_TOOLS ON) endif() +if( MSVC_IDE ) + if (NOT (MSVC_VERSION LESS 1900)) + option(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION "Configure project to use Visual Studio native visualizers" TRUE) + else() + set(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION FALSE CACHE INTERNAL "For Visual Studio 2013, manually copy natvis files to Documents\\Visual Studio 2013\\Visualizers" FORCE) + endif() +endif() + # All options referred to from HandleLLVMOptions have to be specified # BEFORE this include, otherwise options will not be correctly set on # first cmake run @@ -728,6 +736,14 @@ add_subdirectory(cmake/modules) +# Do this by hand instead of using add_llvm_utilities(), which +# tries to create a corresponding executable, which we don't want +if(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION) + set( LLVM_VISUALIZERS utils/llvm.natvis) + add_custom_target( LLVMVisualizers SOURCES ${LLVM_VISUALIZERS}) + set_target_properties(LLVMVisualizers PROPERTIES FOLDER "Utils") +endif() + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(DIRECTORY include/llvm include/llvm-c DESTINATION include @@ -764,6 +780,7 @@ endif() endif() + # This must be at the end of the LLVM root CMakeLists file because it must run # after all targets are created. if(LLVM_DISTRIBUTION_COMPONENTS)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits