[cmake-developers] C# support ready for review

Gilles Khouzam Gilles.Khouzam at microsoft.com
Thu Feb 25 02:43:40 EST 2016


Hi Michael,

Things are looking really good, I've just converted one of my personal projects to using CMake in very little time.

I've included a small patch for your CSharp implementation.

The first change is to add support to specify C# 6.0 in the flag table.
The second removes the exception handling tag and the precompiled header tags since they don't make sense for C#, as well as adding a space between the platform comparisons. The space is not necessary for the project, but is you make any change in the property page inside of VS, a new property group is created instead of modifying the existing one. While this would not be a typical CMake scenario, it might be better to stay consistent with how VS and MSBuild process the file.

The next thing that I want to start looking at, is to make this work for Windows Phone and Windows Store apps, so that it can match the support that we have with C++ in this regards.

From: Gilles Khouzam
Sent: Wednesday, February 24, 2016 14:47
To: 'Stuermer, Michael SP/HZA-ZSEP' <michael.stuermer at schaeffler.com>; CMake Developers <cmake-developers at cmake.org>
Subject: RE: C# support ready for review

Hi Michael,

I've had more time to try this, what is the reasoning to hardcode the default LangVersion to 3 in Modules\CMakeCSharpInformation.cmake? Can we remove it? I'm trying this on some projects of mine.

From: Stuermer, Michael SP/HZA-ZSEP [mailto:michael.stuermer at schaeffler.com]
Sent: Thursday, February 18, 2016 03:44
To: Gilles Khouzam <Gilles.Khouzam at microsoft.com<mailto:Gilles.Khouzam at microsoft.com>>; CMake Developers <cmake-developers at cmake.org<mailto:cmake-developers at cmake.org>>
Subject: RE: C# support ready for review

Hi Gilles,

you are right about the specific user path. I already fixed this in my github "csharp" branch. Sorry for the inconvenience.

As for the discrepancies: I just found out that my TortoiseGitMerge tool was not configured correctly: changes in comments where ignored (which is not what I wanted). I'll go over the patch again and remove the changes that are irrelevant to the C# features.

Thanks for the hint on using MSBuild detection. I currently use the msbuild version that is provided automatically by visual studio, so I do not need any real detection. I didn't dig too deep into MSBuild versions, .NET framework versions, what can be configured etc. The configuration possibilities and what would make sense especially for other developers as well is something that should be discussed.

My main aim was to be able to work with C# and .NET in a similar way as Visual Studio provides it. I only started C# development during the last year, so many things concerning configuration etc. could probably be improved.

I'll post a new version of the patch later (or tomorrow) with the mentioned changes.

best regards,
Michael


From: Gilles Khouzam [mailto:Gilles.Khouzam at microsoft.com]
Sent: Thursday, February 18, 2016 8:17 AM
To: Stuermer, Michael SP/HZA-ZSEP; CMake Developers
Subject: RE: C# support ready for review

Hi Michael,

Great work, this looks really good.

I have a few comments on the changes.


1.       You should use the registry to find the install path for MSBuild, it should be in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\MSBuild with the version that you're looking for. This also bring the question of do you want to be able to specify the version of MSBuild that is used or base it off the generator?

2.       In CMakeTestCSharpCompiler, you seem to still have a reference to your specific user path (COPY_FILE "C:/Users/stuermic/git/cmake_build/x64_14/Tests/CSharp"))

You seem to have some slight discrepancies between your code and the release as there are changes that seem to be either unnecessary or going backwards. I noticed a tegra comment that seemed out of place as well as a comment change going from 14 to 12 where 14 was accurate.

I'll try to play with this next week and get projects running on it.

~Gilles

From: cmake-developers [mailto:cmake-developers-bounces at cmake.org] On Behalf Of Stuermer, Michael SP/HZA-ZSEP
Sent: Wednesday, February 10, 2016 06:03
To: CMake Developers <cmake-developers at cmake.org<mailto:cmake-developers at cmake.org>>
Subject: [cmake-developers] C# support ready for review

Native C# support is ready for review. I split the patch in two parts:

part 1:

Some preparational stuff that does not really change or enable anything. Documentation and Test files as well as the required CMake module is added. The changes to existing code are small, only few methods in existing classes are added/changed. Changes to existing code should be easy to review in this part

part 2:

This contains the main work. Almost everything takes place within cmVisualStudio10TargetGenerator.


In addition to C# support three more target properties were introduced:

*       VS_USER_PROPS_CXX (allows use of custom .user.props MSBuild file in .vcxproj files)
*       VS_USER_PROPS_CSHARP (allows use of custom .user.props MSBuild file in .csproj files)
*       VS_DEBUGGER_WORKING_DIRECTORY (allows setting of debugger working directory in .vcxproj files)

I tested the features using Visual Studio 2010-2015 in 32/64 bit and everything works on my machine so far.

Please review/test/comment and give feedback what is necessary to get native C# support in upstream cmake.

best regards,
Michael


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160225/bf795214/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-CSharp-Patch-Lang60-Formatting.patch
Type: application/octet-stream
Size: 3019 bytes
Desc: 0001-CSharp-Patch-Lang60-Formatting.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160225/bf795214/attachment-0001.obj>


More information about the cmake-developers mailing list