Skip to content

IDE Setup

CLion (Linux & Windows)

Prerequisites

  • Be sure to build the externals, as specified in the installation guide.
  • On Windows ensure that BOOST_ROOT is registered as an environment variable.

Configure CMake Profiles

When opening the project you should be greeted with a CMake settings window. If you are not greeted with a CMake settings window go to: Settings -> Build, Execution, Deployment -> CMake

You can choose to enable CMake presets. From the following you can choose one release and one debug config:

  • Windows
    • windows-ninja-release-config - windows-ninja-release-build preset
    • windows-ninja-debug-config - windows-ninja-debug-build preset
    • windows-vs-release-config - windows-vs-release-build preset
    • windows-vs-debug-config - windows-vs-debug-build preset
  • Linux
    • linux-ninja-release-config - linux-ninja-release-build preset
    • linux-ninja-debug-config - linux-ninja-debug-build preset
    • linux-make-release-config - linux-make-release-build preset
    • linux-make-debug-config - linux-make-debug-build preset

Configure Run and Test Profiles

  • Run the Install task. It can be found under Build in the menubar.
  • Go to: Run/Debug Configuration

Windows

  • Run Release

    TypeCMake Application
    Targetcosmoscout
    Executable$ProjectFileDir$\install\windows-Release\bin\cosmoscout.exe
    Program arguments--settings=../share/config/simple_desktop.json -vista vista.ini
    Environment variablesVISTACORELIBS_DRIVER_PLUGIN_DIRS=..\lib\DriverPlugins;PATH=..\lib\;$Path$
    Before launchinstall
  • Run Debug

    TypeCMake Application
    Targetcosmoscout
    Executable$ProjectFileDir$\install\windows-Debug\bin\cosmoscout.exe
    Program arguments--settings=../share/config/simple_desktop.json -vista vista.ini
    Environment variablesVISTACORELIBS_DRIVER_PLUGIN_DIRS=..\lib\DriverPlugins;PATH=..\lib\;$Path$
    Before launchinstall
  • Test Release

    TypeDoctest
    Targetcosmoscout
    Program arguments--run-tests --test-case-exclude="*[graphical]*"
    Working directory$ProjectFileDir$\install\windows-Release\bin
    Environment variablesPATH=..\lib\;$Path$
    Before launchinstall + Prepare test run
  • Test Debug

    TypeDoctest
    Targetcosmoscout
    Program arguments--run-tests --test-case-exclude="*[graphical]*"
    Working directory$ProjectFileDir$\install\windows-Debug\bin
    Environment variablesPATH=..\lib\;$Path$
    Before launchinstall + Prepare test run

Linux

  • Run Release

    TypeCMake Application
    Targetcosmoscout
    Executable$ProjectFileDir$/install/linux-Release/bin/cosmoscout
    Program arguments--settings=../share/config/simple_desktop.json -vista vista.ini
    Environment variablesLD_LIBRARY_PATH=../lib:../lib/DriverPlugins:$LD_LIBRARY_PATH;VISTACORELIBS_DRIVER_PLUGIN_DIRS=../lib/DriverPlugins
    Before launchinstall
  • Run Debug

    TypeCMake Application
    Targetcosmoscout
    Executable$ProjectFileDir$/install/linux-Debug/bin/cosmoscout
    Program arguments--settings=../share/config/simple_desktop.json -vista vista.ini
    Environment variablesLD_LIBRARY_PATH=../lib:../lib/DriverPlugins:$LD_LIBRARY_PATH;VISTACORELIBS_DRIVER_PLUGIN_DIRS=../lib/DriverPlugins
    Before launchinstall
  • Test Release

    TypeDoctest
    Targetcosmoscout
    Program arguments--run-tests --test-case-exclude="*[graphical]*"
    Working directory$ProjectFileDir$/install/linux-Release/bin
    Environment variablesLD_LIBRARY_PATH=../lib:../lib/DriverPlugins:$LD_LIBRARY_PATH
    Before launchinstall + Prepare test run
  • Test Debug

    TypeDoctest
    Targetcosmoscout
    Program arguments--run-tests --test-case-exclude="*[graphical]*"
    Working directory$ProjectFileDir$/install/linux-Debug/bin
    Environment variablesLD_LIBRARY_PATH=../lib:../lib/DriverPlugins:$LD_LIBRARY_PATH
    Before launchinstall + Prepare test run

Plugins

For CLion, we can recommend these plugins for the development of CosmoScout VR:

Visual Studio (Windows only)

First, you should follow the Generic Build Instructions for Windows. Once CosmoScout VR has been compiled successfully, you can simply open the cosmoscout-vr.sln solution in either build\windows-Debug or build\windows-Release.

Due to the build process of CosmoScout VR, this solution can only be used for Debug or Release mode respectively. Therefore you have to select the corresponding configuration type in Visual Studio.

Visual Studio Code (Linux & Windows)

For Visual Studio Code, only the C/C++ Extension is required. However, we can also recommend the following extensions: CMake, Markdown Preview Github Styling and Code Spell Checker.

