Skip to content

IDE setup for comfortable NUT development

Jim Klimov edited this page Oct 4, 2023 · 4 revisions

For NUT documentation suggestions on use of IDEs (NetBeans, Visual Studio Code...) to develop and debug NUT programs, see https://github.com/networkupstools/nut/blob/master/docs/developers.txt in the source tree or the rendered page on NUT website.

VSCode configuration

Quoting from https://github.com/networkupstools/nut/pull/2088#issuecomment-1746465171 :

I use this with VSCode and the following tasks.json to have multiple builds from the same source tree:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "autogen",
            "type": "process",
            "command": "/bin/sh",
            "args": [ "${workspaceFolder}/autogen.sh" ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": []
        },
        {
            "label": "configure",
            "type": "process",
            "command": "/bin/sh",
            "args": [
                "${workspaceFolder}/configure",
                "--with-drivers=usbhid-ups,apc_modbus",
                "--with-usb",
                "--prefix=/home/ago/src/nut/prefix",
                "--with-modbus",
                "--with-modbus-includes=-I/home/ago/src/libmodbus/prefix/include/modbus",
                "--with-modbus-libs=-L/home/ago/src/libmodbus/prefix/lib -lmodbus",
                "--enable-warnings",
                "--enable-spellcheck",
                "CPPFLAGS=-DDEBUG",
                "CFLAGS=-g -O0"
            ],
            "options": {
                "cwd": "${workspaceFolder}/build/dev"
            },
            "dependsOn": ["autogen"],
            "problemMatcher": []
        },
        {
            "label": "configure debian",
            "type": "process",
            "command": "/bin/sh",
            "args": [
                "${workspaceFolder}/configure",
                "--with-drivers=usbhid-ups,apc_modbus",
                "--with-usb",
                "--prefix=",
                "--sysconfdir=/etc/nut",
                "--with-statepath=/run/nut",
                "--with-user=nut",
                "--with-group=nut",
                "--with-modbus",
                "--with-modbus-includes=-I/home/ago/src/libmodbus/prefix/include/modbus",
                "--with-modbus-libs=-L/home/ago/src/libmodbus/prefix/lib -lmodbus"
            ],
            "options": {
                "cwd": "${workspaceFolder}/build/debian"
            },
            "dependsOn": ["autogen"],
            "problemMatcher": []
        },
        {
            "label": "configure distcheck",
            "type": "process",
            "command": "/bin/sh",
            "args": [
                "${workspaceFolder}/configure",
                "--with-usb",
                "--with-modbus",
                "--with-modbus-includes=-I/home/ago/src/libmodbus/prefix/include/modbus",
                "--with-modbus-libs=-L/home/ago/src/libmodbus/prefix/lib -lmodbus"
            ],
            "options": {
                "cwd": "${workspaceFolder}/build/distcheck"
            },
            "dependsOn": ["autogen"],
            "problemMatcher": []
        },
        {
            "label": "make",
            "type": "process",
            "command": "make",
            "args": [ "-j", "64" ],
            "problemMatcher": [ "$gcc" ],
            "options": {
                "cwd": "${workspaceFolder}/build/dev"
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "make debian",
            "type": "process",
            "command": "make",
            "args": [ "-j", "64" ],
            "problemMatcher": [ "$gcc" ],
            "options": {
                "cwd": "${workspaceFolder}/build/debian"
            },
            "group": {
                "kind": "build",
                "isDefault": false
            }
        },
        {
            "label": "make distcheck",
            "type": "process",
            "command": "make",
            "args": [ "-j", "64", "distcheck" ],
            "problemMatcher": [ "$gcc" ],
            "options": {
                "cwd": "${workspaceFolder}/build/distcheck"
            },
            "group": {
                "kind": "build",
                "isDefault": false
            }
        }
    ]
}
Clone this wiki locally