Compiling ScummVM/Visual Studio Code

From ScummVM :: Wiki
Jump to navigation Jump to search

Compiling ScummVM

Visual Studio Code is an integrated developer environment that can use your existing compilation toolchains. We recommend first compiling ScummVM with a configure/Make based build system as detailed from Compiling ScummVM.

Integrating with a configure/Make based build system

Install the C/C++ extension. The Makefile Tools extension is not required and may fail compilation if it does not use a properly-configured build terminal.

Add a custom build tasks to .vscode/task.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Make: build",
            "type": "shell",
            "command": "make",
            "args": [ "-j8" ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": [
                "$gcc"
            ]
        },
        {
            "label": "Make: clean",
            "type": "shell",
            "command": "make",
            "args": [ "clean" ],
            "group": {
                "kind": "build",
                "isDefault": false
            },
            "problemMatcher": [
                "$gcc"
            ]
        },
        {
            "label": "Make: test",
            "type": "shell",
            "command": "make",
            "args": [ "test" ],
            "group": {
                "kind": "test",
                "isDefault": true
            },
            "problemMatcher": [
                "$gcc"
            ]
        },
    ]
}

Integrating with MSYS2

Examples in this section assume the MSYS path and UCRT environment and may need alteration to match your chosen installation.

Add these options to .vscode/task.json to run build tasks with a properly-configured shell:

{
    "version": "2.0.0",
    "options": {
        "shell": {
            "executable": "cmd.exe",
            "args": [
                "/c",
                "C:\\msys64\\msys2_shell.cmd -defterm -here -no-start -ucrt64 -c '$@' --"
            ]
        }
    }
}

Add these lines to your settings.json to enable MSYS2 UCRT profile when launching a terminal:

{
    "terminal.integrated.profiles.windows": {
        "MSYS2 UCRT": {
            "path": "cmd.exe",
            "args": [
                "/c",
                "C:\\msys64\\msys2_shell.cmd -defterm -here -no-start -ucrt64"
            ]
        }
    }
}

References