summaryrefslogtreecommitdiffstats
path: root/tools/clang-format-vs
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2013-12-03 18:02:51 +0000
committerHans Wennborg <hans@hanshq.net>2013-12-03 18:02:51 +0000
commitea654c32d9d69ff1ece6211fc5cf92f1e0a9e3e2 (patch)
tree43b3dca287b5d0ef9d10cb1d7759920f86cf2e4d /tools/clang-format-vs
parent95cedc0524d4c3888ce725395ecc8a6b2faffa89 (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-format-vs')
-rw-r--r--tools/clang-format-vs/CMakeLists.txt16
-rw-r--r--tools/clang-format-vs/README.txt3
2 files changed, 19 insertions, 0 deletions
diff --git a/tools/clang-format-vs/CMakeLists.txt b/tools/clang-format-vs/CMakeLists.txt
new file mode 100644
index 0000000000..f38213f0e3
--- /dev/null
+++ b/tools/clang-format-vs/CMakeLists.txt
@@ -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()
diff --git a/tools/clang-format-vs/README.txt b/tools/clang-format-vs/README.txt
index d74060e19a..b87df6e923 100644
--- a/tools/clang-format-vs/README.txt
+++ b/tools/clang-format-vs/README.txt
@@ -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.