Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: modernize build system #175

Merged
merged 4 commits into from
Feb 8, 2025

Conversation

xujiajiadexiaokeai
Copy link
Contributor

  • Modernize CMake configuration using CMakePresets.json
  • Integrate vcpkg package management as submodule
  • Switch to Visual Studio 2022 generator for Windows builds
  • Simplify and standardize build presets across platforms
  • Clean up GitHub Actions workflow configuration

This change modernizes the build system with better cross-platform support. It introduces vcpkg for package management and uses CMakePresets.json for a more standardized build configuration approach.

wangfenjin and others added 3 commits January 25, 2025 16:29
- Modernize CMake configuration using CMakePresets.json
- Integrate vcpkg package management as submodule
- Switch to Visual Studio 2022 generator for Windows builds
- Simplify and standardize build presets across platforms
- Clean up GitHub Actions workflow configuration

This change modernizes the build system with better cross-platform
support. It introduces vcpkg for package management and uses
CMakePresets.json for a more standardized build configuration approach.
@xujiajiadexiaokeai
Copy link
Contributor Author

##168 (comment)
已参照 https://github.com/lukka/run-cmake 更新到了 lukka/run-cmake@v10
更新后,构建时间有了一些变化:

https://github.com/wangfenjin/simple/actions/runs/13108167263/usage

Job Run time
Linux (ubuntu-20.04) 1m 23s
Linux (ubuntu-22.04-arm) 1m 48s
Linux (ubuntu-latest) 1m 26s
MacOS 3m 30s
Windows (x86) 1m 30s
Windows (x64) 1m 44s
Total 11m 21s

-> New:

https://github.com/xujiajiadexiaokeai/simple/actions/runs/13198555516

Job Run time
Linux (ubuntu-20.04) 1m 18s
Linux (ubuntu-22.04-arm) 1m 27s
Linux (ubuntu-latest) 1m 26s
MacOS 2m 18s
Windows (x86) 3m 9s
Windows (x64) 3m 6s
Total 12m 44s

在更新到lukka/run-cmake@v10后,

  • Linux 构建时间没有变化
  • MacOS 改为与Linux一致,使用了Ninja generator,构建时间缩短
  • Windows 升级到了Visual Studio 17 2022 generator,Cmake Build时间不变,但是因为引入了新的预设后,构建时间增长了90s左右,还在排查原因

PS: 没有将Windows同步使用 Ninja generator,是因为目前还存在一些没有排查出的错误,ci流程跑不通,排查清楚后可能会根据需要统一全平台的generator

@xujiajiadexiaokeai xujiajiadexiaokeai marked this pull request as ready for review February 8, 2025 04:04
@wangfenjin
Copy link
Owner

感谢!可以提 MR 直接merge到 master,这样可以跑 CI

@wangfenjin
Copy link
Owner

我之前那个编译流程在多个平台上做的确实比较 trick

@@ -294,9 +305,11 @@ jobs:
with:
allow_failure: true
files: "${{ github.workspace }}/../../_temp/macos/src/libsimple.dylib, ${{ github.workspace }}/../../_temp/macos/test/dict/jieba.dict.utf8"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我当时这么写是因为各个平台上路径不一样

不知道现在新版的有没有什么方法能获取到这些编译产出

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外你也可以关注下最后 so 文件的大小,之前是在 5M 左右;如果大小没怎么变应该产出就没问题

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最近也在看 bazel 不过感觉跟 cmake 比也是差不多,c++ 的编译环境实在是太差了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,我看一下路径的问题。

产出我昨天ci跑下来都在5M左右,应该没什么问题,我稍后再打开测试一下

@xujiajiadexiaokeai xujiajiadexiaokeai changed the base branch from update-workflow to master February 8, 2025 04:52
@wangfenjin wangfenjin merged commit 8a58619 into wangfenjin:master Feb 8, 2025
7 checks passed
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