[cmake-developers] C# support?

Stuermer, Michael SP/HZA-ZSEP michael.stuermer at schaeffler.com
Tue Jun 30 03:21:35 EDT 2015


Hi and thanks for all your answers,

Let me give you some information how things are implemented so far and where my constraints in implementing C# support are:

At the moment I have only Visual Studio 2013 available, which makes it hard for me to test any other generators. NMake is not a priority for me, but the concept of the Visual Studio generators in CMake is so nice implemented, that it should not be much of a problem to get this running. I will have a look on this once Visual Studio generators are working. I will be able to test some linux/mono functionality in VirtualBox, but I will most probably not have much time. We are working on Windows based software here and I will not be allowed to spent a vast amount of time working on non-project related topics.

In short: 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).

About enable_language():

Working. From my knowledge it's mainly about have the appropriate cmake-scripts in "Module" directory. That's done, my test project builds well with it. Ok, the CMakeTest... script simply sets "WORKS" to true ... that could be improved ...

About .csproj files:

It's almost done, the files are generated already and working well. There still needs to be some cleaning and generalization to use parameters instead of hard coded information.

About intrusiveness:

Almost everything relevant goes in the target generator class VisualStudio10TargetGenerator. The necessary .cmake files for the language are added and some minor changes to other generator sources are needed (for setting target type GUID in .sln etc.). All changes so far are made to be as minimal as possible to the original cmake sources and I believe it blends in quite well. Credit goes to the guys who implemented the VisualStudio generator concept with the flagmaps. You need some time to understand it, but once you've got it it's really great.

About C#/.NET:

I'm new to .NET and C# as well, but it seems not to provide too many surprises. Nevertheless some challenges remain to come up with a good solution for C# integration. It's mainly about reference handling. I have a working example at the moment, but it could be improved further.

About the language:

Would it be ok to name the language in CMake "CS" instead of "CSharp"? I did everything as "CS" so far...

About contributing:

Once done, do you want patchfiles here on the list or a pull request from my fork on github?

---------------------------------------------------

If someone is interested in the development so far, you can check out my CMake fork here (have a look at the "csharp" branch):

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

The test project with mixed C++/C# targets, cross-referencing from

C++ <--> managed C++ <--> C#

can be found here:

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


best regards,
Michael


> -----Original Message-----
> From: cmake-developers [mailto:cmake-developers-bounces at cmake.org] On
> Behalf Of David Cole via cmake-developers
> Sent: Monday, June 29, 2015 7:31 PM
> To: Brad King
> Cc: cmake-developers at cmake.org
> Subject: Re: [cmake-developers] C# support?
> 
> The C# compiler, csc.exe, takes all its arguments at once in one call
> to build a library or executable. Listing all the sources, and its
> references (other libraries it depends on) all at once. You can do it
> as command line arguments, or as contents of a response file, or a
> combination or arguments plus response file.
> 
> Conceptually, it's "just like Java."
> 
> They do have separate project files for it with VS, though. The
> generators will need code to generate *.csproj files, rather than
> custom commands in a vcxproj file, to make it seem like it's really
> well-integrated with VS. Not sure if *.csproj files have evolved much
> over the last few releases of VS -- I'd expect the major challenge with
> this to be making sure CMake generates proper *.csproj files for
> however many versions of VS it would take to make it acceptable.
> 
> 
> D
> 
> 
> 
> On Mon, Jun 29, 2015 at 1:05 PM, Brad King <brad.king at kitware.com>
> wrote:
> > On 06/26/2015 10:47 AM, Stuermer, Michael SP/HZA-ZSEP wrote:
> >> Does it have a realistic chance to be accepted for upstream
> >
> > Yes, so long as it comes with proper tests and is not too intrusive
> on
> > the overall design/implementation of CMake.
> >
> > In order to enable use of C# sources we should get
> >
> >  enable_language(CSharp)
> >
> > to work.  This is likely straightforward with the VS generators.
> >
> > One question is how things should be done for the Makefile and Ninja
> > generators.  For these we need to construct command line invocations
> > of the compiler.  I'm not very familiar with C#.
> > Does it need separate compilation with dependencies or should one
> > simply invoke the compiler with the entire list of sources in a
> > response file or something?
> >
> > 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
> --
> 
> 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


More information about the cmake-developers mailing list