Skip to content

Commit 50239fe

Browse files
committed
Merged PR 10464915: Add configs for build and debug with VS Code
## Description: This PR adds some ease of use functionality for building and debugging SymCrypt using VS Code on Windows. First this PR adds a default terminal profile that runs Visual Studio's developer console so CMake and other build tools are available in the terminal environment. This needs to be setup using the `Setup` VS Code task. The `Setup` task also sets up Python virtual environment at `.\.venv` so the project is ready to build. Tasks can be executed in the `F1` command palette menu with `Tasks: Run Task` command, followed by selecting the `Setup` task. There are also other tasks that builds SymCrypt in various configurations after `Setup` is ran e.g. `Build [Debug]`. Build tasks can also be ran using `Ctrl+Shift+B` or via build buttons which can be added to GUI in the VS Code Explorer view using the `spmeesseman.vscode-taskexplorer` extension. This PR also adds launch configurations for running and debugging SymCrypt using `F5` key in VS Code. The run configurations can be selected in the `Run and Debug` view in VS Code. ## Admin Checklist: - [ ] You have updated documentation in symcrypt.h to reflect any changes in behavior - [ ] You have updated CHANGELOG.md to reflect any changes in behavior - [ ] You have updated symcryptunittest to exercise any new functionality - [ ] If you have introduced any symbols in symcrypt.h you have updated production and test dynamic export symbols (exports.ver / exports.def / symcrypt.src) and tested the updated dynamic modules with symcryptunittest - [ ] If you have introduced functionality that varies based on CPU features, you have manually tested with and without relevant features - [ ] If you have made significant changes to a particular algorithm, you have checked that performance numbers reported by symcryptunittest are in line with expectations - [ ] If you have added new algorithms/modes, you have updated the status indicator text for the associated modules if necessary Add configs for build and debug with vscode
1 parent b893aa9 commit 50239fe

File tree

4 files changed

+236
-3
lines changed

4 files changed

+236
-3
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ __pycache__/
5353
*.py[cod]
5454
*$py.class
5555

56-
# VSCode uses a .vscode directory to store extension data.
57-
.vscode/
56+
# Python environment
57+
.venv
5858

5959
# Visual Studio 2017 uses a .vs directory to store language service database and other files
6060
.vs/
@@ -82,4 +82,4 @@ CMakeCache.txt
8282
Makefile
8383

8484
# Local Guardian configuration
85-
.gdn
85+
.gdn

.vscode/launch.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "(Windows) symcryptunittest",
9+
"type": "cppvsdbg",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/bin/exe/symcryptunittest.exe",
12+
"args": [],
13+
"stopAtEntry": false,
14+
"cwd": "${fileDirname}",
15+
"environment": [],
16+
// "preLaunchTask": "Build",
17+
"console": "integratedTerminal",
18+
"internalConsoleOptions": "openOnSessionStart"
19+
},
20+
{
21+
"name": "(Windows) symcryptunittest [+openssl +symcrypt +xtsaes]",
22+
"type": "cppvsdbg",
23+
"request": "launch",
24+
"program": "${workspaceFolder}/bin/exe/symcryptunittest.exe",
25+
"args": [
26+
"+openssl",
27+
"+symcrypt",
28+
"+xtsaes",
29+
],
30+
"stopAtEntry": false,
31+
"cwd": "${fileDirname}",
32+
"console": "integratedTerminal",
33+
},
34+
{
35+
"name": "(Windows) symcryptunittest [+openssl +symcrypt +xtsaes -vaes]",
36+
"type": "cppvsdbg",
37+
"request": "launch",
38+
"program": "${workspaceFolder}/bin/exe/symcryptunittest.exe",
39+
"args": [
40+
"+openssl",
41+
"+symcrypt",
42+
"+xtsaes",
43+
"-vaes"
44+
],
45+
"stopAtEntry": false,
46+
"cwd": "${fileDirname}",
47+
"console": "integratedTerminal",
48+
},
49+
]
50+
}

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"terminal.integrated.defaultProfile.windows": "SymCrypt Profile",
3+
"terminal.integrated.profiles.windows": {
4+
"SymCrypt Profile": {
5+
"args": [
6+
"-noe",
7+
"-c",
8+
"&{ if (test-path ${workspaceFolder}\\.venv\\profile.ps1) { . ${workspaceFolder}\\.venv\\profile.ps1 } }"
9+
],
10+
"source": "PowerShell",
11+
"icon": "terminal-powershell",
12+
"overrideName": true,
13+
}
14+
}
15+
}

.vscode/tasks.json

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
{
2+
"version": "2.0.0",
3+
"windows": {
4+
"options": {
5+
"shell": {
6+
"executable": "powershell.exe",
7+
"args": [
8+
"-command",
9+
"& { if (test-path ${workspaceFolder}\\.venv\\profile.ps1) { . ${workspaceFolder}\\.venv\\profile.ps1 } };"
10+
]
11+
}
12+
},
13+
},
14+
"tasks": [
15+
{
16+
"label": "Setup",
17+
"type": "shell",
18+
"command": [
19+
"python -m venv .venv;",
20+
". .\\.venv\\Scripts\\activate.ps1;",
21+
"pip install -r .\\scripts\\requirements.txt;",
22+
"Set-Content -value ('pushd;\n& \"\"\"' + (resolve-path 'C:\\Program Files\\Microsoft Visual Studio\\*\\*\\Common7\\Tools\\Launch-VsDevShell.ps1').path + '\"\"\" -Arch $env:PROCESSOR_ARCHITECTURE -HostArch $env:PROCESSOR_ARCHITECTURE;\npopd') -path '${workspaceFolder}\\.venv\\profile.ps1';",
23+
],
24+
"options": {
25+
"cwd": "${workspaceFolder}/",
26+
},
27+
"presentation": {
28+
"echo": true,
29+
"reveal": "always",
30+
"focus": false,
31+
"panel": "shared",
32+
"showReuseMessage": true,
33+
"clear": false,
34+
}
35+
},
36+
{
37+
"label": "Clean",
38+
"type": "shell",
39+
"command": [
40+
"del -recurse bin_*,bin;",
41+
],
42+
"options": {
43+
"cwd": "${workspaceFolder}/",
44+
},
45+
"presentation": {
46+
"echo": true,
47+
"reveal": "always",
48+
"focus": false,
49+
"panel": "shared",
50+
"showReuseMessage": true,
51+
"clear": false,
52+
}
53+
},
54+
{
55+
"label": "Build [Debug]",
56+
"type": "shell",
57+
"command": "python",
58+
"args": [
59+
".\\scripts\\build.py",
60+
"cmake",
61+
"bin",
62+
"--arch",
63+
"amd64",
64+
"--config",
65+
"Debug",
66+
],
67+
"options": {
68+
"cwd": "${workspaceFolder}/",
69+
},
70+
"group": {
71+
"kind": "build",
72+
"isDefault": true
73+
},
74+
"presentation": {
75+
"echo": true,
76+
"reveal": "always",
77+
"focus": false,
78+
"panel": "shared",
79+
"showReuseMessage": true,
80+
"clear": false,
81+
}
82+
},
83+
{
84+
"label": "Rebuild [Skip CMake]",
85+
"type": "shell",
86+
"command": "cmake",
87+
"args": [
88+
"--build",
89+
"${workspaceFolder}/bin",
90+
],
91+
"options": {
92+
"cwd": "${workspaceFolder}/",
93+
},
94+
"group": {
95+
"kind": "build",
96+
"isDefault": true
97+
},
98+
"presentation": {
99+
"echo": true,
100+
"reveal": "always",
101+
"focus": false,
102+
"panel": "shared",
103+
"showReuseMessage": true,
104+
"clear": false,
105+
}
106+
},
107+
{
108+
"label": "Build with OpenSSL [Debug]",
109+
"type": "shell",
110+
"command": "python",
111+
"args": [
112+
".\\scripts\\build.py",
113+
"cmake",
114+
"bin",
115+
"--arch",
116+
"amd64",
117+
"--config",
118+
"Debug",
119+
"--openssl-build-from-source",
120+
],
121+
"options": {
122+
"cwd": "${workspaceFolder}/",
123+
},
124+
"group": {
125+
"kind": "build",
126+
"isDefault": true
127+
},
128+
"presentation": {
129+
"echo": true,
130+
"reveal": "always",
131+
"focus": false,
132+
"panel": "shared",
133+
"showReuseMessage": true,
134+
"clear": false,
135+
}
136+
},
137+
{
138+
"label": "Build with OpenSSL [Release]",
139+
"type": "shell",
140+
"command": "python",
141+
"args": [
142+
".\\scripts\\build.py",
143+
"cmake",
144+
"bin",
145+
"--arch",
146+
"amd64",
147+
"--config",
148+
"Release",
149+
"--openssl-build-from-source",
150+
],
151+
"options": {
152+
"cwd": "${workspaceFolder}/",
153+
},
154+
"group": {
155+
"kind": "build",
156+
"isDefault": true
157+
},
158+
"presentation": {
159+
"echo": true,
160+
"reveal": "always",
161+
"focus": false,
162+
"panel": "shared",
163+
"showReuseMessage": true,
164+
"clear": false,
165+
}
166+
},
167+
]
168+
}

0 commit comments

Comments
 (0)