Awes0meE / 66CCFF LabXJTLU Undergraduate西交利物浦大学本科生
Back to work返回项目

Nanjing Turing Qt, Build, and Packaging Learning Log南京图灵 Qt、编译与打包学习记录

A Nanjing Turing internship record around getting Seamly2D running, adding a small account-management layer, studying CMake/build logic, and packaging Qt releases on Windows and macOS.南京图灵实习记录:跑通 Seamly2D,补一个轻量账号管理层,学习 CMake/编译逻辑,并摸索 Windows 与 macOS 上的 Qt Release 打包。

Timeline时间线
2025.082025.08
Status状态
Completed已完成
Stack技术栈
QtC++CMakePackagingInternship
Nanjing Turing Qt, Build, and Packaging Learning Log

Starting Point起点

这段南京图灵实习是我第一次比较集中地和一个真实 Qt/C++ 桌面项目打交道。项目本体是 Seamly2D,一个服装纸样设计软件。刚开始的任务很朴素:把项目拉到 Windows 电脑上,用 Qt Creator 跑起来,弄清楚 Kit、qmake、MSVC 和依赖之间到底怎么配。

This internship moved in a very practical order: first make Seamly2D run, then add a light registration/login and user-management layer, then learn why a Qt program that runs inside Qt Creator still needs a separate release and packaging process before it can run on another machine.

这条线的顺序很实际:先让 Seamly2D 跑起来,再加一层轻量注册/登录和用户管理,接着开始理解为什么 Qt Creator 里能点绿色运行按钮,离“换台机器也能跑”还有一整套 Release 和打包流程。

Seamly2D banner / Seamly2D 项目标识
Seamly2D bannerSeamly2D 项目标识

Source Folder源目录里有什么

源目录里有周日志、我当时写下的学习笔记、脚本、样例文件,也有很多生成物。页面只放小的阅读材料和清理过的摘录;完整上游源码树、build 目录、安装包、DLL 堆和大压缩包都留在网站之外。

The useful material now falls into a few tracks:

  • Three weekly development logs: Qt setup, registration/login, user management, Windows Release, signing, and macOS packaging.
  • Windows 11 first-run note: Qt5 failed, Qt6/MSVC2019 worked, and the right qmake / Kit combination mattered.
  • Windows Release packaging note: windeployqt, third-party DLLs, self-signing, and Inno Setup.
  • Two Notion-exported CMake/build-logic notes: one starts from CMake basics, the other connects MSVC, SDK, CMake, Ninja, and Qt package discovery.
  • macOS packaging scripts: macdeployqt, DMG creation, and self-signing attempts.
  • Seamly2D_addon/: login, registration, control panel, user management, password hashing, and role-control files.
  • sm2d and smis samples: small XML files for reading Seamly2D's data shape.

源目录里比较有用的是这些东西:

  • 三周开发日志:从 Qt 环境、注册登录、用户管理,到 Release、签名和 macOS 打包。
  • Windows 11 跑 Seamly2D 的流程记录:主要是 Qt5 失败、Qt6/MSVC2019 跑通、qmake 和 Kit 的选择。
  • Release 打包 PDF:Windows 下 windeployqt、第三方 DLL、自签名、Inno Setup 的步骤。
  • Notion 导出的 CMake 和编译底层逻辑原文:一份从 CMake 入门开始搭地基,一份把 MSVC、SDK、CMake、Ninja、Qt 包发现这些概念串起来。
  • macOS 打包脚本:尝试用 macdeployqt、DMG 和自签名把流程自动化。
  • Seamly2D_addon/:登录、注册、控制面板、用户管理、密码哈希和角色控制相关新增文件。
  • sm2dsmis 样例文件:用来观察 Seamly2D 的 XML 数据格式。

What I Actually Worked On实际做过的事

第一周主要是把环境跑通,同时把最基本的账号入口接上。注册和登录用 QDialogQSettings 做起来,密码从明文存储改成加盐 SHA-256 校验,输入框改成隐藏显示。登录界面还有一个很具体的坑:中文输入法状态下输密码可能导致程序闪退,后来通过限制用户名和密码框的输入法提示绕过去。

The first week felt like keeping the project alive before doing anything fancy: which Kit Qt Creator should use, where registration/login enters main, and how prompts should behave for existing users, missing users, and wrong passwords. The changes were small, but they had to connect cleanly before the original Seamly2D interface could be reached.

