[cmake-developers] C# support?

Stuermer, Michael SP/HZA-ZSEP michael.stuermer at schaeffler.com
Thu Jul 2 09:53:44 EDT 2015


Hi all,

I got the first sort of working version running. Would be great if some people could have a look at it if it's going into a good direction.

Some explanations:

Patch 0001:
 - adds the necessary Module/* files for enabling C# as a language
 - CAUTION: only Visual Studio 2013 generators are supported at the moment
 - there is a verbose message which is shown when C# is used to guide people where to go for improvement

Patch 0002:
 - some minor changes to mostly visual studio related classes to enable .csproj support
   o .csproj GUID is added
   o a method to check if the target is C# is added

Patch 0003:
 - the actual implementation of the .csproj generation
 - all generation takes place inside VisualStudio10TargetGenerator class


There is an example project in the appendix of this mail which you can use to see how .csproj can be generated now.

And yes, there are still quite some things missing:
 
 - Tests (!!!!)
 - NMake support (even though that should not bee too hard)
   o better handling of the flagtable that I added (not sure if I understood correctly how the concept is supposed to be used)
 - documentation (!!!!)

Most questions on how to use the C# language and mixing with C++ targets should be answered by looking at the example project.

Some VS_* target properties already existed which I reused.

I added two Property-"Groups":
 - VS_DOTNET_REFERENCE_<NAME>        properties for references with a <Hint> tag, though they 
                                     also can be added to the normal VS_DOTNET_REFERENCES. This is
                                     a target-property
 - CSharpPROJ_<name>                 the tag <name> will be added to the <Compile> tag of the specified
                                     Source files. This is a source property.
 - CSharpPROJ_SubType                the currently only used case of above property group. It's needed
                                     to tell visual studio what kind of file is added. You can safely omit
                                     this, but visual studio will not be able to run the designer in the
                                     correct mode without it.

Project references are added by simply using target_link_libraries(). All other references must use done in one of the above described ways.

It would be great if some people could try if the example project works for them. If you have improvements don't hesitate to submit any patch to my current fork on github (branch "csharp"):

https://github.com/micst/CMake.git

The example project can be found there as well:

https://github.com/micst/CMakeCSharpTest.git


best regards,
Michael



> -----Original Message-----
> From: cmake-developers [mailto:cmake-developers-bounces at cmake.org] On
> Behalf Of Brad King
> Sent: Tuesday, June 30, 2015 3:49 PM
> To: cmake-developers at cmake.org
> Subject: Re: [cmake-developers] C# support?
> 
> On 06/30/2015 03:21 AM, Stuermer, Michael SP/HZA-ZSEP wrote:
> > it would be great if some people could step forward once everything
> is
> > running from my side to help get makefile and linux support (and test
> > other Visual Studio versions).
> 
> Once you have it working in VS 2013 the other VS >= 2010 versions
> should be easy.  I'm not sure about other generators yet.  If you have
> good coverage in the test suite updates then that will make the task of
> adding support to other generators easier.
> 
> For now you can have CMakeDetermineCSharpCompiler do a
> message(FATAL_ERROR) when CMAKE_GENERATOR is set to a value that is not
> supported.  That can be lifted when the other generators implement the
> language.
> 
> > About enable_language():
> >
> > have the appropriate cmake-scripts in "Module" directory
> [snip]
> > Almost everything relevant goes in the target generator class
> > VisualStudio10TargetGenerator.
> 
> Great!
> 
> > Once done, do you want patchfiles here on the list or a pull request
> > from my fork on github?
> 
> Please send patch files here as requested in CONTRIBUTING.rst.
> Please re-organize commits into a logical series of updates rather than
> the original unorganized development history.
> 
> Thanks!
> -Brad
> 
> --
> 
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-adding-CSharp-support-adding-some-necessary-methods.patch
Type: application/octet-stream
Size: 6473 bytes
Desc: 0002-adding-CSharp-support-adding-some-necessary-methods.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150702/ffb8eaf8/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-adding-CSharp-support-adding-generation-of-csproj.patch
Type: application/octet-stream
Size: 52433 bytes
Desc: 0003-adding-CSharp-support-adding-generation-of-csproj.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150702/ffb8eaf8/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake-csharp-testproject.zip
Type: application/x-zip-compressed
Size: 56438 bytes
Desc: cmake-csharp-testproject.zip
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150702/ffb8eaf8/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-adding-CSharp-support-adding-language-support.patch
Type: application/octet-stream
Size: 19276 bytes
Desc: 0001-adding-CSharp-support-adding-language-support.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150702/ffb8eaf8/attachment-0005.obj>


More information about the cmake-developers mailing list