[Dune-devel] CMake with Visual Studion/Windows
Christoph GrĂ¼ninger
christoph.grueninger at iws.uni-stuttgart.de
Mon Sep 1 08:41:56 CEST 2014
Hello my dear CMake friend,
recently I gave Windows a try and tried to compile Dune with
Visual Studio and CMake.
== Setup ==
- Windows 7
- Visual Studio 2013 Express (free/non-commercial version),
aka Microsoft's C++ compiler
- CMake 3.0
- Dune's master branch from July 2014
== Summary ==
- CMake works in general, thus I was not able to execute any
Dune program
- Interplay with Visual Studio (VS) is impracticable: You have
to run CMake for dune-common, build dune-common with VS, run
CMake for dune-geometry, build dune-geometry with VS and so
forth
- CTests creates no targets in VS, thus tests cannot be built
or run
- There are several Unix-specific code parts. With Cygwin and
MinGW they provide these headers but on pure Windows they do
not exist.
- Microsoft's C++ compiler struggles with some C++ constructs
we use:
+ it dislikes and, or, not instead of &&, ||, !
+ long literals for variable assignments with more then 64
(?) digits.
+ the template meta-programs in dune-grid and
dune-localfunctions fail to compile
== Glory Details ==
I spend one and a half days using Dune with Windows. Most of
the time took updating Windows with hundreds of updates and
dozens of restarts. Installing Visual Studio, a Git client and
CMake is less comfortable as I am used to, but it was done
quickly.
I had to disable the Fortran-enable hack. Right after that,
configure went through. Make obviously did not work, so I had
to open the build-directory with VS and could see several of
dune-common's build targets.
After some crude hacks I was able to build dune-common. The
attached patch contains all my changes to dune-common. They
are not meant to be productive code but to get the code
passing the compiler.
Next I had to call CMake for dune-geometry, adding
dune-common's build directory as an argument. The list of
arguments will grow with every module dependency and will get
impracticable for e.g. PDELab. Building dune-geometry was
possible after another round of quick hacks, cf. the other
attached patch.
Dune-grid and dune-localfunctions could not be compiled due to
some template meta-programing issue. Dune-istl does not build
a library, so there was nothing left to compile. I was not
able to run any of our test programs, as there were no
auto-generated build-targets for these and CTest wanted to
call make which did again not work. Maybe one could manually
add such a target, I did not try.
== lessens learned ==
- With CMake Windows support for Dune seems to be realistic
for the first time. Sure, there will be plenty to do but
technically it could be done.
- Microsoft's Visual Studio C++ 2013 compiler is better then I
thought. I hope with the next version it becomes even better.
I was not able to use the latest developer snapshot, as you
have to have an MSDN account or something similar.
- Intel's compiler license is very prohibitive in Windows
land. Another strong argument for open source. Maybe LLVM will
advance and can be included into VS .
- Our approach to create a CMake project per dune-module might
be a bad choice. For application modules that generates a
stack of ten or even more modules. Currently, I have no idea
how to do better, but a kind of meta-project would be helpful
and could save time during configure. But that's out of scope
as long as we stay compatible to autotools.
- I think with an Intel compiler (and an appropriate license)
a willing and skilled C++ programmer can port Dune to Windows.
Maybe we have to change the way we organize our tests.
Probably we have to figure out how to configure and build the
modules in a less manual and painful way.
Bye
Christoph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: common_0001-Make-compile-with-Visual-C-2013-using-Windows.patch
Type: application/octet-stream
Size: 5191 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20140901/b17684c9/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geometry_0001-Make-compile-with-Visual-C-2013-using-Windows.patch
Type: application/octet-stream
Size: 9158 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20140901/b17684c9/attachment-0001.obj>
More information about the Dune-devel
mailing list