Hi Gilles,

good to hear C# support is working not only for me and some people are actually 
interested in it :-).

Thanks for the patch, I already added to my github. All the changes make 
perfectly sense for me.

Let me explain a bit more about things like hardcoding LangVersion in the 
module scripts etc. (in short, there is no reason for hardcoding langversion 3):

The current C# support was developed by plain trial-and-error. I started out 
copying the CXX compiler module scripts, finding out the relevant/necessary 
variables, trying to find reasonable values etc. By starting with a copy of the 
CXX scripts I am quite sure there are some leftovers that do not make sense 
there. To adapt everything for C# I started by looking at a existing .csproj 
file and changing the target generator until everything went as expected. 
Initial values like the flags in CMakeCSharpInformation.cmake where copied as 
is from my first simple reference .csproj files. Also the special handling of 
.xaml, .xaml.cs and .Designer.cs files with the <DependentUpon> tags was just 
introduced when I realized I need it somewhere in our new project.

Putting it all together I just want to say that the current state of 
development leaves room for a lot of improvement and if something seems like it 
could be done better, this is most probably the case. I really only pushed it 
to a level where I feel it's working well enough for me and I can focus on my 
actual job.

The part that probably needs most additional work is all the C# detection and 
configuration part in the module scripts. I got it all up and running so we can 
develop our C/C++/C# cross-platform software here, but it's still some steps 
away from a perfectly configurable solution where everyone could be happy.

best regards,
Michael


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

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.stuer...@schaeffler.com>; CMake 
Developers <cmake-developers@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.stuer...@schaeffler.com] 
Sent: Thursday, February 18, 2016 03:44
To: Gilles Khouzam <gilles.khou...@microsoft.com>; CMake Developers 
<cmake-developers@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.khou...@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-boun...@cmake.org] On Behalf Of 
Stuermer, Michael SP/HZA-ZSEP
Sent: Wednesday, February 10, 2016 06:03
To: CMake Developers <cmake-developers@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
 
 
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to