Skip to content

Commit a497298

Browse files
committed
Add support in objc2 for running GNUStep on Apple systems
And in the future ObjFW
1 parent 4b401e5 commit a497298

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

objc2/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ exclude = [
2121
"tests-ios/**",
2222
]
2323

24+
build = "build.rs"
25+
2426
[features]
2527
exception = ["objc2_exception"]
2628
verify_message = []

objc2/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use std::env;
2+
3+
fn main() {
4+
// The script doesn't depend on our code
5+
println!("cargo:rerun-if-changed=build.rs");
6+
7+
let runtime = env::var("DEP_OBJC_RUNTIME").unwrap();
8+
println!("cargo:rustc-cfg={}", runtime);
9+
}

objc2/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ mod test_utils;
106106
///
107107
/// This is a temporary solution to make our CI work for now!
108108
#[doc(hidden)]
109-
#[cfg(not(target_vendor = "apple"))]
109+
#[cfg(any(gnustep, winobjc))]
110110
pub mod __gnustep_hack {
111111
use super::runtime::Class;
112112

objc2/src/message/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ unsafe fn conditional_try<R: Encode>(f: impl FnOnce() -> R) -> Result<R, Message
2828

2929
mod verify;
3030

31-
#[cfg(target_vendor = "apple")]
31+
#[cfg(apple)]
3232
#[path = "apple/mod.rs"]
3333
mod platform;
34-
#[cfg(not(target_vendor = "apple"))]
34+
#[cfg(any(gnustep, winobjc))]
3535
#[path = "gnustep.rs"]
3636
mod platform;
3737

objc2/tests/use_macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg(target_vendor = "apple")]
1+
#![cfg(target_vendor = "apple")] // Temporary
22

33
use objc2::runtime::Object;
44
use objc2::{class, msg_send, sel};

0 commit comments

Comments
 (0)