{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Create Build Directories",
      "type": "shell",
      "command": "sh",
      "args": [
        "-c",
        "mkdir -p build"
      ],
      "problemMatcher": [],
      "detail": "Create necessary directories for builds.",
      "windows": {
        "command": "cmd.exe",
        "args": [
          "/C",
          "if not exist build (mkdir build)"
        ]
      }
    },
    {
      "label": "CMake Configure",
      "type": "shell",
      "command": "cmake",
      "dependsOn": [
        "Create Build Directories"
      ],
      "args": [
        "-S",
        ".",
        "-B",
        "build",
        "-G",
        "${input:cmakeGenerator}"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "problemMatcher": [
        "$gcc"
      ],
      "detail": "Configure the project using CMake."
    },
    {
      "label": "CMake Build",
      "type": "shell",
      "command": "cmake",
      "dependsOn": [
        "CMake Configure"
      ],
      "args": [
        "--build",
        "build",
        "--target",
        "all",
        "--",
        "-j${input:threadCount}"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "problemMatcher": [
        "$gcc"
      ],
      "detail": "Build the project using CMake with parallel compilation."
    }
  ],
  "inputs": [
    {
      "type": "pickString",
      "id": "cmakeGenerator",
      "options": [
        "Ninja",
        "Unix Makefiles",
        "MinGW Makefiles",
        "Xcode"
      ],
      "default": "Ninja",
      "description": "The CMake generator to use."
    },
    {
      "type": "promptString",
      "id": "threadCount",
      "description": "Number of parallel compilation threads",
      "default": "8"
    }
  ]
}