第二周继续补登录后的控制面板。第一次注册的账号必须叫 admin;管理员能看到用户管理入口,普通用户看不到。删除、提升为管理员、降级为普通用户这些操作都加了确认和角色限制,其中只有 admin 能降级其他管理员。

This did not touch Seamly2D's main drawing workflow deeply. It added a small permission layer in front of the original application, and the value was mostly in the details: current user, target role, visible buttons, confirmation prompts, and clear error messages.

这部分没有深入改 Seamly2D 的制图主流程,更多是在原应用入口前加一层轻量权限。真正要细想的是当前登录用户是谁、目标用户是什么角色、哪些按钮该显示、误操作能不能取消、提示信息有没有说清楚。

Build And Release编译与发布

最耗时间的部分其实在编译和打包。Qt5 和 Qt6 不能随便互换,core5compat 会影响项目能否通过,MSVC v142 要和 Qt 包匹配,旧 .pro.user 也可能把环境带偏。Qt Creator 里 Debug 能跑,只说明开发机上的那套配置当下可用,Release 文件夹还要单独整理。

On Windows, the path went through windeployqt, missing third-party DLLs such as xerces-c_3_2.dll, self-signed certificates, and Inno Setup. On macOS, the same idea turned into .app, frameworks, macdeployqt, signing checks, and DMG packaging. This was the part where "runs on my machine" finally became a concrete engineering problem instead of a joke.

Windows 侧要用 windeployqt 收依赖,还要补 xerces-c_3_2.dll 这类第三方库;再往后才是自签名、Inno Setup 和安装包。macOS 侧也一样,.app、frameworks、macdeployqt、签名检查、DMG 都要重新过一遍。到这里,“我电脑上能跑”终于变成了一个具体工程问题。

Handwritten build logic sketch / 编译逻辑手绘草图
Handwritten build logic sketch编译逻辑手绘草图

Public Files页面里保留的文件

These files are the parts worth reading on the website:

这里的 CMake、Qt 首跑、Release 打包、sm2d XML 样例等笔记,大部分是当时写下的原文或原文型材料。它们已经作为页面内容保留,我这次只改项目主页和后来整理出来的三周开发日志,不再重写那些原始笔记本身。

Looking Back回头看

This internship is useful to keep because it shows the path from "I can open the source" to "I can explain why the built program fails somewhere else." Some pieces were feature work, and some pieces were simply the moment when Qt's environment, compiler, SDK, qmake/CMake rules, runtime libraries, and deployment tools became less blurry.

这段实习值得保留,是因为它展示了从“我能打开源码”到“我能解释为什么构建出来的程序换台机器会失败”的过程。有些地方是功能开发,有些地方只是 Qt 环境、编译器、SDK、qmake/CMake 规则、运行时库和部署工具终于没那么模糊的瞬间。

Looking back, the most useful trace is the first fairly complete pass from local development to files another machine might run. Broken environments, compiler conflicts, missing DLLs, signing, and platform moves are less pretty than a final screenshot. They are much closer to what the internship felt like.

现在再看,最有用的线索是第一次比较完整地经历桌面软件从本机开发到整理成可运行文件的过程。环境不通、编译器冲突、打包缺 DLL、签名、换平台重来,这些细节没有最终截图漂亮,但更接近当时真实的实习状态。

Development Notes开发笔记

Project notes connected to hardware, firmware, documentation, and archive material.和这个项目相关的硬件、固件、文档和归档笔记。

Open notes archive打开笔记归档

Public Project Files公开项目资料

Uploaded evidence served from the public asset folder. Use the file index to preview documents, source code, media, PDFs, and downloadable artifacts without leaving the page.这里列出已经上传到公开目录的项目证据。可以在左侧索引里选择文件,在右侧直接预览文档、源码、媒体、PDF 和可下载附件。

35 files35 个文件

auth-role-snippet.cpp

C++ / 705 B

Open file打开文件
C++
// Public excerpt from the Seamly2D internship add-on.
// It shows the local role model only; full source and build outputs are not republished here.

