Hi Saif, 

1) 

I once wrote a wiki entry about setup with vs-code, which also at least got one 
update by Ivan: 

https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/wikis/Visual-Studio-Code-Setup-for-Linux-and-WSL


Dune and so Dumux is a conglomeration of cmake-projects which refer to each 
other. But the
actual place of the dependend modules is filled in by the configure step of a 
shell script named dunecontrol, which is 
usually used for building. 

Unfortunately it passes these paths-variables in a via commandline to the 
called cmake (i.e. that called inside the
dunecontrol-script), so they are not really good available to IDEs.

An IDE which recognises Dumux as cmake-project will typically fail in the 
cmake-configure step since  
often IDE call cmake-configure itself. That configuration is also the 
expectation of users of IDEs,
don't blame IDEs for doing it.  

Discussed in the mentioned wiki-entry above is to make settings of paths these 
directly in settings.json of the IDE vs-
code (one variable is needed per dune-module).  The given config is an example 
for dumux-course.

At least I got the language-server (vs-code intellisense) and also debugger 
working.
I'm not really a dumux-developer, so do not expect too much.  


2)

Another option is to setup your project with (manual crafted) 
CMakePresets.json, which should in theory do it too, 
agnostic of the used IDE. This is discussed in this dune-thread: 

https://gitlab.dune-project.org/core/dune-common/-/issues/372


I once tried it for visual studio code but the use/recognisement of 
CMakePresets.json by vs-code
let many other switches of that (vs-code) IDE unavailable.  Mostly I could not 
switch at that time 
between the different already defined targets.
I think it was possible to set preferred targets in the presets. 

Documentation for vs-code regarding use of cmake-presets: 
https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/cmake-presets.md

CMakePresets.json has of course documentation in the cmake-book and also in 
manual page (cmake, cmake-presets). 
For me it seemed it not as practical for the use of vs-code compared to what 
what I described in the wiki. 

3)

A third option sometimes used by developer seemed to be used is to make your 
IDE not to call "cmake-configure" and do
this by dunecontrol.  You have to tweak your IDE settings or use your IDE in 
way that it never calls the cmake-
configure. I think this is possible for vs-code.

You then should have all necessary settings in the so called cmake cache. 
As long as the IDE only calls the cmake-build, this is fine. 

4)

This section is more about getting to know how dunecontrol really acts together 
with cmake.
Dunecontrol is not really fun to read as source code. But: 

Dunecontrol lets (maybe as a resort for developers) pass in its own 
cmake-variant
by setting the environment-variable CMAKE to a path.
This lets in principle trace out calls to cmake with all arguments to wrapper 
script around the "real" cmake. 

Kind regards, 
David 

> Hello,
> 
> I would like to know if anyone was able to get DuMux running with an IDE 
> (e.g., VS Code or Visual Studio). I want to
> be able to debug and compile the code through the IDE. I can use DuMux fine 
> using wsl on Windows. No problems
> compiling and running tests/examples. But I want to run DuMux using an IDE. 
> If someone was able to get it working, can
> you provide a guide on how to do so from scratch? 
> 
> What do the developers typically use when working with DuMux? How do you 
> debug the code? What are best practices, in
> your experience, for debugging and developing code?
> 
> Best,
> 
> SA
> _______________________________________________
> DuMux mailing list
> [email protected]
> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to