-
Notifications
You must be signed in to change notification settings - Fork 32
Configuring A Development Environment
-
Make sure the C/C++ extension is installed. You can find instructions in the official documentation. Alternatively, clangd can be used instead.
- When using the clangd extension, run
scons compiledb=yes compiledb.
- When using the clangd extension, run
-
From the Visual Studio Code's main screen open the OpenVic root folder with File > Open Folder....
-
Press
Ctrl + Shift + Pto open the command prompt window and enter Configure Task. -
Select the Create tasks.json file from template option.
-
Then select Others.
-
If there is no such option as Create tasks.json file from template available, either delete the file if it already exists in your folder or create a
.vscode/tasks.jsonfile manually. See Tasks in Visual Studio Code for more details on tasks. -
Within the
tasks.jsonfile find the"tasks"array and add a new section to it:{ "label": "dev_build", "group": "build", "type": "shell", "command": "scons", "args": [ // enable for debugging with breakpoints "dev_build=yes", ], "problemMatcher": "$msCompile" }
Arguments can be different based on your own setup and needs. See Build With Scons for a full list of arguments.
To run and debug the project you need to create a new configuration in the launch.json file.
-
Press
Ctrl + Shift + Dto open the Run panel.- If
launch.jsonfile is missing you will be prompted to create a new one.
- If
-
Select C++ (GDB/LLDB). There may be another platform-specific option here. If selected, adjust the configuration example provided accordingly.
-
Within the
launch.jsonfile find the"configurations"array and add a new section to it:Windows
{ "name": "Launch Project", "type": "cppvsdbg", "request": "launch", // Change to godot binary path "program": "godot.exe", // Change the arguments below for the project you want to test with. // To run the project in the editor, add the "--editor" argument. "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}\\game", "environment": [], "console": "internalConsole", "preLaunchTask": "dev_build" }Linux (GDB)
{ "name": "Launch Project", "type": "cppdbg", "request": "launch", // Change to godot binary path "program": "/bin/godot", // Change the arguments below for the project you want to test with. // To run the project in the editor, add the "--editor" argument. "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}/game", "environment": [], "externalConsole": false, "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "dev_build" }Linux (LLDB)
{ "name": "Launch Project", "type": "lldb", "request": "launch", // Change to godot binary path "program": "/bin/godot", // Change the arguments below for the project you want to test with. // To run the project in the editor, add the "--editor" argument. "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}/game", "environment": [], "externalConsole": false, "preLaunchTask": "dev_build" }