[Dune-devel] CMake with Visual Studio / Windows
Christoph GrĂ¼ninger
christoph.grueninger at iws.uni-stuttgart.de
Wed Oct 1 23:18:21 CEST 2014
Hi,
it's me again, back from Windows. I tried to use Visual Studio
2013
together with Clang 3.5.0 as the latter gained some Windows
compatibility.
== Tl;dr ==
Clang does not yet support try and throw. Thus I was not able
to
compile dune-common. Maybe one could patch it out, but yeah,
you
name it.
So I am still lacking a functioning compiler on Windows. I'll
retry
with Clang 3.6 and/or Visual Studio 2014. Microsoft
implemented
already a host of C++11 features and even some C++14 ones.
== Lessons learned ==
I write them down so they won't get lost.
- With -T <toolchain> the user can select a toolchain. So it
will
still use Visual Studio as the build system, but use Clang
or
the Intel compiler. The <toolchain> is a string that is
difficult
to guess and I could not find it in the CMake
documentation.
Examples are "LLVM-vs2012" and "Intel C++ Compiler XE
12.1".
- Clang offers a wrapper that behaves similar to Microsoft's
compiler cl.exe. The wrapper is called clang-cl.exe. No
flag is
needed to use the C++11 mode.
- You have to make sure that the environment is configured to
locate the Visual Studio headers and such. Otherwise weired
error occur. You can either open a cmd that has the stuff
preloaded. You can find it in the Start menu > Programs >
Visual Studio > Other Visual Studio tool > select the right
cmd.
Or you can call Visual Studio's vcvarsall.bat script, that
does
the same.
- With cmake --build <path> the build tool can be invoked.
This
is more general than "make" as it works for ninja-build and
Visual Studio as well. With that one can compile in the
command
windown without switching to the IDE.
So far
Christoph
P.S.: For German-speaking people it is obvious why Windows 9
([nein])
will be skipped.
More information about the Dune-devel
mailing list