Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Remove feature flags
Browse files Browse the repository at this point in the history
closes #120
  • Loading branch information
martial-plains committed Nov 4, 2022
1 parent 85d8461 commit 96a04b2
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 72 deletions.
38 changes: 1 addition & 37 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-macios"
version = "0.2.6"
version = "0.3.0"
edition = "2021"
authors = ["Allister Isaiah Harvey <[email protected]>"]
description = "Apple Frameworks for Rust"
Expand Down Expand Up @@ -32,42 +32,6 @@ incremental = false
codegen-units = 16
rpath = false

[features]
default = [
"appkit",
"background_tasks",
"compression",
"contacts",
"core_foundation",
"core_graphics",
"core_ml",
"core_location",
"foundation",
"kernel",
"natural_language",
"objective_c_runtime",
"uikit",
"user_notifications",
]
appkit = ["objective_c_runtime"]
background_tasks = ["foundation"]
compression = []
contacts = ["foundation"]
core_foundation = ["kernel"]
core_graphics = ["objective_c_runtime"]
core_location = []
core_ml = ["foundation"]
foundation = [
"objective_c_runtime",
"core_foundation",
"core_graphics",
"kernel",
]
kernel = []
natural_language = ["foundation", "core_ml"]
objective_c_runtime = ["foundation"]
uikit = ["foundation"]
user_notifications = ["foundation"]

[dependencies]
# Macros defined in workspace
Expand Down
12 changes: 0 additions & 12 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
fn main() {
#[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos"))]
#[cfg(feature = "uikit")]
println!("cargo:rustc-link-lib=framework=UIKit");

#[cfg(target_os = "macos")]
#[cfg(feature = "appkit")]
println!("cargo:rustc-link-lib=framework=AppKit");

#[cfg(any(
Expand All @@ -13,7 +11,6 @@ fn main() {
target_os = "tvos",
target_os = "watchos"
))]
#[cfg(feature = "user_notifications")]
println!("cargo:rustc-link-lib=framework=UserNotifications");

#[cfg(any(
Expand All @@ -22,7 +19,6 @@ fn main() {
target_os = "tvos",
target_os = "watchos"
))]
#[cfg(feature = "foundation")]
println!("cargo:rustc-link-lib=framework=Foundation");

#[cfg(any(
Expand All @@ -31,7 +27,6 @@ fn main() {
target_os = "tvos",
target_os = "watchos"
))]
#[cfg(feature = "compression")]
println!("cargo:rustc-link-lib=dylib=Compression");

#[cfg(any(
Expand All @@ -40,11 +35,9 @@ fn main() {
target_os = "tvos",
target_os = "watchos"
))]
#[cfg(feature = "natural_language")]
println!("cargo:rustc-link-lib=framework=NaturalLanguage");

#[cfg(any(target_os = "ios", target_os = "tvos"))]
#[cfg(feature = "background_tasks")]
println!("cargo:rustc-link-lib=framework=BackgroundTasks");

#[cfg(any(
Expand All @@ -53,7 +46,6 @@ fn main() {
target_os = "tvos",
target_os = "watchos"
))]
#[cfg(feature = "core_graphics")]
println!("cargo:rustc-link-lib=framework=CoreGraphics");

#[cfg(any(
Expand All @@ -62,11 +54,9 @@ fn main() {
target_os = "tvos",
target_os = "watchos"
))]
#[cfg(feature = "core_foundation")]
println!("cargo:rustc-link-lib=framework=CoreFoundation");

#[cfg(any(target_os = "ios", target_os = "macos", target_os = "watchos"))]
#[cfg(feature = "contacts")]
println!("cargo:rustc-link-lib=framework=Contacts");

#[cfg(any(
Expand All @@ -75,7 +65,6 @@ fn main() {
target_os = "tvos",
target_os = "watchos"
))]
#[cfg(feature = "core_ml")]
println!("cargo:rustc-link-lib=framework=CoreML");

#[cfg(any(
Expand All @@ -84,6 +73,5 @@ fn main() {
target_os = "tvos",
target_os = "watchos"
))]
#[cfg(feature = "core_location")]
println!("cargo:rustc-link-lib=framework=CoreLocation");
}
19 changes: 0 additions & 19 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,20 @@
#![feature(type_ascription)]
#![feature(c_variadic)]

#[cfg(feature = "appkit")]
pub mod appkit;
#[cfg(feature = "background_tasks")]
pub mod background_tasks;
#[cfg(feature = "compression")]
pub mod compression;
#[cfg(feature = "contacts")]
pub mod contacts;

#[cfg(feature = "core_foundation")]
pub mod core_foundation;

#[cfg(feature = "core_graphics")]
pub mod core_graphics;
#[cfg(feature = "core_location")]
pub mod core_location;

#[cfg(feature = "core_ml")]
pub mod core_ml;

#[cfg(feature = "foundation")]
pub mod foundation;
#[cfg(feature = "kernel")]
pub mod kernel;

#[cfg(feature = "natural_language")]
pub mod natural_language;
#[cfg(feature = "objective_c_runtime")]
pub mod objective_c_runtime;
#[cfg(feature = "uikit")]
pub mod uikit;

#[cfg(feature = "user_notifications")]
pub mod user_notifications;

pub(crate) mod utils;
4 changes: 0 additions & 4 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use objc::runtime::{BOOL, NO, YES};

#[cfg(feature = "objective_c_runtime")]
use crate::objective_c_runtime::{id, nil, traits::FromId};
#[cfg(feature = "objective_c_runtime")]
use objc::runtime::Object;

/// A helper function to convert an Objective-C bool to a Rust bool.
Expand All @@ -19,7 +17,6 @@ pub fn to_bool(result: BOOL) -> bool {
}
}

#[cfg(feature = "objective_c_runtime")]
#[inline(always)]
pub fn to_optional<T>(ptr: id) -> Option<T>
where
Expand All @@ -35,7 +32,6 @@ where
}

/// Getting the instance variable of an object.
#[cfg(feature = "objective_c_runtime")]
pub fn get_variable<'a, T>(this: &'a Object, ptr_name: &str) -> &'a T {
unsafe {
let ptr: usize = *this.get_ivar(ptr_name);
Expand Down

0 comments on commit 96a04b2

Please sign in to comment.