namespace AuthUtils {

enum class Role {
    User,
    Admin
};

Role roleOf(const QString& username)
{
    if (username.compare(QStringLiteral("admin"), Qt::CaseInsensitive) == 0) {
        return Role::Admin;
    }

    QSettings settings;
    settings.beginGroup(QStringLiteral("Auth/users/%1").arg(username));
    const QString role = settings.value(QStringLiteral("role")).toString();
    settings.endGroup();

    if (role.compare(QStringLiteral("admin"), Qt::CaseInsensitive) == 0) {
        return Role::Admin;
    }

    return Role::User;
}

}

Related Media相关媒体

Images, videos, board renders, and public evidence connected to this project.和这个项目相关的图片、视频、板卡渲染图和公开证据。

Open media gallery打开媒体库
Seamly2D banner

Seamly2D bannerSeamly2D 项目标识

Seamly2D visual used for the Qt/C++ internship archive.南京图灵 Qt/C++ 实习档案页使用的 Seamly2D 项目标识。

Turing AI Institute cover

Turing AI Institute cover南京图灵人工智能研究院封面图

Processed institute logo cover for the Nanjing Turing Qt/CMake internship archive.南京图灵 Qt/CMake 实习档案页使用的研究院 Logo 封面图。

Qt logo used in the study folder

Qt logo used in the study folder学习目录里的 Qt 图

Qt visual kept with the Seamly2D first-run notes.和 Seamly2D 首次跑通记录一起保留的 Qt 图。

CMake logo

CMake logoCMake 标识

CMake logo kept with the build-logic learning material.编译逻辑学习资料里保留的 CMake 标识图。

CMake to Make flow

CMake to Make flowCMake 到 Make 的流程图

Diagram used while sorting out CMake, Make, and build-tool responsibilities.整理 CMake、Make 和底层构建工具分工时留下的流程图。

Handwritten build logic sketch

Handwritten build logic sketch编译逻辑手绘草图

Handwritten sketch from the toolchain and build-flow study notes.学习工具链和编译流程时画下来的手绘草图。

CMake tutorial reference diagram

CMake tutorial reference diagramCMake 教程参考流程图

Reference diagram kept beside the Notion-exported CMake study notes.随 Notion 导出的 CMake 学习笔记一起保留的参考流程图。

Compiler and architecture map

Compiler and architecture map编译器与架构关系图

Diagram used in the Qt-oriented build-logic source note.Qt 学习导向编译底层逻辑原文里使用的关系图。

Build toolchain map

Build toolchain map构建工具链关系图

Mermaid export from the build/toolchain learning note.编译与工具链学习笔记里导出的 Mermaid 图。

Platform and SDK flow

Platform and SDK flow平台与 SDK 流程图

Diagram connecting Windows architecture, SDK, compiler, and Qt build choices.把 Windows 架构、SDK、编译器和 Qt 构建选择串起来的图。

MSVC and Qt package map

MSVC and Qt package mapMSVC 与 Qt 包关系图

Visual note around matching Qt packages with the MSVC toolchain.围绕 Qt 包和 MSVC 工具链匹配关系整理出的视觉笔记。

CMake generator flow

CMake generator flowCMake 生成器流程图

Mermaid export showing how CMake hands work to a native build tool.展示 CMake 如何把任务交给本机构建工具的 Mermaid 图。

Ninja build flow

Ninja build flowNinja 构建流程图

Build-flow diagram kept with the Notion compiler notes.跟 Notion 编译笔记一起保留下来的构建流程图。

Qt CMake package discovery

Qt CMake package discoveryQt CMake 包发现流程图

Diagram for understanding how CMake locates Qt packages.理解 CMake 如何定位 Qt 包时整理出来的图。

Runtime dependency map

Runtime dependency map运行时依赖关系图

Dependency map from the build and deployment learning trail.编译与部署学习链路里留下的依赖关系图。

CMake cache flow

CMake cache flowCMake 缓存流程图

Diagram kept while sorting CMake cache behavior and reconfiguration.整理 CMake 缓存行为和重新配置过程时保留的图。

Build configuration map

Build configuration map构建配置关系图

Configuration map from the Notion build-logic note.Notion 编译底层逻辑笔记中的配置关系图。

Release runtime flow

Release runtime flowRelease 运行时流程图

Release-side flow diagram connected to deployment troubleshooting.和部署排错相关的 Release 侧流程图。

Qt build debugging map

Qt build debugging mapQt 编译排错关系图

Debugging map from the Qt/CMake toolchain learning notes.Qt/CMake 工具链学习笔记里整理出的排错关系图。