• 欢迎光临~

zig开发环境配置

开发技术 开发技术 2022-12-21 次浏览

环境

vscode

zig
zls

创建项目

mkdir demo; cd demo
zig init-exe

交叉编译

zig build -target xxx
zig tatgets

vscode

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "debug",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/main",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "preLaunchTask": "debug_build",
      "externalConsole": false
    }
  ]
}

tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "debug_build",
      "type": "shell",
      "command": "zig build-exe src/main.zig"
    },
    {
      "label": "release_build",
      "type": "shell",
      "command": "zig build-exe src/main.zig -O ReleaseSmall"
    }
  ]
}
程序员灯塔
转载请注明原文链接:zig开发环境配置
喜欢 (0)