Installing And Configuring VCode Windows - iat-cener/tonatiuh GitHub Wiki
Installing and Configuring Visual Studio Code on Windows
Visual Studio Code (VS Code) is a lightweight yet powerful source code editor that supports a wide range of programming languages and tools. It's well-suited for developing C++ applications like Tonatiuh, especially when paired with extensions for Git, and debugging.
Visual Studioc Code installation
- Download the installer.
- Visit the official Visual Studio Code
- Download the latest installer comptible with your system architecture (typically the 64-bit version for modern Windows).
- Run the Installer
- Launch the downloaded installer and follow the setup wizard to complete the installation.
- Open just installed Visual Studio Code application
- Install additional components to enable C++ development and git integration
- Go to the Extensions view and select the following:
- C/C++ Extension Pack
- Git Blame
- Go to the Extensions view and select the following:
Download Tonatiuh code from the repository
To start developing on Tonatiuh source code:
- Go to Source Control view
images/developersguide/windows/VSSourceCodeView.jpg |
---|
Figure 1. View of the Visual Code Source Control view. |
- Click on "Clone Repository" button.
- In the command pallete, enter the URL of the repository:"https://github.com/iat-cener/tonatiuh.git"
images/developersguide/windows/VSSourceClone.jpg |
---|
Figure 2. View of the Visual Code with the URL definted to clone the repository. |
- Choose a local directory to clone the repository into your computer.
- Open just cloned repository in VS Code.
Configure to compile and run using MSYS2 and MinGW system
By default, VS Code is not configured to use MinGW compiler. For this reason, it is required to create manually some task tp enable building and debugging within the IDE. Additional task are also required to lauch Tonatiuh application from the IDE:
- Go to the "Run and Debug" view.
- Click on "create a launch.json file".
- On the command pallete it is required to select the debugger. Select "C++ (GDB)" as debugger.
- If it is not listed, open the command palette (Ctrl+Shift+P), search "C/C++: Change Configuration Provider..." and select (none)" to disable active configuration (tipycally MCVS). Then, repeat "create a launch.json file" steps.
- This action will create a ".vscode" folder with "launch.json" file. Replace its contents with the following configuretion to run Tonatiuh in debug mode (modify paths as needed):
{
"version": "0.2.0",
"configurations": [
{
"name": "Tonatiuh Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/TonatiuhProject/bin/debug/Tonatiuh.exe",
"args": [],
"cwd": "${workspaceFolder}/TonatiuhProject/bin/debug",
"environment": [
{
"name": "PATH",
"value": "C:\\msys64\\ucrt64\\bin;C:\\msys64\\usr\\bin;${workspaceFolder}/TonatiuhProject/bin/debug;${env:PATH}"
},
],
"stopAtEntry": false,
"externalConsole": true, // Importante para ver la GUI
"MIMode": "gdb",
"miDebuggerPath": "C:\\msys64\\ucrt64\\bin\\gdb.exe"
}
]
}
- Create a new file named "tasks.json" inside ".vscode" folder to define the build task for compile and execute Tonatiuh. Open this file and complete it to configure to run Tonatiuh in debug mode:
{
"version": "2.0.0",
"tasks": [
{
"label": "qmake",
"type": "shell",
"command": "qmake TonatiuhProject.pro",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"options": {
"env": {
"TONATIUH_ROOT": "${workspaceFolder}/TonatiuhProject",
"PATH": "C:\\msys64\\ucrt64\\bin;C:\\msys64\\ucrt64\\usr\\bin;"
},
"cwd": "${workspaceFolder}/TonatiuhProject"
}
},
{
"label": "make all",
"type": "shell",
"command": "Mingw32-make all",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"options": {
"env": {
"TONATIUH_ROOT": "${workspaceFolder}/TonatiuhProject",
"PATH": "C:\\msys64\\ucrt64\\bin;C:\\msys64\\usr\\bin;"
},
"cwd": "${workspaceFolder}/TonatiuhProject"
}
},
{
"label": "make Debug",
"type": "shell",
"command": "qmake CONFIG-=release && mingw32-make all",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"options": {
"env": {
"TONATIUH_ROOT": "${workspaceFolder}/TonatiuhProject",
"PATH": "C:\\msys64\\ucrt64\\bin;C:\\msys64\\usr\\bin;"
},
"cwd": "${workspaceFolder}/TonatiuhProject"
}
},
{
"label": "make Release",
"type": "shell",
"command": "qmake CONFIG-=debug && mingw32-make all",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"options": {
"env": {
"TONATIUH_ROOT":"${workspaceFolder}/TonatiuhProject",
"PATH": "C:\\msys64\\ucrt64\\bin;C:\\msys64\\usr\\bin;"
},
"cwd": "${workspaceFolder}/TonatiuhProject"
}
},
{
"label": "distclean",
"type": "shell",
"command": "Mingw32-make distclean",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"options": {
"env": {
"TONATIUH_ROOT": "${workspaceFolder}/TonatiuhProject",
"PATH": "C:\\msys64\\bin;C:\\msys64\\usr\\bin;"
},
"cwd": "${workspaceFolder}/TonatiuhProject"
}
},
{
"label": "Tonatiuh Release",
"type": "shell",
"command": "${workspaceFolder}/TonatiuhProject/bin/release/Tonatiuh",
"group": {
"kind": "test",
"isDefault": true
},
"options": {
"env": {
"PATH": "C:\\msys64\\ucrt64\\bin;C:\\msys64\\usr\\bin;${env:PATH}"
}
}
}
]
}
Building Tonatiuh
After configuring VSCode to work with Tonatiuh code, it is ready to begin with building process.
- Go to "Terminal" menu and select _"Run Task...".
- In the list select "qmake" task. The Makefiles files generation process will start.
- Once it finishes, select "make all" task to compile the code. This will take several minutes.
- To run Tonatiuh in release mode, select ""Tonatiuh Release" task. The GUI of the application will be shown.