- 支持 C++23 的编译器
- GCC >= 14
- Clang >= 17
- MSVC >= 19.34(MSVC 版本号 >= 1934)
- 构建工具
- 推荐:xmake
- 或:CMake >= 3.31 + Ninja
构建库:
xmake build mcpplibs-primitives运行示例:
xmake run ex01_basic_usage运行测试:
xmake run primitives_test兼容别名:
xmake run basicbasic 对应 ex01_basic_usage。
配置并构建:
cmake -B build -G Ninja
cmake --build build --target mcpplibs-primitives构建示例与测试:
cmake --build build --target ex01_basic_usage
cmake --build build --target ex06_conversion
cmake --build build --target ex07_algorithms
cmake --build build --target basic_tests
ctest --test-dir build --output-on-failure可独立构建/运行的示例目标:
ex01_basic_usageex02_type_policyex03_value_policyex04_error_policyex05_concurrency_policyex06_conversionex07_algorithmsex08_custom_underlyingex09_custom_policyex10_custom_operation
请确认工程使用 C++23,且编译器支持 C++ modules。
请使用本文档列出的最低版本,否则可能在配置阶段或模块编译阶段失败。
测试目标依赖 GoogleTest。请确保 xmake 包管理可用,或 CMake 侧可访问配置的拉取源。
- 继续阅读:快速上手
- API 细节: ../../api/zh/README.md