From e9485e57f9e9fd6e7ba06a303846d68a43ab761d Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Thu, 1 Dec 2016 18:05:41 +0000 Subject: [PATCH] Fix VS2015 build of clang-format-vsix by using NuGet to pull in required assemblies Also added a gitignore to help track the right items to commit. Patch by Antonio Maiorano ! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288393 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/clang-format-vs/.gitignore | 11 +++ tools/clang-format-vs/CMakeLists.txt | 9 +- .../ClangFormat/ClangFormat.csproj | 98 +++++++++++++++---- .../ClangFormat/packages.config | 22 +++++ tools/clang-format-vs/README.txt | 22 +++-- 5 files changed, 138 insertions(+), 24 deletions(-) create mode 100644 tools/clang-format-vs/.gitignore create mode 100644 tools/clang-format-vs/ClangFormat/packages.config diff --git a/tools/clang-format-vs/.gitignore b/tools/clang-format-vs/.gitignore new file mode 100644 index 0000000000..6453dd8ece --- /dev/null +++ b/tools/clang-format-vs/.gitignore @@ -0,0 +1,11 @@ +# Visual Studio files +.vs/ +/packages/ +/ClangFormat/obj/ +/ClangFormat/bin/ + +# Generated and copied files +/ClangFormat/Key.snk +/ClangFormat/license.txt +/ClangFormat/clang-format.exe +/ClangFormat/source.extension.vsixmanifest diff --git a/tools/clang-format-vs/CMakeLists.txt b/tools/clang-format-vs/CMakeLists.txt index fd0d6b028c..6d2ef73632 100644 --- a/tools/clang-format-vs/CMakeLists.txt +++ b/tools/clang-format-vs/CMakeLists.txt @@ -18,8 +18,15 @@ if (BUILD_CLANG_FORMAT_VS_PLUGIN) configure_file("source.extension.vsixmanifest.in" "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/source.extension.vsixmanifest") + find_program(NUGET_EXE nuget PATHS ${NUGET_EXE_DIR}) + if (NOT NUGET_EXE) + message(FATAL_ERROR "Could not find nuget.exe. Download from https://www.nuget.org/nuget.exe" + " and add parent directory to PATH or pass it via NUGET_EXE_DIR var.") + endif() + add_custom_target(clang_format_vsix ALL - devenv "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat.sln" /Build Release + COMMAND ${NUGET_EXE} restore "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat.sln" + COMMAND devenv "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat.sln" /Build Release DEPENDS clang_format_exe_for_vsix "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/source.extension.vsixmanifest" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/bin/Release/ClangFormat.vsix" diff --git a/tools/clang-format-vs/ClangFormat/ClangFormat.csproj b/tools/clang-format-vs/ClangFormat/ClangFormat.csproj index d4107733a1..5ce601d649 100644 --- a/tools/clang-format-vs/ClangFormat/ClangFormat.csproj +++ b/tools/clang-format-vs/ClangFormat/ClangFormat.csproj @@ -35,6 +35,7 @@ false false true + true @@ -44,6 +45,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -53,27 +55,87 @@ prompt 4 true + false + + ..\packages\VSSDK.DTE.7.0.3\lib\net20\envdte.dll + False + - - - - - - + + ..\packages\VSSDK.CoreUtility.10.0.4\lib\net40\Microsoft.VisualStudio.CoreUtility.dll + False + + + ..\packages\VSSDK.Editor.10.0.4\lib\net40\Microsoft.VisualStudio.Editor.dll + False + + + ..\packages\VSSDK.OLE.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.OLE.Interop.dll + True + False + + + ..\packages\VSSDK.Shell.10.10.0.3\lib\net40\Microsoft.VisualStudio.Shell.10.0.dll + False + + + ..\packages\VSSDK.Shell.Immutable.10.10.0.3\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll + True + + + ..\packages\VSSDK.Shell.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.Shell.Interop.dll + True + False + + + ..\packages\VSSDK.Shell.Interop.8.8.0.3\lib\net20\Microsoft.VisualStudio.Shell.Interop.8.0.dll + True + False + - - - false - - - - - - - + + ..\packages\VSSDK.Shell.Interop.9.9.0.3\lib\net20\Microsoft.VisualStudio.Shell.Interop.9.0.dll + True + False + + + ..\packages\VSSDK.Text.10.0.4\lib\net40\Microsoft.VisualStudio.Text.Data.dll + False + + + ..\packages\VSSDK.Text.10.0.4\lib\net40\Microsoft.VisualStudio.Text.Logic.dll + False + + + ..\packages\VSSDK.Text.10.0.4\lib\net40\Microsoft.VisualStudio.Text.UI.dll + False + + + ..\packages\VSSDK.Text.10.0.4\lib\net40\Microsoft.VisualStudio.Text.UI.Wpf.dll + False + + + ..\packages\VSSDK.TextManager.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.TextManager.Interop.dll + True + + + False + + + ..\packages\VSSDK.TextManager.Interop.8.8.0.4\lib\net20\Microsoft.VisualStudio.TextManager.Interop.8.0.dll + True + False + + + + + ..\packages\VSSDK.DTE.7.0.3\lib\net20\stdole.dll + False + + @@ -81,6 +143,7 @@ + @@ -165,6 +228,7 @@ + Designer @@ -228,4 +292,4 @@ --> - + \ No newline at end of file diff --git a/tools/clang-format-vs/ClangFormat/packages.config b/tools/clang-format-vs/ClangFormat/packages.config new file mode 100644 index 0000000000..38f64ed3a6 --- /dev/null +++ b/tools/clang-format-vs/ClangFormat/packages.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/clang-format-vs/README.txt b/tools/clang-format-vs/README.txt index b23355d0ce..edfffed774 100644 --- a/tools/clang-format-vs/README.txt +++ b/tools/clang-format-vs/README.txt @@ -2,13 +2,23 @@ This directory contains a VSPackage project to generate a Visual Studio extensio for clang-format. Build prerequisites are: -- Visual Studio 2013 Professional -- Visual Studio 2013 SDK -- Visual Studio 2010 Professional (?) -- Visual Studio 2010 SDK (?) +- Visual Studio 2015 +- Extensions SDK (you'll be prompted to install it if you open ClangFormat.sln) -The extension is built using CMake by setting BUILD_CLANG_FORMAT_VS_PLUGIN=ON -when configuring a Clang build, and building the clang_format_vsix target. +The extension is built using CMake to generate the usual LLVM.sln by setting +the following CMake vars: + +- BUILD_CLANG_FORMAT_VS_PLUGIN=ON + +- NUGET_EXE_PATH=path/to/nuget_dir (unless nuget.exe is already available in PATH) + +example: + cd /d C:\code\llvm + mkdir build & cd build + cmake -DBUILD_CLANG_FORMAT_VS_PLUGIN=ON -DNUGET_EXE_PATH=C:\nuget .. + +Once LLVM.sln is generated, build the clang_format_vsix target, which will build +ClangFormat.sln, the C# extension application. The CMake build will copy clang-format.exe and LICENSE.TXT into the ClangFormat/ directory so they can be bundled with the plug-in, as well as creating -- 2.40.0