Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Qt EXE SetupNew to Visual Studio Code? Get it now.
Qt EXE Setup

Qt EXE Setup

WangNiMa

|
63 installs
| (0) | Free
自动化 Qt/C++ 项目的构建、打包和部署流程
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Qt EXE Setup

中文说明 | English


中文说明

自动化 Qt/C++ 项目的构建、打包和部署流程的 VS Code 扩展。

功能特性

  • 自动配置 CMake(支持 MSVC 和 MinGW 编译器)
  • 自动编译项目(支持 Debug/Release 配置)
  • 自动查找可执行文件
  • 自动运行部署工具(windeployqt/macdeployqt/linuxdeployqt)
  • 自动解析 CMakeLists.txt 并复制依赖库
  • 自动复制资源文件(resources/ 目录和 qt.conf 文件)
  • 支持配置额外的 DLL 目录

安装

  1. 在 VS Code 中打开扩展面板(Ctrl+Shift+X)
  2. 搜索 "Qt EXE Setup"
  3. 点击安装

配置

安装后,需要配置以下设置:

  1. 打开 VS Code 设置(Ctrl+,)
  2. 搜索 "qtExeSetup"
  3. 配置以下参数:
    • Qt Path: Qt 安装目录的完整路径(必填)
    • CMake Path: CMake 可执行文件的路径(默认:cmake)
    • MinGW Path: MinGW bin 目录路径(可选)
    • Compiler Type: 编译器类型(MinGW 或 MSVC,默认:MinGW)
    • Output Directory: 打包输出的目录路径(默认:./dist)
    • Build Type: 构建配置类型(Debug 或 Release,默认:Release)
    • Use Deploy Tool: 是否自动运行部署工具(默认:true)
    • Create Installer: 是否创建安装程序包(默认:false)
    • DLL Directories: 额外的 DLL 目录列表(用于复制第三方 DLL 文件)

DLL Directories 配置说明

如果 CMakeLists.txt 中链接了 .lib 文件,但对应的 .dll 文件在其他目录,可以配置额外的 DLL 目录:

{
  "qtExeSetup.dllDirectories": [
    "D:/sherpa-onnx/build-shared/bin/Release",
    "D:/other-lib/bin"
  ]
}

插件会自动从这些目录中复制所有 .dll 文件到输出目录。

使用方法

通过命令面板

  1. 按 Ctrl+Shift+P 打开命令面板
  2. 输入 "Qt: Build and Package Project"
  3. 执行命令开始构建和打包

通过右键菜单

  1. 在工作区中找到 CMakeLists.txt 文件
  2. 右键点击文件
  3. 选择 "Qt: Build and Package"

查看配置

  1. 按 Ctrl+Shift+P 打开命令面板
  2. 输入 "Qt: Print Configuration"
  3. 在输出面板中查看当前配置

系统要求

  • VS Code 1.60.0 或更高版本
  • Node.js
  • CMake 3.16 或更高版本
  • Qt 5 或 Qt 6

平台支持

  • Windows(完整支持)
  • macOS(完整支持)
  • Linux(基本支持)

开发

安装依赖

npm install

编译

npm run compile

监听模式

npm run watch

运行测试

npm run test

许可证

MIT

贡献

欢迎提交 Issue 和 Pull Request!


English

Automate the build, package, and deployment process for Qt/C++ projects in VS Code.

Features

  • Automatic CMake configuration (supports MSVC and MinGW compilers)
  • Automatic project building (supports Debug/Release configurations)
  • Automatic executable file detection
  • Automatic deployment tool execution (windeployqt/macdeployqt/linuxdeployqt)
  • Automatic CMakeLists.txt parsing and dependency copying
  • Automatic resource file copying (resources/ directory and qt.conf file)
  • Support for configuring additional DLL directories

Installation

  1. Open the Extensions panel in VS Code (Ctrl+Shift+X)
  2. Search for "Qt EXE Setup"
  3. Click Install

Configuration

After installation, configure the following settings:

  1. Open VS Code Settings (Ctrl+,)
  2. Search for "qtExeSetup"
  3. Configure the following parameters:
    • Qt Path: Full path to Qt installation directory (required)
    • CMake Path: Path to CMake executable (default: cmake)
    • MinGW Path: MinGW bin directory path (optional)
    • Compiler Type: Compiler type (MinGW or MSVC, default: MinGW)
    • Output Directory: Package output directory path (default: ./dist)
    • Build Type: Build configuration type (Debug or Release, default: Release)
    • Use Deploy Tool: Whether to automatically run deployment tool (default: true)
    • Create Installer: Whether to create installer package (default: false)
    • DLL Directories: List of additional DLL directories (for copying third-party DLL files)

DLL Directories Configuration

If CMakeLists.txt links to .lib files but the corresponding .dll files are in other directories, you can configure additional DLL directories:

{
  "qtExeSetup.dllDirectories": [
    "D:/sherpa-onnx/build-shared/bin/Release",
    "D:/other-lib/bin"
  ]
}

The extension will automatically copy all .dll files from these directories to the output directory.

Usage

Via Command Palette

  1. Press Ctrl+Shift+P to open the Command Palette
  2. Type "Qt: Build and Package Project"
  3. Execute the command to start building and packaging

Via Right-Click Menu

  1. Find the CMakeLists.txt file in your workspace
  2. Right-click on the file
  3. Select "Qt: Build and Package"

View Configuration

  1. Press Ctrl+Shift+P to open the Command Palette
  2. Type "Qt: Print Configuration"
  3. View current configuration in the output panel

System Requirements

  • VS Code 1.60.0 or higher
  • Node.js
  • CMake 3.16 or higher
  • Qt 5 or Qt 6

Platform Support

  • Windows (full support)
  • macOS (full support)
  • Linux (basic support)

Development

Install Dependencies

npm install

Compile

npm run compile

Watch Mode

npm run watch

Run Tests

npm run test

License

MIT

Contributing

Issues and Pull Requests are welcome!


更新记录 / Changelog

Version 1.0.0 (2024-01-10)

新增功能 / New Features:

  • 添加 DLL Directories 配置项,支持配置额外的 DLL 目录
  • 改进 CMakeLists.txt 解析,支持多行和嵌套变量
  • 添加资源管理器右键菜单支持
  • 添加 onStartupFinished 激活事件
  • 修复 windeployqt 在错误目录运行的问题,现在在 dist 目录运行

修复 / Bug Fixes:

  • 修复变量展开逻辑,支持递归展开
  • 修复 target_link_libraries 解析,正确处理 PRIVATE/PUBLIC/INTERFACE 关键字
  • 改进错误处理和日志输出

改进 / Improvements:

  • 改进配置显示,添加 DLL Directories 信息
  • 优化文件复制逻辑,跳过已存在的文件
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft