[PATCH] CMake: Enable building clang-format's Visual Studio plugin

Hans Wennborg hans at chromium.org
Thu Nov 21 16:38:11 PST 2013


Hi klimek, rnk,

This is pretty hacky, but it's hidden away in a corner behind a flag that's off by default.

Having this flag enables us to build and include the plugin in the installer, which is nice.

The .csproj changes were necessary for building the project on my machine. I don't really know what they mean.

http://llvm-reviews.chandlerc.com/D2248

Files:
  tools/CMakeLists.txt
  tools/clang-format-vs/CMakeLists.txt
  tools/clang-format-vs/ClangFormat/ClangFormat.csproj

Index: tools/CMakeLists.txt
===================================================================
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -2,6 +2,7 @@
 add_subdirectory(driver)
 if(CLANG_ENABLE_REWRITER)
   add_subdirectory(clang-format)
+  add_subdirectory(clang-format-vs)
 endif()
 
 if(CLANG_ENABLE_ARCMT)
Index: tools/clang-format-vs/CMakeLists.txt
===================================================================
--- /dev/null
+++ tools/clang-format-vs/CMakeLists.txt
@@ -0,0 +1,6 @@
+option(CLANG_FORMAT_BUILD_VS_PLUGIN "Build clang-format VS plugin" OFF)
+if (CLANG_FORMAT_BUILD_VS_PLUGIN)
+  add_custom_target(CLANG_FORMAT_VSIX ALL
+    COMMAND devenv "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat.sln" /Build Release)
+  install(FILES ClangFormat/bin/Release/ClangFormat.vsix DESTINATION tools/)
+endif()
Index: tools/clang-format-vs/ClangFormat/ClangFormat.csproj
===================================================================
--- tools/clang-format-vs/ClangFormat/ClangFormat.csproj
+++ tools/clang-format-vs/ClangFormat/ClangFormat.csproj
@@ -13,7 +13,7 @@
     <AssemblyName>ClangFormat</AssemblyName>
     <SignAssembly>true</SignAssembly>
     <AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
     <FileUpgradeFlags>
     </FileUpgradeFlags>
@@ -35,6 +35,7 @@
     <IsWebBootstrapper>false</IsWebBootstrapper>
     <UseApplicationTrust>false</UseApplicationTrust>
     <BootstrapperEnabled>true</BootstrapperEnabled>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -44,6 +45,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -53,6 +55,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <RunCodeAnalysis>true</RunCodeAnalysis>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="Microsoft.CSharp" />
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2248.1.patch
Type: text/x-patch
Size: 2428 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131121/af0106b0/attachment.bin>


More information about the cfe-commits mailing list