Skip to content

Commit 7e25927

Browse files
author
Greg Van Liew
authored
Merge pull request #2 from lukka/dev/lucappa/wsl_provisioning_docs
add docs about "automatic WSL provisioning on Codespace"
2 parents 41eb46b + 0cbd6e1 commit 7e25927

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed
Loading

docs/devinit/sample-opencv.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: OpenCV
3-
description: Example customization using devinit for the opencv/opencv repo.
3+
description: Example customization using devinit to target both Linux and Windows for the OpenCV repository.
44
ms.date: 08/28/2020
55
ms.topic: reference
66
author: andysterland
@@ -14,31 +14,55 @@ ms.technology: devinit
1414
---
1515
# OpenCV
1616

17-
This example illustrates the customizations needed to by [OpenCV](https://github.com/opencv/opencv) to be automatically provisioned with [GitHub Codespaces]https://github.com/features/codespaces).
17+
This example illustrates how to customize [GitHub Codespaces](https://github.com/features/codespaces) in order to develop with a multiplatform projects such as [opencv/OpenCV](https://github.com/opencv/opencv).
1818

19-
## .devinit.json
19+
The following customizations are already applied on the fork [microsoft/OpenCV](https://github.com/microsoft/opencv) and allow to build targeting either Windows and Ubuntu.
2020

21-
Contents of the [_.devinit.json_](devinit-json.md) file. This file needs to be in the same folder as _.devcontainer.json_.
21+
## Customization with devcontainer.json and devinit.json
22+
23+
The `.devcontainer` directory needs to contain the following files:
24+
25+
* devcontainer.json
26+
* devinit.json
27+
28+
### devcontainer.json
29+
30+
The following is the content of the _devcontainer.json_ file.
31+
32+
```json
33+
{
34+
"postCreateCommand": "devinit init"
35+
}
36+
```
37+
38+
The `postCreateCommand` launches the [devinit](devinit-and-codespaces.md) tool, which consumes _devinit.json_.
39+
40+
41+
### devinit.json
42+
43+
The following is the content of the [_devinit.json_](devinit-json.md) file.
2244

2345
```json
2446
{
2547
"run": [
2648
{
27-
"comments": "Example that will install Ubuntu 20.04 using WSL2, and configure it with various packages.",
49+
"comments": "Example that will install Ubuntu 20.04 using WSL2, and configure it with various packages useful for C++ development.",
2850
"tool": "wsl-install",
2951
"input": "https://aka.ms/wslubuntu2004",
3052
"additionalOptions": "--wsl-version 2 --post-create-command 'apt-get update && apt-get install g++ gcc g++-9 gcc-9 cmake gdb ninja-build zip rsync -y'"
3153
}
3254
]
3355
}
3456
```
57+
The _devinit.json_ is the file consumed by the [devinit](devinit-and-codespaces.md) tool and it must be in the same directory of _devcontainer.json_.
3558

36-
## .devcontainer.json
59+
In this sample, the [wsl-install](tool-wsl-install.md) tool is used to create a WSL instance running Ubuntu 20.04, and provisioning it with essential C++ development tools.
60+
## Targeting Windows or Linux
3761

38-
Contents of the _.devcontainer.json_ file in the repo root.
62+
A default build configuration targeting Windows is always created named `x64-Debug`.
3963

40-
```json
41-
{
42-
"postCreateCommand": "devinit init"
43-
}
44-
```
64+
By adding the above mentioned files, upon Codespace instance creation, Visual Studio provisions a new SSH connection in the [Connection Manager](/cpp/linux/connect-to-your-remote-linux-computer), and creates a new configuration in the Configuration picker that targets the Ubuntu instance via the SSH connection.
65+
66+
![Configuration targeting Ubuntu](media/wsl_ssh_linux_configuration.png).
67+
68+
By selecting the highlighted configuration that targets WSL, it is possible to build and debug the OpenCV's build targets.

0 commit comments

Comments
 (0)