Skip to content

Latest commit

 

History

History
457 lines (412 loc) · 16 KB

ide-setup.md

File metadata and controls

457 lines (412 loc) · 16 KB

Configuring your IDE

Below you find some instructions on how to setup your preferred IDE for CosmoScout VR development.

CLion (Linux & Windows)

Linux

You have to add the following lines to the clion.sh file, which is located in you CLion bin folder:

export LD_LIBRARY_PATH=../lib:../lib/DriverPlugins:$LD_LIBRARY_PATH
export VISTACORELIBS_DRIVER_PLUGIN_DIRS=../lib/DriverPlugins
  • Run: ./make_externals.sh

  • Run: ./make.sh

  • Go to: Settings -> Build, Execution, Deployment -> CMake

  • Release Profile

    • Generation path: build/linux-release
    • Build options: --parallel 8
    • CMAKE options:
      -DCMAKE_BUILD_TYPE=Release
      -DCMAKE_INSTALL_PREFIX="<path to cosmoscout>/install/linux-release"
      -DCOSMOSCOUT_EXTERNALS_DIR="<path to cosmoscout>/install/linux-externals-release"
      -DCMAKE_EXPORT_COMPILE_COMMANDS=On
  • Debug Profile

    • Generation path: build/linux-debug
    • Build options: --parallel 8
    • CMAKE options:
      -DCMAKE_BUILD_TYPE=Debug
      -DCMAKE_INSTALL_PREFIX="<path to cosmoscout>/install/linux-debug"
      -DCOSMOSCOUT_EXTERNALS_DIR="<path to cosmoscout>/install/linux-externals-release"
      -DCMAKE_EXPORT_COMPILE_COMMANDS=On
      
  • Go to: Run/Debug Configuration -> CMake Application -> cosmoscout

  • Release profile

    • Target: cosmoscout
    • Executable -> Select other: <path to cosmoscout>/install/linux-release/bin/cosmoscout
    • Program arguments: --settings=../share/config/simple_desktop.json -vista vista.ini
    • Working directory: <path to cosmoscout>/install/linux-release/bin
    • Before launch -> + -> Install
  • Debug profile

    • Target: cosmoscout
    • Executable -> Select other: <path to cosmoscout>/install/linux-debug/bin/cosmoscout
    • Program arguments: --settings=../share/config/simple_desktop.json -vista vista.ini
    • Working directory: <path to cosmoscout>/install/linux-debug/bin
    • Before launch -> + -> Install

Windows

Currently CLion only supports debugging with MinGW and Cygwin. Sadly CosmoScout only runs on MSVC so only a release build will be possible for now. Following this restriction you need to install Visual Studio beforehand. If you are not bound to a specific version use the latest Visual Studio.

