Skip to content

Commit debad07

Browse files
committed
[web] Added docs on WSL usage.
1 parent db3aea9 commit debad07

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
+++
2+
date = "2020-05-15T10:46"
3+
title = "Windows Subsystem for Linux"
4+
author = "Lars Bilke"
5+
weight = 1042
6+
7+
[menu]
8+
[menu.devguide]
9+
parent = "advanced"
10+
+++
11+
12+
The [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) is an alternative way to setup a complete development environment on Windows. It offers a Linux environment with a seamless bridge to the Windows world. We recommend this setup for Windows developers.
13+
14+
## Setup
15+
16+
- Install WSL by following [this guide](https://www.windowscentral.com/install-windows-subsystem-linux-windows-10). **Important:** Choose **Ubuntu 20.04 LTS** as the Linux distribution. Other distros may not have a sufficient compiler.
17+
- Follow the [developer guide for Linux]({{< ref "prerequisites.pandoc" >}}) from now on.
18+
19+
## Using Visual Studio Code as IDE
20+
21+
You can use the native Windows Visual Studio Code IDE (VS Code) for developing in the WSL. It offers code completion, CMake integration, an integrated debugger, git integration and more.
22+
23+
### Setup
24+
25+
- In the WSL shell run `sudo apt update && sudo apt install -y ninja-build gdb`.
26+
- On Windows [install Visual Studio Code](https://code.visualstudio.com/docs/setup/windows)
27+
- Open VS Code and install the [VS Code Remote Development](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) extension
28+
- In the WSL shell go to your OGS source code and run `code .`. This will open the source code in VS Code.
29+
- Install the [C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools), [CMake](https://marketplace.visualstudio.com/items?itemName=twxs.cmake) and [CMake Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) extensions
30+
31+
### Build and debug OGS
32+
33+
- Configure your project by following [this guide](https://vector-of-bool.github.io/docs/vscode-cmake-tools/getting_started.html#configuring-your-project). Select `GCC 9.3.0` as the [CMake kit](https://vector-of-bool.github.io/docs/vscode-cmake-tools/kits.html#kits).
34+
- Follow [this guide](https://vector-of-bool.github.io/docs/vscode-cmake-tools/debugging.html#selecting-a-launch-target) for debug a target. Select `ogs` as the debug target.
35+
36+
## Additional notes
37+
38+
The filesystem of the WSL is not inside your regular user directories. You can find it by running `explorer.exe .` inside the WSL shell. It should be something like `\\wsl$\Ubuntu-20.04\home\[username]\...`.
39+
40+
You can also run OGS inside the WSL with benchmarks located in your regular Windows directories. You regular filesystem can be accessed inside WSL with the `/mnt/c/`-prefix. E.g. to run an OGS benchmark:
41+
42+
```bash
43+
bin/ogs -o _out /mnt/c/Users/[username]/ogs-src/Tests/Data/Elliptic/square_1x1_SteadyStateDiffusion/square_1e0.prj
44+
```

web/content/docs/devguide/getting-started/prerequisites.pandoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ The minimum prerequisites to build OGS are:
2222
## Step: Install a compiler
2323

2424
::: {.win}
25+
26+
::: {.note}
27+
### Alternative setup
28+
29+
Please note that the following setup on Windows is the **native Windows development setup**. This native setup is **quite involved** and **heavy on system resources**. We can recommend an alternative setup in which the [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) is used: Setup and development of OGS follows the Linux way but you can use your Windows IDE (especially Visual Studio Code) for development and debugging. If this sounds interesting please [follow the steps here]({{< ref "wsl.pandoc" >}})!
30+
:::
31+
2532
As we use lots of features of the C++17-standard we support **Visual Studio {{< dataFile "versions.minimum_version.msvc.year" >}}** and up. Therefore you will need at least **Windows 7** (64-bit recommended). It is perfectly fine to use the free Community Edition of Visual Studio.
2633

2734
- Download and install [Visual Studio Community](https://www.visualstudio.com)

web/content/docs/devguide/troubleshooting/build.pandoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ weight = 1043
1212

1313
## Visual Studio out-of-heap or stackoverflow errors
1414

15+
::: {.note}
16+
**Note:** To prevent this you can also use the [WSL setup]({{< ref "wsl.pandoc" >}}).
17+
:::
18+
1519
The compilation especially of the processes in Release-config can be very memory hungry. Using dynamic Eigen shape matrices can reduce memory usage:
1620

1721
```
@@ -29,3 +33,4 @@ If this still fails you can disable building of the failing processes, e.g.:
2933
```
3034
cmake . -DOGS_BUILD_PROCESS_HT=OFF
3135
cmake --build . --config Release -j 1
36+
```

0 commit comments

Comments
 (0)