summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/tools/CMakeLists.txt1
-rw-r--r--clang/tools/clang-format-vs/CMakeLists.txt16
-rw-r--r--clang/tools/clang-format-vs/README.txt3
3 files changed, 20 insertions, 0 deletions
diff --git a/clang/tools/CMakeLists.txt b/clang/tools/CMakeLists.txt
index fef0adc6215..58be615e85c 100644
--- a/clang/tools/CMakeLists.txt
+++ b/clang/tools/CMakeLists.txt
@@ -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)
diff --git a/clang/tools/clang-format-vs/CMakeLists.txt b/clang/tools/clang-format-vs/CMakeLists.txt
new file mode 100644
index 00000000000..f38213f0e36
--- /dev/null
+++ b/clang/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/clang/tools/clang-format-vs/README.txt b/clang/tools/clang-format-vs/README.txt
index d74060e19a4..b87df6e9237 100644
--- a/clang/tools/clang-format-vs/README.txt
+++ b/clang/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.
OpenPOWER on IntegriCloud