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

Hans Wennborg hans at chromium.org
Thu Nov 21 18:20:21 PST 2013


On Thu, Nov 21, 2013 at 5:55 PM, Alp Toker <alp at nuanti.com> wrote:
> Hi Hans,
>
> Impressed that you've coaxed cmake into building and bundling the VS
> package..

It's not exactly my proudest moment, but it seems to work ;)

> However not so convinced it's the right deployment model:
>
> 1) The installer gets copied into Program Files -- then what? Does the user
> have look for and install it separately, or is it the site administrator's
> job?

We could have the installer run it when it copies in the files for the
MSBuild integration. Or the user could install it manually - I'm kind
of torn about this.

> When the main uninstaller is run, does the extension get left behind?

That's definitely an issue. If we teach install.bat to install the
extension, uninstall.bat should remove it. From what I understand, the
way to do this is to find vsxinstaller.exe and run that with
/uninstall.

> If the main LLVM install is upgraded, what happens the the extension, and
> which clang-format.exe version will it end up calling into post-upgrade?

The new installer would presumably install the new extension too.

But note that the clang-format extension is just a thing that calls
clang-format in the LLVM installation dir. It doesn't contain a copy
of clang-format itself, so it will always just call what's installed.

> 2) The target audiences are fairly distinct. Most clang-format Visual Studio
> extension users likely don't want or need an LLVM installation. This is the
> crowd who'd benefit most from a single click installation on the download
> page that works the same way as other VS extensions.
>
> Wouldn't it make more sense to offer the Visual Studio extension as a
> separate download?

If we want to support that, we should bake clang-format into the
extension itself.

Manuel: maybe that's what we should be doing?


Thanks,
Hans

> On 22/11/2013 00:38, Hans Wennborg wrote:
>>
>> 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" />
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
> --
> http://www.nuanti.com
> the browser experts
>



More information about the cfe-commits mailing list