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

Fix no_std compilation in fontique. #158

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ jobs:
with:
save-if: ${{ github.event_name != 'merge_group' }}

# TODO: Add --target x86_64-unknown-none to the no_std check once we solve the compilation issues with it
# TODO: Add --target x86_64-unknown-none to the no_std check once we solve the compilation issues with it.
# https://github.com/linebender/parley/issues/86
- name: cargo clippy (no_std)
run: cargo hack clippy --workspace --locked --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features ${{ env.FEATURES_DEPENDING_ON_STD }} -- -D warnings

Expand Down Expand Up @@ -195,7 +196,8 @@ jobs:
with:
save-if: ${{ github.event_name != 'merge_group' }}

# TODO: Add --target x86_64-unknown-none to the no_std check once we solve the compilation issues with it
# TODO: Add --target x86_64-unknown-none to the no_std check once we solve the compilation issues with it.
# https://github.com/linebender/parley/issues/86
- name: cargo check (no_std)
run: cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features ${{ env.FEATURES_DEPENDING_ON_STD }}

Expand Down
2 changes: 1 addition & 1 deletion examples/vello_editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ workspace = true
[target.'cfg(target_os = "android")'.dependencies]
winit = { version = "0.30.5", features = ["android-native-activity"] }

[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
[target.'cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))'.dependencies]
clipboard-rs = "0.1.11"
2 changes: 1 addition & 1 deletion examples/vello_editor/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Editor {
.unwrap_or_default();

match event.logical_key {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))]
Key::Character(c) if action_mod && matches!(c.as_str(), "c" | "x" | "v") => {
use clipboard_rs::{Clipboard, ClipboardContext};
use parley::layout::editor::ActiveText;
Expand Down
6 changes: 3 additions & 3 deletions fontique/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ icu_properties = { version = "1.5.1", optional = true }
icu_locid = "1.5.0"
hashbrown = "0.15.0"

[target.'cfg(target_family="windows")'.dependencies]
[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.58.0", features = ["implement", "Win32_Graphics_DirectWrite"] }
windows-core = { version = "0.58" }

[target.'cfg(target_vendor="apple")'.dependencies]
[target.'cfg(target_vendor = "apple")'.dependencies]
core-text = "20.1.0"
core-foundation = "0.9.4"
objc2 = { version = "0.5.2" }
objc2-foundation = { version = "0.2.2", features = ["NSArray", "NSEnumerator", "NSPathUtilities", "NSString"] }

[target.'cfg(not(any(target_vendor="apple", target_family="windows")))'.dependencies]
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't test it, but would this code path be used on FreeBSD or some of the other target_os things?

One that might be more relevant would be Open Harmony, not sure what they're doing for things like this... (@nicoburns ?)

Copy link
Member Author

Choose a reason for hiding this comment

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

No it wouldn't be used because the code is:

#[cfg(all(feature = "system", target_os = "linux"))]
#[path = "fontconfig/mod.rs"]
mod system;

#[cfg(all(feature = "system", target_os = "android"))]
#[path = "android.rs"]
mod system;

If the code gets support for additional OSes, then the dependencies should as well.

fontconfig-cache-parser = "0.2.0"
roxmltree = "0.19.0"