r196299 - CMake: enable building the clang-format vs plugin

Hans Wennborg hans at hanshq.net
Tue Dec 3 10:02:52 PST 2013


Author: hans
Date: Tue Dec  3 12:02:51 2013
New Revision: 196299

URL: http://llvm.org/viewvc/llvm-project?rev=196299&view=rev
Log:
CMake: enable building the clang-format vs plugin

This makes it possible to build the clang-format vs plugin from the cmake build.
It is a hack, as it shells out to "devenv" to actually build it, but it's hidden
away in a corner behind a flag, and it provides a convenient way of building the
plug-in from the command-line together with the rest of clang.

Differential Revision: http://llvm-reviews.chandlerc.com/D2310

Added:
    cfe/trunk/tools/clang-format-vs/CMakeLists.txt
Modified:
    cfe/trunk/tools/CMakeLists.txt
    cfe/trunk/tools/clang-format-vs/README.txt

Modified: cfe/trunk/tools/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CMakeLists.txt?rev=196299&r1=196298&r2=196299&view=diff
==============================================================================
--- cfe/trunk/tools/CMakeLists.txt (original)
+++ cfe/trunk/tools/CMakeLists.txt Tue Dec  3 12:02:51 2013
@@ -2,6 +2,7 @@ add_subdirectory(diagtool)
 add_subdirectory(driver)
 if(CLANG_ENABLE_REWRITER)
   add_subdirectory(clang-format)
+  add_subdirectory(clang-format-vs)
 endif()
 
 if(CLANG_ENABLE_ARCMT)

Added: cfe/trunk/tools/clang-format-vs/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/CMakeLists.txt?rev=196299&view=auto
==============================================================================
--- cfe/trunk/tools/clang-format-vs/CMakeLists.txt (added)
+++ cfe/trunk/tools/clang-format-vs/CMakeLists.txt Tue Dec  3 12:02:51 2013
@@ -0,0 +1,16 @@
+option(BUILD_CLANG_FORMAT_VS_PLUGIN "Build clang-format VS plugin" OFF)
+if (BUILD_CLANG_FORMAT_VS_PLUGIN)
+  add_custom_target(clang_format_exe_for_vsix
+      ${CMAKE_COMMAND} -E copy_if_different
+      "${LLVM_TOOLS_BINARY_DIR}/clang-format.exe"
+      "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/clang-format.exe"
+      DEPENDS clang-format)
+
+  add_custom_target(clang_format_vsix ALL
+      devenv "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat.sln" /Build Release
+      DEPENDS clang_format_exe_for_vsix
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different
+      "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/bin/Release/ClangFormat.vsix"
+      "${LLVM_TOOLS_BINARY_DIR}/ClangFormat.vsix"
+      DEPENDS clang_format_exe_for_vsix)
+endif()

Modified: cfe/trunk/tools/clang-format-vs/README.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/README.txt?rev=196299&r1=196298&r2=196299&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format-vs/README.txt (original)
+++ cfe/trunk/tools/clang-format-vs/README.txt Tue Dec  3 12:02:51 2013
@@ -8,3 +8,6 @@ Build prerequisites are:
 
 clang-format.exe must be copied into the ClangFormat/ directory before building.
 It will be bundled into the .vsix file.
+
+The extension can be built manually from ClangFormat.sln (e.g. by opening it in
+Visual Studio), or with cmake by setting the BUILD_CLANG_FORMAT_VS_PLUGIN flag.





More information about the cfe-commits mailing list