Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryolitia committed Dec 28, 2024
1 parent 8bd6cb3 commit 2698958
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,19 @@ jobs:
with:
toolchain: stable

- name: BUILD PROTO
- name: BUILD PROTO & lang-unicodes
run: |
cargo build -p lang-unicodes
cargo build -p cn-font-proto
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
target: ${{ matrix.platform.target }}
args: '--locked --release -p ffi'
args: '--locked --release -p ffi --no-default-features'
strip: false
env:
CARGO_WITH_NO_EXTRA: 'True'
HARFBUZZ_SYS_NO_PKG_CONFIG: 'True'

- name: Rename Package On Mac
Expand Down
9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ license = "Apache-2.0"
[dependencies]
cn-font-utils = { version = "0.1.0", path = "crates/cn_font_utils" }
harfbuzz_rs_now = "2.2.6"
lang-unicodes = { version = "0.1.0", path = "crates/lang_unicodes" }
lang-unicodes = { version = "0.1.0", path = "crates/lang_unicodes", default-features = false }
log = "0.4.22"
md5 = "0.7.0"
opentype = "0.38.1"
prost = "0.13.3"
cn-font-proto = { version = "0.1.1", path = "crates/proto" }
cn-font-proto = { version = "0.1.1", path = "crates/proto", default-features = false }
rayon = "1.10.0"
unicode-range = { version = "0.1.0", path = "crates/unicode_range" }
woff = "0.3.3"
Expand All @@ -27,11 +27,14 @@ chrono = "0.4.38"
[dev-dependencies]
env_logger = "0.11.5"


[build-dependencies]
cross = "0.2.5"
tonic-build = "0.12.3"

[features]
default = ["with_extra"]
with_extra = ["lang-unicodes/with_extra", "cn-font-proto/with_extra"]

[workspace]
members = [
"crates/cn_font_utils",
Expand Down
2 changes: 1 addition & 1 deletion Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ zig = false # do not use zig cc for the builds
context = "." # the context folder to build the script in. defaults to `.`

[build.env]
passthrough = ["CARGO_WITH_NO_EXTRA", "HARFBUZZ_SYS_NO_PKG_CONFIG", "OPENCC_BIN", "OPENCC_DATA_PATH"]
passthrough = ["HARFBUZZ_SYS_NO_PKG_CONFIG"]

[target.aarch64-unknown-linux-gnu]
pre-build = [
Expand Down
8 changes: 6 additions & 2 deletions crates/lang_unicodes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ lazy_static = "1.5.0"
path = "src/lib.rs"

[build-dependencies]
lazy_static = "1.5.0"
opencc-rs = "0.4.7"
lazy_static = { version = "1.5.0", optional = true }
opencc-rs = { version = "0.4.7", optional = true }

[features]
default = [ "with_extra" ]
with_extra = ["lazy_static", "opencc-rs"]
24 changes: 22 additions & 2 deletions crates/lang_unicodes/build.rs

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions crates/proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ prost = "0.13.3"
prost-types = { version = "0.13.3", optional = true }

[features]
default = ["with_extra"]
server = ["tonic"]
with_extra = ["tonic-build"]

[build-dependencies]
tonic-build = "0.12.3"
tonic-build = { version = "0.12.3", optional = true }

[lib]
path = "src/lib/mod.rs"
path = "src/lib/mod.rs"
7 changes: 4 additions & 3 deletions crates/proto/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#[cfg(feature = "with_extra")]
fn main() {
if std::env::var("CARGO_WITH_NO_EXTRA").is_ok() {
return;
}
let out_dir = std::path::PathBuf::from("./src/lib");
let _ = std::fs::create_dir_all("./src/lib");

Expand Down Expand Up @@ -39,3 +37,6 @@ fn main() {
let mod_code = mod_code+"\npub const INDEX_PROTO: &[u8] = include_bytes!(\"../index.proto\");";
let _ = std::fs::write("src/lib/mod.rs", mod_code);
}

#[cfg(not(feature = "with_extra"))]
fn main() {}
8 changes: 6 additions & 2 deletions packages/ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ version = "0.1.0"
edition = "2021"

[dependencies]
cn-font-proto = { version = "0.1.0", path = "../../crates/proto" }
cn-font-split = { version = "7.0.0", path = "../.." }
cn-font-proto = { version = "0.1.0", path = "../../crates/proto", default-features = false }
cn-font-split = { version = "7.0.0", path = "../..", default-features = false}
libc = "0.2.165"
prost = "0.13.3"

[features]
default = ["with_extra"]
with_extra = ["cn-font-proto/with_extra", "cn-font-split/with_extra"]

[lib]
crate-type = ["cdylib"]
8 changes: 6 additions & 2 deletions packages/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ version = "0.1.0"
edition = "2021"

[dependencies]
cn-font-proto = { version = "0.1.0", path = "../../crates/proto", features = [
cn-font-proto = { version = "0.1.0", path = "../../crates/proto", default-features = false, features = [
"server",
] }
cn-font-split = { version = "7.0.0", path = "../.." }
cn-font-split = { version = "7.0.0", path = "../..", default-features = false}
cn-font-utils = { version = "0.1.0", path = "../../crates/cn_font_utils" }
prost = "0.13.3"
tokio = { version = "1.19.2", features = ["macros", "rt-multi-thread"] }
Expand All @@ -18,3 +18,7 @@ tracing-subscriber = "0.3.19"

[build-dependencies]
tonic-build = "0.12.3"

[features]
default = ["with_extra"]
with_extra = ["cn-font-split/with_extra", "cn-font-proto/with_extra"]
8 changes: 6 additions & 2 deletions packages/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
cn-font-split = { version = "7.0.0", path = "../.." }
cn-font-split = { version = "7.0.0", path = "../..", default-features = false}
axum = {version = "0.7.9", features = []}
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.68"
Expand All @@ -14,6 +14,10 @@ tokio-stream = "0.1.16"
async-stream = "0.3.6"
futures-util = "0.3.31"
rust-s3 = "0.35.1"
cn-font-proto = { version = "0.1.0", path = "../../crates/proto" }
cn-font-proto = { version = "0.1.0", path = "../../crates/proto", default-features = false }
zip = "2.2.1"
md5 = "0.7.0"

[features]
default = ["with_extra"]
with_extra = ["cn-font-proto/with_extra", "cn-font-split/with_extra"]
8 changes: 6 additions & 2 deletions packages/wasm-edge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ edition = "2021"
crate-type = ["cdylib"]

[dependencies]
cn-font-proto = { version = "0.1.0", path = "../../crates/proto" }
cn-font-split = { version = "7.0.0", path = "../.." }
cn-font-proto = { version = "0.1.0", path = "../../crates/proto", default-features = false }
cn-font-split = { version = "7.0.0", path = "../..", default-features = false }
cn-font-utils = { version = "0.1.0", path = "../../crates/cn_font_utils" }
env_logger = "0.11.5"
prost = "0.13.4"

[features]
default = ["with_extra"]
with_extra = ["cn-font-split/with_extra", "cn-font-proto/with_extra"]

0 comments on commit 2698958

Please sign in to comment.