Skip to content

feat: 支持 macOS 构建与自动化打包#9

Merged
qingchenyouforcc merged 2 commits intoqingchenyouforcc:mainfrom
XiaoYuan151:feat/macos-build
May 3, 2026
Merged

feat: 支持 macOS 构建与自动化打包#9
qingchenyouforcc merged 2 commits intoqingchenyouforcc:mainfrom
XiaoYuan151:feat/macos-build

Conversation

@XiaoYuan151
Copy link
Copy Markdown
Contributor

@XiaoYuan151 XiaoYuan151 commented May 3, 2026

Summary

  • 新增 macOS 平台构建支持,引入 cmake/MacApp.cmake 用于打包 .app,并修复 Homebrew 环境下的构建问题
  • build-release / build-debug GitHub Actions 工作流中加入 macOS 自动构建任务
  • 同步更新 Makefile / common.mk / CMakeLists.txt 与 README,补充 macOS 相关说明

Commits

  • build: 修复 macOS 构建并补充 Homebrew 支持
  • ci: 在 build-release / build-debug 中加入 macOS 自动构建

Test plan

  • 本地 macOS 上 make 构建通过
  • CI build-debug / build-release 中 macOS job 成功产出制品
  • Linux / Windows 既有构建未受影响

XiaoYuan151 and others added 2 commits May 3, 2026 16:47
让仓库可以在 Homebrew 安装的 Qt6 / libarchive 下直接构建,并修掉若干
跨平台构建配置的细节问题,README 同步更新 macOS 的构建说明。

- common.mk:在 macOS 上自动探测 Homebrew 的 qtbase / qtmultimedia /
  qttools / libarchive,找不到时回退到 MacPorts;通过 `pkg-config
  --with-path` 让 make 自身的 $(shell pkg-config) 也能命中 keg-only
  路径。
- Makefile:链接时显式带上 libpugixml.a,并把 metainfo.xml /
  resources.rc / metadata.json 这类生成文件依赖通过 `$(filter ...)`
  从链接命令中过滤掉,避免被当作输入扔给 ld。
- CMakeLists.txt:链接 Qt6::WidgetsPrivate 之前先 find_package
  OPTIONAL_COMPONENTS WidgetsPrivate,避免 Homebrew 多 framework 布局
  下回退路径选错 include 目录。
- cmake/libshimejifinder:default_actions.cc / default_behaviors.cc
  设为 HEADER_FILE_ONLY,仍参与生成依赖但不再独立编译,避免触发
  -Werror=unused-const-variable。
- 给 libshimejifinder/bin2cpp.sh 与 src/tools/generate-metainfo.sh
  添加可执行权限。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
把原先 `if: false` 的 macOS 占位 job 替换成参与同一 matrix 的 CMake
+ install-qt-action 流程,并补齐 .app 打包链路。

主要改动:

- `.github/workflows/build-release.yaml`:在 matrix 里加入 macos-14
  (arm64) 和 macos-13 (x86_64),使用 `install-qt-action` 拉取 Qt 6.8.3
  (含 qtmultimedia/qtimageformats),跑 `cmake --build --target macapp`
  打 .app,再用 `ditto` 压成可正确恢复 bundle 的 zip 上传为
  `release-macos-arm64` / `release-macos-x86_64`。删掉旧的
  MacPorts/Make based `build-macos` job。
- `.github/workflows/build-debug.yaml`:在 matrix 里追加 macos-14 入口,
  执行 Debug 构建并上传 `debug-mac-arm64` 用于 PR 验证。
- `cmake/MacApp.cmake`(新增):定义 `macapp` 自定义目标,复制
  `src/packaging/NeurolingsCE.app` 骨架、灌入构建产物(含 CLI)、
  调 `macdeployqt`,最后用 `codesign --force --deep --sign -` 重签整个
  bundle,规避 macdeployqt 偶发的子组件签名失效。Homebrew 多 keg
  布局下额外补 `-libpath` 指向 qtsvg/qtimageformats/qtmultimedia/
  qttools/qtbase 等 keg 目录。
- `CMakeLists.txt`:APPLE 分支引入 MacApp.cmake,并把 NeurolingsCECli
  也带入 .app 的 Contents/MacOS。
- `cmake/Version.cmake`:扩展 `load_version` 把 APP_NAME / APP_BUNDLE_*
  / APP_COMPANY 等键都从 VERSION.txt 解析出来,否则 Info.plist /
  resources.rc / GNOME metadata.json 里的 @APP_BUNDLE_NAME@ 等占位
  会展开成空串,导致 .app 无法启动、Windows 资源元数据为空、GNOME
  扩展加载失败。
- 同步重新生成上述三个生成文件,让仓库里的版本与模板对齐。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@qingchenyouforcc qingchenyouforcc merged commit 4c7d3f8 into qingchenyouforcc:main May 3, 2026
3 checks passed
@XiaoYuan151 XiaoYuan151 deleted the feat/macos-build branch May 4, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants