Skip to content

Build on any OS with Visual Studio Code

Marino von Wattenwyl edited this page May 12, 2023 · 1 revision
  • All C++ projects can also be built with the platform independent IDE Visual Studio Code from Microsoft. Anyway, for Windows, we recommend to build and work with the full Visual Studio.
  • Clone the SLProject GIT repository into a directory of your choice.
  • Install the latest CMake. You need at least CMake Version 3.3.
  • Install Visual Studio Code
  • Open Visual Studio Code and install the extension for C/C++, CMake and CMake Tools.
  • With File/Open... choose the SLProject folder. The cmake configuration and generation should automatically start. This can last a minute or so. You will also be asked which of the found compiler toolchains shall be used. After that, a cmake icon appears at the bottom of the left toolbar.
  • Click on the cmake icon to show the cmake project structure tree.
  • Click on the hammer icon on top of the cmake structure tree. This will build the app-Demo-SLProject-debug executable into the folder named build.
  • To run the app-Demo-SLProject select the Run in terminal command in the context menu: Run app-Demo-SLProject
  • If you choose to Run with debugger you will be asked for a configuration of the debugger. VS Code will propose you one with missing values. It will be stored in .vscode/launch.json. You can complete it e.g. as follows:
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "app-Demo-SLProject-debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/app-Demo-SLProject-debug",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb"
        }
    ]
}
  • After closing the welcome dialogue you can open with the menu File > Load Demo Scenes many different scenes that demonstrate the features of SLProject.