In order to get started, you will need to create three files in a .vscode directory in the root of CosmoScout’s source tree, namely .vscode/tasks.json, .vscode/launch.json and .vscode/c_cpp_properties.json. We will discuss these files in the following.

Configure Tasks

.vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Make (Release)",
"type": "shell",
"command": "cmake --preset linux-make-release-config && cmake --build --preset linux-make-release-build",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"windows": {
"command": "cmake --preset windows-vs-release-config; cmake --build --preset windows-vs-release-build",
"options": {
"env": {
"BOOST_ROOT": "C:\\local\\boost_1_69_0"
}
}
}
},
{
"label": "Make (Debug)",
"type": "shell",
"command": "cmake --preset linux-make-debug-config && cmake --build --preset linux-make-debug-build",
"options": {
"cwd": "${workspaceFolder}",
"env": {
"COSMOSCOUT_DEBUG_BUILD": "true"
}
},
"problemMatcher": [
"$gcc"
],
"windows": {
"command": "cmake --preset windows-make-debug-config; cmake --build --preset windows-make-debug-build",
"options": {
"env": {
"BOOST_ROOT": "C:\\local\\boost_1_69_0"
}
}
}
},
{
"label": "Make Externals (Release)",
"type": "shell",
"command": "./make_externals.sh",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"windows": {
"command": ".\\make_externals.bat"
}
},
{
"label": "Make Externals (Debug)",
"type": "shell",
"command": "./make_externals.sh",
"options": {
"cwd": "${workspaceFolder}",
"env": {
"COSMOSCOUT_DEBUG_BUILD": "true"
}
},
"problemMatcher": [
"$gcc"
],
"windows": {
"command": ".\\make_externals.bat"
}
},
{
"label": "Run CosmoScout VR (Release)",
"type": "shell",
"command": "install/linux-Release/bin/start.sh",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [],
"windows": {
"command": ".\\install/windows-Release/bin/start.bat"
}
},
{
"label": "Run CosmoScout VR (Debug)",
"type": "shell",
"command": "install/linux-Debug/bin/start.sh",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [],
"windows": {
"command": ".\\install/windows-Debug/bin/start.bat"
}
},
{
"label": "Run Tests (Release)",
"type": "shell",
"command": "install/linux-Release/bin/run_tests.sh",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [],
"windows": {
"command": ".\\install/windows-Release/bin/run_tests.bat"
}
},
{
"label": "Run Tests (Debug)",
"type": "shell",
"command": "install/linux-Debug/bin/run_tests.sh",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [],
"windows": {
"command": ".\\install/windows-Debug/bin/run_tests.bat"
}
}
]
}

If you are on Windows, you may have to replace the "BOOST_ROOT" environment variable in this file.

With this file in place, you can press Ctrl+Shift+P and select Tasks: Run Task. Now you can first select Make Externals (Release), then Make (Release) and later Run CosmoScout VR.

Configure Intellisense

.vscode/c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"compileCommands": "${workspaceRoot}/build/linux-Release/compile_commands.json",
"browse": {
"databaseFilename": "${workspaceRoot}/.vscode/browse-linux.VC.db"
},
"includePath": [
"${workspaceRoot}/build/linux-Release/**"
],
"defines": [],
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
},
{
"name": "Win32",
"browse": {
"databaseFilename": "${workspaceRoot}/.vscode/browse-windows.VC.db"
},
"includePath": [
"${workspaceRoot}/build/windows-Release/**",
"${workspaceRoot}/install/windows-externals-Release/include"
],
"defines": [],
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}

This file configures Intellisense. On Linux, the CMake flag -DCMAKE_EXPORT_COMPILE_COMMANDS=On is used in make.sh to create a database which is required by Intellisense. With this file and the C/C++ Extension, autocompletion and similar functionality should be working both on Windows and on Linux.

Configure Debugger

.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debugger (Linux)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/install/linux-Debug/bin/cosmoscout",
"args": [
"--settings=../share/config/simple_desktop.json",
"-vistaini vista.ini"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/install/linux-Debug/bin",
"environment": [
{
"name": "VISTACORELIBS_DRIVER_PLUGIN_DIRS",
"value": "../lib/DriverPlugins"
},
{
"name": "LD_LIBRARY_PATH",
"value": "../lib:../lib/DriverPlugins:${env:LD_LIBRARY_PATH}"
}
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "Debugger (Windows)",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/install/windows-Debug/bin/cosmoscout",
"args": [
"--settings=../share/config/simple_desktop.json",
"-vistaini vista.ini"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/install/windows-Debug/bin",
"environment": [
{
"name": "VISTACORELIBS_DRIVER_PLUGIN_DIRS",
"value": "..\\lib\\DriverPlugins"
},
{
"name": "PATH",
"value": "../lib;${env:PATH}"
}
],
"externalConsole": false
}
]
}

Finally, when this files is created, you can use F5 to launch the debugger on Windows and on Linux. For this to work, CosmoScout VR and its dependencies have to be built in debug mode.

Content Licensed under CC-BY-4.0 by German Aerospace Center (Imprint)
Build with Astro using the Starlight theme.
Hosted on GitHub Pages.