Skip to content

Commit b51b005

Browse files
authored
Merge pull request #405 from godot-rust/bugfix/mac-openxr
Exclude OpenXR from macOS in Godot < 4.2; run `codegen-full` in full-ci
2 parents 9e6fe56 + 312f393 commit b51b005

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

.github/workflows/full-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ jobs:
281281
godot-binary: ${{ matrix.godot-binary }}
282282
godot-args: ${{ matrix.godot-args }}
283283
godot-prebuilt-patch: ${{ matrix.godot-prebuilt-patch }}
284-
rust-extra-args: ${{ matrix.rust-extra-args }}
284+
rust-extra-args: ${{ matrix.rust-extra-args }} --features godot/codegen-full
285285
rust-toolchain: ${{ matrix.rust-toolchain || 'stable' }}
286286
rust-env-rustflags: ${{ matrix.rust-env-rustflags }}
287287
rust-target: ${{ matrix.rust-target }}

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[workspace]
2+
resolver = "2"
23
members = [
34
"godot-bindings",
45
"godot-codegen",

godot-codegen/src/special_cases.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,32 @@ pub(crate) fn is_deleted(class_name: &TyName, godot_method_name: &str) -> bool {
3838

3939
#[rustfmt::skip]
4040
pub(crate) fn is_class_deleted(class_name: &TyName) -> bool {
41+
let class_name = class_name.godot_ty.as_str();
42+
4143
// TODO feature-gate experimental classes.
4244
/*
4345
if !cfg!(feature = "experimental-godot-api") && is_class_experimental(class_name) {
4446
return true;
4547
}
4648
*/
4749

48-
match class_name.godot_ty.as_str() {
50+
// OpenXR has not been available for macOS before 4.2.
51+
// See e.g. https://github.com/GodotVR/godot-xr-tools/issues/479.
52+
#[cfg(all(before_api = "4.2", target_os = "macos"))]
53+
match class_name {
54+
| "OpenXRHand"
55+
| "OpenXRAction"
56+
| "OpenXRActionMap"
57+
| "OpenXRActionSet"
58+
| "OpenXRInteractionProfile"
59+
| "OpenXRIPBinding"
60+
| "OpenXRInterface"
61+
62+
=> return true,
63+
_ => {}
64+
}
65+
66+
match class_name {
4967
// Hardcoded cases that are not accessible.
5068
| "JavaClassWrapper" // only on Android.
5169
| "JavaScriptBridge" // only on WASM.

godot-codegen/src/util.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,16 @@ fn to_hardcoded_rust_ident(full_ty: &GodotTy) -> Option<&str> {
453453
("int", Some("uint32")) => "u32",
454454
("int", Some("uint16")) => "u16",
455455
("int", Some("uint8")) => "u8",
456+
("int", Some(meta)) => panic!("unhandled type int with meta {meta:?}"),
456457

457-
// Floats
458+
// Floats (with single precision builds)
458459
("float", Some("double") | None) => "f64",
459460
("float", Some("float")) => "f32",
461+
("float", Some(meta)) => panic!("unhandled type float with meta {meta:?}"),
462+
463+
// Doubles (with double precision builds)
464+
("double", None) => "f64",
465+
("double", Some(meta)) => panic!("unhandled type double with meta {meta:?}"),
460466

461467
// Others
462468
("bool", None) => "bool",
@@ -474,6 +480,9 @@ fn to_hardcoded_rust_ident(full_ty: &GodotTy) -> Option<&str> {
474480
("int64_t", None) => "i64",
475481
("real_t", None) => "real",
476482
("void", None) => "c_void",
483+
484+
(ty, Some(meta)) => panic!("unhandled type {ty:?} with meta {meta:?}"),
485+
477486
_ => return None,
478487
};
479488

0 commit comments

Comments
 (0)