feat: add link feature (#608)
adjust docs Update cocoa/Cargo.toml Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> fmt
This commit is contained in:
@@ -15,6 +15,12 @@ default-target = "x86_64-apple-darwin"
|
||||
block = "0.1"
|
||||
bitflags = "1.0"
|
||||
libc = "0.2"
|
||||
core-foundation = { path = "../core-foundation", version = "0.9" }
|
||||
core-graphics-types = { path = "../core-graphics-types", version = "0.1" }
|
||||
core-foundation = { default-features = false, path = "../core-foundation", version = "0.9" }
|
||||
core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.1" }
|
||||
objc = "0.2.3"
|
||||
|
||||
[features]
|
||||
default = ["link"]
|
||||
# Disable to manually link. Enabled by default.
|
||||
link = ["core-foundation/link", "core-graphics-types/link"]
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ mod macos {
|
||||
NSRectMaxYEdge,
|
||||
}
|
||||
|
||||
#[link(name = "Foundation", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "Foundation", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn NSInsetRect(rect: NSRect, x: CGFloat, y: CGFloat) -> NSRect;
|
||||
}
|
||||
@@ -167,7 +167,7 @@ impl NSRange {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "Foundation", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "Foundation", kind = "framework"))]
|
||||
extern "C" {
|
||||
pub static NSDefaultRunLoopMode: id;
|
||||
}
|
||||
|
||||
+8
-3
@@ -15,8 +15,13 @@ default-target = "x86_64-apple-darwin"
|
||||
block = "0.1"
|
||||
bitflags = "1.0"
|
||||
libc = "0.2"
|
||||
cocoa-foundation = { path = "../cocoa-foundation", version = "0.1" }
|
||||
core-foundation = { path = "../core-foundation", version = "0.9" }
|
||||
core-graphics = { path = "../core-graphics", version = "0.23" }
|
||||
cocoa-foundation = { default-features = false, path = "../cocoa-foundation", version = "0.1" }
|
||||
core-foundation = { default-features = false, path = "../core-foundation", version = "0.9" }
|
||||
core-graphics = { default-features = false, path = "../core-graphics", version = "0.23" }
|
||||
foreign-types = "0.5"
|
||||
objc = "0.2.3"
|
||||
|
||||
[features]
|
||||
default = ["link"]
|
||||
# Disable to manually link. Enabled by default.
|
||||
link = ["core-foundation/link", "cocoa-foundation/link", "core-graphics/link"]
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ pub type CGLContextObj = *mut c_void;
|
||||
|
||||
pub type GLint = i32;
|
||||
|
||||
#[link(name = "AppKit", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "AppKit", kind = "framework"))]
|
||||
extern "C" {
|
||||
pub static NSAppKitVersionNumber: f64;
|
||||
|
||||
@@ -3836,7 +3836,7 @@ impl NSImage for id {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "AppKit", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "AppKit", kind = "framework"))]
|
||||
extern "C" {
|
||||
// Image hints (NSString* const)
|
||||
pub static NSImageHintCTM: id;
|
||||
|
||||
@@ -1572,7 +1572,7 @@ impl CATransform3D {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "QuartzCore", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "QuartzCore", kind = "framework"))]
|
||||
extern "C" {
|
||||
static kCARendererColorSpace: CFStringRef;
|
||||
static kCARendererMetalCommandQueue: CFStringRef;
|
||||
|
||||
@@ -10,8 +10,11 @@ license = "MIT OR Apache-2.0"
|
||||
[dependencies]
|
||||
|
||||
[features]
|
||||
default = ["link"]
|
||||
mac_os_10_7_support = [] # backwards compatibility
|
||||
mac_os_10_8_features = [] # enables new features
|
||||
# Disable to manually link. Enabled by default.
|
||||
link = []
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
// We don't use `target_vendor` since that is going to be deprecated:
|
||||
// https://github.com/rust-lang/lang-team/issues/102
|
||||
#[cfg_attr(
|
||||
any(target_os = "macos", target_os = "ios", target_os = "tvos"),
|
||||
all(
|
||||
any(target_os = "macos", target_os = "ios", target_os = "tvos"),
|
||||
feature = "link"
|
||||
),
|
||||
link(name = "CoreFoundation", kind = "framework")
|
||||
)]
|
||||
extern "C" {}
|
||||
|
||||
@@ -11,6 +11,7 @@ keywords = ["macos", "framework", "objc"]
|
||||
|
||||
[dependencies.core-foundation-sys]
|
||||
path = "../core-foundation-sys"
|
||||
default-features = false
|
||||
version = "0.8.5"
|
||||
|
||||
[dependencies]
|
||||
@@ -19,10 +20,15 @@ chrono = { version = "0.4", optional = true }
|
||||
uuid = { version = "0.5", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["link"]
|
||||
|
||||
mac_os_10_7_support = ["core-foundation-sys/mac_os_10_7_support"] # backwards compatibility
|
||||
mac_os_10_8_features = ["core-foundation-sys/mac_os_10_8_features"] # enables new features
|
||||
with-chrono = ["chrono"]
|
||||
with-uuid = ["uuid"]
|
||||
# Disable to manually link. Enabled by default.
|
||||
link = ["core-foundation-sys/link"]
|
||||
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
@@ -9,8 +9,13 @@ license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.0"
|
||||
core-foundation = { path = "../core-foundation", version = "0.9" }
|
||||
core-foundation = { default-features = false, path = "../core-foundation", version = "0.9" }
|
||||
libc = "0.2"
|
||||
|
||||
[features]
|
||||
default = ["link"]
|
||||
# Disable to manually link. Enabled by default.
|
||||
link = ["core-foundation/link"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
default-target = "x86_64-apple-darwin"
|
||||
|
||||
@@ -166,7 +166,7 @@ mod ffi {
|
||||
use core_foundation::dictionary::CFDictionaryRef;
|
||||
use geometry::{CGAffineTransform, CGPoint, CGRect, CGSize};
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
pub fn CGRectInset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect;
|
||||
pub fn CGRectMakeWithDictionaryRepresentation(
|
||||
|
||||
@@ -8,14 +8,16 @@ authors = ["The Servo Project Developers"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
default = ["link"]
|
||||
elcapitan = []
|
||||
highsierra = []
|
||||
# Disable to manually link. Enabled by default.
|
||||
link = ["core-foundation/link", "core-graphics-types/link"]
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.0"
|
||||
core-foundation = { path = "../core-foundation", version = "0.9" }
|
||||
core-graphics-types = { path = "../core-graphics-types", version = "0.1" }
|
||||
core-foundation = { default-features = false, path = "../core-foundation", version = "0.9" }
|
||||
core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.1" }
|
||||
foreign-types = "0.5.0"
|
||||
libc = "0.2"
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ impl ScreenCaptureAccess {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
// Screen Capture Access
|
||||
fn CGRequestScreenCaptureAccess() -> boolean_t;
|
||||
|
||||
@@ -28,7 +28,7 @@ impl CGColor {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CGColorCreateGenericRGB(
|
||||
red: CGFloat,
|
||||
|
||||
@@ -53,7 +53,7 @@ impl CGColorSpace {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
/// The Display P3 color space, created by Apple.
|
||||
pub static kCGColorSpaceDisplayP3: CFStringRef;
|
||||
|
||||
@@ -615,7 +615,7 @@ fn create_bitmap_context_test() {
|
||||
assert_eq!(255, data.bytes()[3]);
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CGContextRetain(c: ::sys::CGContextRef) -> ::sys::CGContextRef;
|
||||
fn CGContextRelease(c: ::sys::CGContextRef);
|
||||
|
||||
@@ -153,7 +153,7 @@ fn test_data_provider() {
|
||||
assert!(dropped.load(SeqCst))
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CGDataProviderCopyData(provider: ::sys::CGDataProviderRef) -> CFDataRef;
|
||||
//fn CGDataProviderCreateDirect
|
||||
|
||||
@@ -640,7 +640,7 @@ impl CGDisplayMode {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
pub static CGRectNull: CGRect;
|
||||
pub static CGRectInfinite: CGRect;
|
||||
|
||||
@@ -673,7 +673,7 @@ impl CGEvent {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
/// Return the type identifier for the opaque type `CGEventRef'.
|
||||
fn CGEventGetTypeID() -> CFTypeID;
|
||||
|
||||
@@ -36,7 +36,7 @@ impl CGEventSource {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
/// Return the type identifier for the opaque type `CGEventSourceRef'.
|
||||
fn CGEventSourceGetTypeID() -> CFTypeID;
|
||||
|
||||
@@ -138,7 +138,7 @@ impl CGFont {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
// TODO: basically nothing has bindings (even commented-out) besides what we use.
|
||||
fn CGFontCreateWithDataProvider(provider: ::sys::CGDataProviderRef) -> ::sys::CGFontRef;
|
||||
|
||||
@@ -72,7 +72,7 @@ impl CGGradient {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CGGradientCreateWithColorComponents(
|
||||
color_space: ::sys::CGColorSpaceRef,
|
||||
|
||||
@@ -125,7 +125,7 @@ impl CGImageRef {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CGImageGetTypeID() -> CFTypeID;
|
||||
fn CGImageGetWidth(image: ::sys::CGImageRef) -> size_t;
|
||||
|
||||
@@ -125,7 +125,7 @@ impl CGPathElement {
|
||||
|
||||
type CGPathApplierFunction = unsafe extern "C" fn(info: *mut c_void, element: *const CGPathElement);
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CGPathCreateWithRect(rect: CGRect, transform: *const CGAffineTransform) -> ::sys::CGPathRef;
|
||||
fn CGPathApply(path: ::sys::CGPathRef, info: *mut c_void, function: CGPathApplierFunction);
|
||||
|
||||
@@ -96,7 +96,7 @@ mod ffi {
|
||||
pub type CGSRegionRef = *mut CGSRegionObject;
|
||||
pub type OSStatus = i32;
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
pub fn CGSRegionRelease(region: CGSRegionRef);
|
||||
pub fn CGSNewRegionWithRect(rect: *const CGRect, outRegion: *mut CGSRegionRef) -> CGError;
|
||||
|
||||
@@ -125,7 +125,7 @@ pub fn create_image_from_array(
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreGraphics", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
|
||||
extern "C" {
|
||||
pub static kCGWindowNumber: CFStringRef;
|
||||
pub static kCGWindowStoreType: CFStringRef;
|
||||
|
||||
@@ -11,13 +11,15 @@ all-features = true
|
||||
default-target = "x86_64-apple-darwin"
|
||||
|
||||
[features]
|
||||
default = ["mountainlion"]
|
||||
default = ["mountainlion", "link"]
|
||||
# For OS X 10.7 compat, exclude this feature. It will exclude some things from
|
||||
# the exposed APIs in the crate.
|
||||
mountainlion = []
|
||||
# Disable to manually link. Enabled by default.
|
||||
link = ["core-foundation/link", "core-graphics/link"]
|
||||
|
||||
[dependencies]
|
||||
foreign-types = "0.5"
|
||||
libc = "0.2"
|
||||
core-foundation = { path = "../core-foundation", version = "0.9" }
|
||||
core-graphics = { path = "../core-graphics", version = "0.23.0" }
|
||||
core-foundation = { default-features = false, path = "../core-foundation", version = "0.9" }
|
||||
core-graphics = { default-features = false, path = "../core-graphics", version = "0.23.0" }
|
||||
|
||||
@@ -594,7 +594,7 @@ pub fn cascade_list_for_languages(
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreText", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreText", kind = "framework"))]
|
||||
extern "C" {
|
||||
/*
|
||||
* CTFont.h
|
||||
|
||||
@@ -84,7 +84,7 @@ impl CTFrame {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreText", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreText", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CTFrameGetTypeID() -> CFTypeID;
|
||||
fn CTFrameGetLines(frame: CTFrameRef) -> CFArrayRef;
|
||||
|
||||
@@ -74,7 +74,7 @@ impl CTFramesetter {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreText", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreText", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CTFramesetterGetTypeID() -> CFTypeID;
|
||||
fn CTFramesetterCreateWithAttributedString(string: CFAttributedStringRef) -> CTFramesetterRef;
|
||||
|
||||
@@ -91,7 +91,7 @@ impl CTLine {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreText", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreText", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CTLineGetTypeID() -> CFTypeID;
|
||||
fn CTLineGetGlyphRuns(line: CTLineRef) -> CFArrayRef;
|
||||
|
||||
@@ -145,7 +145,7 @@ fn create_runs() {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreText", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "CoreText", kind = "framework"))]
|
||||
extern "C" {
|
||||
fn CTRunGetTypeID() -> CFTypeID;
|
||||
fn CTRunGetAttributes(run: CTRunRef) -> CFDictionaryRef;
|
||||
|
||||
@@ -12,7 +12,12 @@ default-target = "x86_64-apple-darwin"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
core-foundation = { path = "../core-foundation", version = "0.9" }
|
||||
core-foundation-sys = { path = "../core-foundation-sys", version = "0.8" }
|
||||
core-foundation = { default-features = false, path = "../core-foundation", version = "0.9" }
|
||||
core-foundation-sys = { default-features = false, path = "../core-foundation-sys", version = "0.8" }
|
||||
cgl = "0.3"
|
||||
leaky-cow = "0.1.1"
|
||||
|
||||
[features]
|
||||
default = ["link"]
|
||||
# Disable to manually link. Enabled by default.
|
||||
link = ["core-foundation/link", "core-foundation-sys/link"]
|
||||
|
||||
@@ -166,7 +166,7 @@ impl IOSurface {
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "IOSurface", kind = "framework")]
|
||||
#[cfg_attr(feature = "link", link(name = "IOSurface", kind = "framework"))]
|
||||
extern "C" {
|
||||
pub static kIOSurfaceAllocSize: CFStringRef;
|
||||
pub static kIOSurfaceWidth: CFStringRef;
|
||||
|
||||
Reference in New Issue
Block a user