The following will use -G "Visual Studio 16 2019" -A x64 as the compilation target, you can replace it with your highest available (and supported) version.

  • Run: .\make_externals.bat -G "Visual Studio 16 2019" -A x64

  • Run: .\make.bat -G "Visual Studio 16 2019" -A x64

  • Go to: Settings -> Build, Execution, Deployment -> Toolchain

    • Add Visual Studio if it is not in the list yet. And make sure it is at the top.
    • If Visual Studio is installed correctly everything else here should be set automagically.
  • Go to: Settings -> Build, Execution, Deployment -> CMake

  • Release Profile

    • Generation path: build\windows-release
    • Build options: --parallel 8
    • CMAKE options:
      -DCMAKE_BUILD_TYPE=Release
      -G "Visual Studio 16 2019" -A x64
      -DCMAKE_INSTALL_PREFIX="<path to cosmoscout>\install\windows-release"
      -DCOSMOSCOUT_EXTERNALS_DIR="<path to cosmoscout>\install\windows-externals-release"
      
  • Go to: Run/Debug Configuration -> CMake Application -> cosmoscout

    • Target: cosmoscout
    • Executable -> Select other: <path to cosmoscout>\install\windows-release\bin\cosmoscout.exe
    • Program arguments: --settings=../share/config/simple_desktop.json -vista vista.ini
    • Working directory: <path to cosmoscout>\install\windows-release\bin
    • Environment variables: VISTACORELIBS_DRIVER_PLUGIN_DIRS=..\lib\DriverPlugins;PATH=..\lib\;%PATH%
      • (If you haven't set BOOST_ROOT as a system wide environment variable you need to add that too here.)
    • Before launch -> + -> Install

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

Simple Icons Eclipse (Linux only)

TODO Currently nobody tried to use CosmoScout VR with Eclipse yet. If you do manage to set up CosmoScout with this IDE we would be glad if you could make a pull request with set up instructions.

Simple Icons Sublime Text (Linux & Windows)

To get started with Sublime Text 3, you can create a project file in the root directory of CosmoScout VR:

CosmoScout VR.sublime-project

{
    "build_systems":
    [
        {
            "name": "Make (Release)",
            "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
            "cmd": "./make.sh",
            "working_dir": "$project_path",
            "windows": {
                "cmd": "make.bat"
            },
        },
        {
            "name": "Make (Debug)",
            "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
            "cmd": "./make.sh",
            "working_dir": "$project_path",
            "env": {
                "COSMOSCOUT_DEBUG_BUILD": "true"
            },
            "windows": {
                "cmd": "make.bat"
            },
        },
        {
            "name": "Make Externals (Release)",
            "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
            "cmd": "./make_externals.sh",
            "working_dir": "$project_path",
            "windows": {
                "cmd": "make_externals.bat"
            }
        },
        {
            "name": "Make Externals (Debug)",
            "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
            "cmd": "./make_externals.sh",
            "working_dir": "$project_path",
            "windows": {
                "cmd": "make_externals.bat"
            },
            "env": {
                "COSMOSCOUT_DEBUG_BUILD": "true"
            }
        },
        {
            "name": "Run CosmoScout VR",
            "cmd": "install/linux-release/bin/start.sh",
            "working_dir": "$project_path",
            "windows": {
                "cmd": "install\\windows-release\\bin\\start.bat"
            }
        }
    ],
    "folders":
    [
        {
            "path": "."
        }
    ]
}

Now you can press Ctrl-B to bring up the build system selection. When you press this the next time, it will execute the build system selected previously. Press Ctrl-Shift-B to select another build system. You should first select Make Externals (Release), then Make (Release) and later Run CosmoScout VR.

While this will give you a basic build system, it will not allow for auto-completion or debugging.

Simple Icons 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.

Simple Icons 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.

.vscode/tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Make (Release)",
      "type": "shell",
      "command": "./make.sh",
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "problemMatcher": [
        "$gcc"
      ],
      "windows": {
        "command": ".\\make.bat",
        "options": {
          "env": {
            "BOOST_ROOT": "C:\\local\\boost_1_69_0"
          }
        }
      }
    },
    {
      "label": "Make (Debug)",
      "type": "shell",
      "command": "./make.sh",
      "options": {
        "cwd": "${workspaceFolder}",
        "env": {
          "COSMOSCOUT_DEBUG_BUILD": "true"
        }
      },
      "problemMatcher": [
        "$gcc"
      ],
      "windows": {
        "command": ".\\make.bat",
        "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 All Tests (Release)",
      "type": "shell",
      "command": "install/linux-release/bin/run_all_tests.sh",
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "problemMatcher": [],
      "windows": {
        "command": ".\\install/windows-release/bin/run_all_tests.bat"
      }
    },
    {
      "label": "Run All Tests (Debug)",
      "type": "shell",
      "command": "install/linux-debug/bin/run_all_tests.sh",
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "problemMatcher": [],
      "windows": {
        "command": ".\\install/windows-debug/bin/run_all_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.

ℹ️ Tip (Linux only): You can use ccache to considerably speed up build times. You just need to replace the commands with ./make_externals.sh -G "Unix Makefiles" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache and ./make.sh -G "Unix Makefiles" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache respectively.

ℹ️ Tip (Windows only): You can use clcache to considerably speed up build times. You just need to call make_externals.bat -G "Visual Studio 15 Win64" -DCMAKE_VS_GLOBALS=CLToolExe="clcache.exe;TrackFileAccess=false" and make.bat -G "Visual Studio 15 Win64" -DCMAKE_VS_GLOBALS="CLToolExe=clcache.exe;TrackFileAccess=false" respectively.

.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.

.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.

‹ Generic Build Instructions ⌂ Help Index Using CosmoScout VR ›