Last active
October 1, 2025 16:33
-
-
Save hiyms/e9fa3cc0147b5a8967cec45fa09af173 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 配置文件 | |
| # 仓颉语言包管理器配置 | |
| # ===== 包基本信息 ===== | |
| [package] | |
| name = "my-cangjie-project" | |
| version = "0.1.0" | |
| cjc-version = "1.0.0" | |
| build = "xxx.cj" # 支持单文件/目录。为多文件时视该文件夹为一个包的根目录 | |
| links = {"xxx"} # 推荐使用,须在 build script 中指定 search-dir | |
| # 工具自行识别是否存在主函数 | |
| # output-type = "executable" # executable | library | static-library | dynamic-library | |
| authors = ["Zhang San <[email protected]>"] | |
| description = "一个使用仓颉语言编写的示例项目" | |
| # 用于发布库至中心时信息标示 | |
| license = "Apache-2.0" | |
| license-file = "" # 使用非典型许可证时,自行包含 | |
| repository = "https://github.com/example/my-cangjie-project" | |
| homepage = "xxx" | |
| docs = "" # 文档地址 | |
| readme = "xxx.md" # 在中心包页面展示 | |
| keywords = ["build"] # 关键字,可多个 | |
| categories = "" # 包类别,仅一个 | |
| exclude = [] | |
| include = [] | |
| publish = ["xxx"] # 预期发布的注册中心,可选。特别地,定义值为false时禁止发布。 | |
| default-run = "a" # 当项目包含多个含主函数的模块时,指定默认运行的模块。 | |
| # package 级 | |
| compiler-flags = ["-O2"] # 工具不完备时,暂时性提供 | |
| linker-flags = [] # 工具不完备时,暂时性提供 | |
| # ===== 依赖声明 ===== | |
| [dependencies] | |
| # 远程仓库依赖(最简形式) | |
| std-http = "1.2.0" | |
| std-json = "2.1.5" | |
| # 远程仓库依赖(完整形式) | |
| std-crypto = { version = "1.0.0" } | |
| # 本地路径依赖 | |
| local-lib = { path = "../local-lib" } | |
| # Git 依赖(标签) | |
| http-client = { git = "https://github.com/cangjie/http-client", tag = "v1.2.0" } | |
| # Git 依赖(分支) | |
| experimental = { git = "https://github.com/cangjie/experimental", branch = "develop" } | |
| # Git 依赖(提交哈希) | |
| fixed-lib = { git = "https://github.com/cangjie/lib", commit = "xxxxxx" } | |
| # 可选依赖 | |
| optional-feature = { version = "0.5.0", option = true } | |
| # 开发时需要的依赖,如在 test 中使用 | |
| [dev-dependencies] | |
| # build script 需要的依赖,如在 test 中使用 | |
| [script-dependencies] | |
| # 平台特定配置(可选覆盖) | |
| [target.linux] | |
| linker-flags = ["-lpthread", "-ldl"] # 更推荐在 build script 中配置 | |
| bin-paths = ["${CANGJIE_STDX_PATH}", "/usr/local/lib"] # 工具不完备时,暂时性提供 | |
| # 特定 target 依赖 | |
| [target.linux.dependencies] | |
| # ===== 构建配置 ===== | |
| [build] | |
| # 基本路径 | |
| source-dir = "src" | |
| output-dir = "target" | |
| # 性能选项 | |
| parallel = true # 启用并行构建 | |
| incremental = true # 启用增量编译 | |
| # jobs = 8 设备相关,默认情况下工具自行决定。支持用户级配置/环境变量/命令行手动配置。 | |
| # 构建钩子 | |
| # pre-build = ["echo 'Starting build...'"] | |
| # post-build = ["echo 'Build completed!'"] | |
| # 使用 build script 替代 | |
| # ===== FFI 配置 ===== | |
| # [ffi] | |
| # includes = ["/usr/include", "./native/include"] | |
| # lib-paths = ["/usr/lib", "./native/lib"] | |
| # libs = ["curl", "ssl"] | |
| # c-flags = ["-std=c11"] | |
| # cxx-flags = ["-std=c++17"] | |
| # ===== 工作空间 ===== | |
| [workspace] | |
| members = ["packages1", "packages2"] # 支持通配符 | |
| default = "packages1" # 指定默认运行的包,可选 | |
| # workspace 级 | |
| compiler-flags = ["-O2"] # 工具不完备时,暂时性提供,使用时展示警告 | |
| linker-flags = [] # 工具不完备时,暂时性提供,使用时展示警告 | |
| # ===== 构建配置文件 ===== | |
| [profile.debug] | |
| optimization-level = 0 | |
| debug = true | |
| [profile.release] | |
| optimization-level = 2 | |
| debug = false | |
| lto = false # 链接时优化 | |
| [profile.release-lto] | |
| optimization-level = 3 | |
| debug = false | |
| lto = true | |
| # 覆盖 dependencies | |
| [patch.crates-io] | |
| foo = { git = 'https://github.com/example/foo.git' } | |
| bar = { path = 'my/local/bar' } | |
| [dependencies.baz] | |
| git = 'https://github.com/example/baz.git' | |
| [patch.'https://github.com/example/baz'] | |
| baz = { git = 'https://github.com/example/patched-baz.git', branch = 'my-branch' } | |
| # 编译特性 | |
| # 特别地,可选依赖以同名 feature 形式在代码内表现。 | |
| [feature] | |
| default = ["bbb"] # 默认启用的 | |
| aaa = [] | |
| bbb = ["aaa"] # 该特性依赖于 aaa | |
| # ===== 测试配置 ===== | |
| # 可选,默认情况下支持自动搜索 | |
| [test] | |
| dir = "tests" | |
| timeout = 300 | |
| parallel = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment