Skip to content

Latest commit

 

History

History
160 lines (109 loc) · 2.93 KB

File metadata and controls

160 lines (109 loc) · 2.93 KB

Bit HCI 构建快速指南

🚀 快速开始

完整构建(推荐新用户)

# 一键完成:清理 + 配置 + 构建
scripts\rebuild.bat

日常开发

# 配置项目(首次或添加新组件后)
scripts\configure.bat

# 构建所有组件
scripts\build.bat

# 清理构建产物
scripts\clean.bat

📁 构建产物位置

所有构建产物在 build/bin/ 目录:

build/
└── bin/
    ├── bitui_native.exe      # 运行时
    ├── triangle.dll          # 组件
    ├── button.dll
    └── ...                   # 其他组件

▶️ 运行组件

推荐方式(从 bin 目录)

# 进入 bin 目录
cd build\bin

# 运行组件(使用相对路径)
.\bitui_native.exe .\triangle.dll
.\bitui_native.exe .\button.dll
.\bitui_native.exe .\checkbox.dll

从项目根目录运行

# 使用完整路径
build\bin\bitui_native.exe build\bin\triangle.dll

测试脚本

# 使用预置的测试脚本
cd build\bin
test_component.bat

➕ 添加新组件

C++ 组件

  1. examples/cpp/ 创建新文件夹

    mkdir examples\cpp\mycomponent
  2. 创建源文件 mycomponent.cpp

    #include "runtime_api.h"
    
    extern "C" __declspec(dllexport) 
    void component_render(/* ... */) {
        // 组件实现
    }
  3. (可选)添加着色器到 assets/shaders/

  4. 重新配置和构建

    scripts\configure.bat
    scripts\build.bat

就这么简单! 无需创建 CMakeLists.txt,系统会自动发现和构建。


🎯 核心特性

  • 自动组件发现 - 自动扫描 examples/cpp/examples/bit/
  • 自动着色器编译 - 使用 glslc 编译 .vert/.frag 文件
  • 统一输出目录 - 所有产物在 build/bin/
  • 并行构建 - 充分利用多核 CPU
  • 增量编译 - 只重新编译修改过的文件

📚 详细文档


⚡ 性能对比

操作 旧系统 新系统 提升
配置 ~60秒 ~15秒 4x
首次构建 ~120秒 ~30秒 4x
增量构建 ~30秒 ~5秒 6x

🐛 常见问题

Q: 如何只构建单个组件?

cmake --build build --target triangle

Q: 如何并行构建(加快速度)?

cmake --build build -j 8  # 使用 8 个线程

Q: 如何构建 Debug 版本?

cmake --build build --config Debug

Q: 着色器在哪里?

自动编译到 examples/cpp/[component]/assets/shaders/spv/


更新时间: 2025-10-12
系统版本: 2.0