Home | History | Annotate | Line # | Download | only in clang-format-vs
      1      1.1  joerg This directory contains a VSPackage project to generate a Visual Studio extension
      2      1.1  joerg for clang-format.
      3      1.1  joerg 
      4      1.1  joerg Build prerequisites are:
      5      1.1  joerg - Visual Studio 2015
      6      1.1  joerg - Extensions SDK (you'll be prompted to install it if you open ClangFormat.sln)
      7      1.1  joerg 
      8      1.1  joerg The extension is built using CMake to generate the usual LLVM.sln by setting
      9      1.1  joerg the following CMake vars:
     10      1.1  joerg 
     11      1.1  joerg - BUILD_CLANG_FORMAT_VS_PLUGIN=ON
     12      1.1  joerg 
     13  1.1.1.2  joerg - NUGET_EXE_DIR=path/to/nuget_dir (unless nuget.exe is already available in PATH)
     14      1.1  joerg 
     15      1.1  joerg example:
     16      1.1  joerg   cd /d C:\code\llvm
     17      1.1  joerg   mkdir build & cd build
     18  1.1.1.2  joerg   cmake -DBUILD_CLANG_FORMAT_VS_PLUGIN=ON -DNUGET_EXE_DIR=C:\nuget ..
     19      1.1  joerg 
     20      1.1  joerg Once LLVM.sln is generated, build the clang_format_vsix target, which will build
     21      1.1  joerg ClangFormat.sln, the C# extension application.
     22      1.1  joerg 
     23      1.1  joerg The CMake build will copy clang-format.exe and LICENSE.TXT into the ClangFormat/
     24      1.1  joerg directory so they can be bundled with the plug-in, as well as creating
     25      1.1  joerg ClangFormat/source.extension.vsixmanifest. Once the plug-in has been built with
     26      1.1  joerg CMake once, it can be built manually from the ClangFormat.sln solution in Visual
     27      1.1  joerg Studio.
     28      1.1  joerg 
     29      1.1  joerg ===========
     30      1.1  joerg  Debugging
     31      1.1  joerg ===========
     32      1.1  joerg 
     33      1.1  joerg Once you've built the clang_format_vsix project from LLVM.sln at least once,
     34      1.1  joerg open ClangFormat.sln in Visual Studio, then:
     35      1.1  joerg 
     36      1.1  joerg - Make sure the "Debug" target is selected
     37      1.1  joerg - Open the ClangFormat project properties
     38      1.1  joerg - Select the Debug tab
     39      1.1  joerg - Set "Start external program:" to where your devenv.exe is installed. Typically
     40      1.1  joerg   it's "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"
     41      1.1  joerg - Set "Command line arguments" to: /rootsuffix Exp
     42      1.1  joerg - You can now set breakpoints if you like
     43      1.1  joerg - Press F5 to build and run with debugger
     44      1.1  joerg 
     45      1.1  joerg If all goes well, a new instance of Visual Studio will be launched in a special
     46      1.1  joerg mode where it uses the experimental hive instead of the normal configuration hive.
     47      1.1  joerg By default, when you build a VSIX project in Visual Studio, it auto-registers the
     48      1.1  joerg extension in the experimental hive, allowing you to test it. In the new Visual Studio
     49      1.1  joerg instance, open or create a C++ solution, and you should now see the Clang Format
     50      1.1  joerg entries in the Tool menu. You can test it out, and any breakpoints you set will be
     51      1.1  joerg hit where you can debug as usual.
     52