Fix i686-apple-darwin compile target
This commit is contained in:
+18
-23
@@ -1,29 +1,24 @@
|
||||
os: osx
|
||||
language: rust
|
||||
rust: stable
|
||||
matrix:
|
||||
include:
|
||||
- os: osx # 10.12
|
||||
env: CGFEATURES="--features elcapitan"
|
||||
- os: osx # 10.10
|
||||
osx_image: xcode7.2
|
||||
env: CGFEATURES=""
|
||||
- os: osx # 10.13
|
||||
osx_image: xcode9.4
|
||||
env: CGFEATURES="--features highsierra,elcapitan"
|
||||
# macOS 10.12
|
||||
- env: TARGET=x86_64-apple-darwin CGFEATURES="--features elcapitan"
|
||||
- env: TARGET=i686-apple-darwin CGFEATURES="--features elcapitan"
|
||||
# macOS 10.10
|
||||
- osx_image: xcode7.2
|
||||
env: TARGET=x86_64-apple-darwin CGFEATURES=""
|
||||
- osx_image: xcode7.2
|
||||
env: TARGET=i686-apple-darwin CGFEATURES=""
|
||||
# macOS 10.13
|
||||
- osx_image: xcode9.4
|
||||
env: TARGET=x86_64-apple-darwin CGFEATURES="--features highsierra,elcapitan"
|
||||
- osx_image: xcode9.4
|
||||
env: TARGET=i686-apple-darwin CGFEATURES="--features highsierra,elcapitan"
|
||||
|
||||
install:
|
||||
- rustup target add $TARGET
|
||||
script:
|
||||
- cd core-foundation
|
||||
- cargo build --verbose
|
||||
- cargo test --verbose -- --nocapture
|
||||
- cd ../core-graphics
|
||||
- cargo build --verbose $CGFEATURES
|
||||
- cargo test --verbose $CGFEATURES -- --nocapture
|
||||
- cd ../core-text
|
||||
- cargo build --verbose
|
||||
- cargo test --verbose -- --nocapture
|
||||
- cd ../cocoa
|
||||
- cargo build --verbose
|
||||
- cargo test --verbose -- --nocapture
|
||||
- cd ../io-surface
|
||||
- cargo build --verbose
|
||||
- cargo test --verbose -- --nocapture
|
||||
- cargo build --all-targets --verbose --target $TARGET
|
||||
- cargo test --verbose --target $TARGET -- --nocapture
|
||||
|
||||
@@ -76,7 +76,7 @@ fn main() {
|
||||
|
||||
// create Window
|
||||
let display = CGDisplay::main();
|
||||
let size = NSSize::new(display.pixels_wide() as f64, display.pixels_high() as f64);
|
||||
let size = NSSize::new(display.pixels_wide() as _, display.pixels_high() as _);
|
||||
let window = NSWindow::alloc(nil)
|
||||
.initWithContentRect_styleMask_backing_defer_(NSRect::new(NSPoint::new(0., 0.), size),
|
||||
NSWindowStyleMask::NSTitledWindowMask,
|
||||
|
||||
+10
-10
@@ -42,13 +42,13 @@ mod macos {
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct NSPoint {
|
||||
pub x: f64,
|
||||
pub y: f64,
|
||||
pub x: CGFloat,
|
||||
pub y: CGFloat,
|
||||
}
|
||||
|
||||
impl NSPoint {
|
||||
#[inline]
|
||||
pub fn new(x: f64, y: f64) -> NSPoint {
|
||||
pub fn new(x: CGFloat, y: CGFloat) -> NSPoint {
|
||||
NSPoint {
|
||||
x: x,
|
||||
y: y,
|
||||
@@ -59,8 +59,8 @@ mod macos {
|
||||
unsafe impl objc::Encode for NSPoint {
|
||||
fn encode() -> objc::Encoding {
|
||||
let encoding = format!("{{CGPoint={}{}}}",
|
||||
f64::encode().as_str(),
|
||||
f64::encode().as_str());
|
||||
CGFloat::encode().as_str(),
|
||||
CGFloat::encode().as_str());
|
||||
unsafe { objc::Encoding::from_str(&encoding) }
|
||||
}
|
||||
}
|
||||
@@ -68,13 +68,13 @@ mod macos {
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct NSSize {
|
||||
pub width: f64,
|
||||
pub height: f64,
|
||||
pub width: CGFloat,
|
||||
pub height: CGFloat,
|
||||
}
|
||||
|
||||
impl NSSize {
|
||||
#[inline]
|
||||
pub fn new(width: f64, height: f64) -> NSSize {
|
||||
pub fn new(width: CGFloat, height: CGFloat) -> NSSize {
|
||||
NSSize {
|
||||
width: width,
|
||||
height: height,
|
||||
@@ -85,8 +85,8 @@ mod macos {
|
||||
unsafe impl objc::Encode for NSSize {
|
||||
fn encode() -> objc::Encoding {
|
||||
let encoding = format!("{{CGSize={}{}}}",
|
||||
f64::encode().as_str(),
|
||||
f64::encode().as_str());
|
||||
CGFloat::encode().as_str(),
|
||||
CGFloat::encode().as_str());
|
||||
unsafe { objc::Encoding::from_str(&encoding) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,14 +148,20 @@ mod foundation {
|
||||
// sorted iterators to ensure that each item is the same as its counterpart in
|
||||
// the vector.
|
||||
|
||||
fn compare_function(s0: &id, s1: &id) -> Ordering {
|
||||
unsafe {
|
||||
let (bytes0, len0) = (s0.UTF8String() as *const u8, s0.len());
|
||||
let (bytes1, len1) = (s1.UTF8String() as *const u8, s1.len());
|
||||
let (s0, s1) = (str::from_utf8(slice::from_raw_parts(bytes0, len0)).unwrap(),
|
||||
str::from_utf8(slice::from_raw_parts(bytes1, len1)).unwrap());
|
||||
let (c0, c1) = (s0.chars().next().unwrap(), s1.chars().next().unwrap());
|
||||
c0.cmp(&c1)
|
||||
}
|
||||
}
|
||||
|
||||
// First test cocoa sorting...
|
||||
let mut comparator = ConcreteBlock::new(|s0: id, s1: id| {
|
||||
let (bytes0, len0) = (s0.UTF8String() as *const u8, s0.len());
|
||||
let (bytes1, len1) = (s1.UTF8String() as *const u8, s1.len());
|
||||
let (s0, s1) = (str::from_utf8(slice::from_raw_parts(bytes0, len0)).unwrap(),
|
||||
str::from_utf8(slice::from_raw_parts(bytes1, len1)).unwrap());
|
||||
let (c0, c1) = (s0.chars().next().unwrap(), s1.chars().next().unwrap());
|
||||
match c0.cmp(&c1) {
|
||||
match compare_function(&s0, &s1) {
|
||||
Ordering::Less => NSComparisonResult::NSOrderedAscending,
|
||||
Ordering::Equal => NSComparisonResult::NSOrderedSame,
|
||||
Ordering::Greater => NSComparisonResult::NSOrderedDescending,
|
||||
@@ -173,13 +179,13 @@ mod foundation {
|
||||
|
||||
// Then use rust sorting
|
||||
let mut keys_arr = dict.allKeys().iter().collect::<Vec<_>>();
|
||||
keys_arr.sort();
|
||||
keys_arr.sort_by(compare_function);
|
||||
for (k0, k1) in keys_arr.into_iter().zip(keys.iter()) {
|
||||
assert!(k0.isEqualToString(k1));
|
||||
}
|
||||
|
||||
let mut objects_arr = dict.allValues().iter().collect::<Vec<_>>();
|
||||
objects_arr.sort();
|
||||
objects_arr.sort_by(compare_function);
|
||||
for (v0, v1) in objects_arr.into_iter().zip(objects.iter()) {
|
||||
assert!(v0.isEqualToString(v1));
|
||||
}
|
||||
|
||||
@@ -8,23 +8,23 @@
|
||||
// except according to those terms.
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::os::raw::{c_uint, c_long, c_ulong, c_void, c_int};
|
||||
use std::os::raw::{c_uint, c_void, c_int};
|
||||
use string::CFStringRef;
|
||||
|
||||
pub type Boolean = u8;
|
||||
pub type CFIndex = c_long;
|
||||
pub type mach_port_t = c_uint;
|
||||
pub type CFAllocatorRef = *const c_void;
|
||||
pub type CFNullRef = *const c_void;
|
||||
pub type CFHashCode = c_ulong;
|
||||
pub type CFTypeID = c_ulong;
|
||||
pub type CFTypeRef = *const c_void;
|
||||
pub type CFOptionFlags = u32;
|
||||
pub type OSStatus = i32;
|
||||
pub type SInt32 = c_int;
|
||||
pub type CFTypeID = usize;
|
||||
pub type CFOptionFlags = usize;
|
||||
pub type CFHashCode = usize;
|
||||
pub type CFIndex = isize;
|
||||
|
||||
#[repr(i64)]
|
||||
#[derive(Clone, Copy)]
|
||||
#[repr(isize)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum CFComparisonResult {
|
||||
LessThan = -1,
|
||||
EqualTo = 0,
|
||||
|
||||
@@ -33,15 +33,15 @@ pub const kCFURLHFSPathStyle: CFURLPathStyle = 1;
|
||||
pub const kCFURLWindowsPathStyle: CFURLPathStyle = 2;
|
||||
|
||||
pub static kCFURLBookmarkCreationPreferFileIDResolutionMask: CFURLBookmarkCreationOptions =
|
||||
(1 << 8) as u32;
|
||||
(1u32 << 8) as usize;
|
||||
pub static kCFURLBookmarkCreationMinimalBookmarkMask: CFURLBookmarkCreationOptions =
|
||||
(1 << 9) as u32;
|
||||
(1u32 << 9) as usize;
|
||||
pub static kCFURLBookmarkCreationSuitableForBookmarkFile: CFURLBookmarkCreationOptions =
|
||||
(1 << 10) as u32;
|
||||
(1u32 << 10) as usize;
|
||||
pub static kCFURLBookmarkCreationWithSecurityScope: CFURLBookmarkCreationOptions =
|
||||
(1 << 11) as u32;
|
||||
(1u32 << 11) as usize;
|
||||
pub static kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess: CFURLBookmarkCreationOptions =
|
||||
(1 << 12) as u32;
|
||||
(1u32 << 12) as usize;
|
||||
|
||||
// TODO: there are a lot of missing keys and constants. Add if you are bored or need them.
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ impl ScrollEventUnit {
|
||||
/// Constants that specify the different types of input events.
|
||||
///
|
||||
/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h)
|
||||
#[repr(C)]
|
||||
#[repr(u32)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum CGEventType {
|
||||
Null = 0,
|
||||
|
||||
@@ -10,8 +10,6 @@ license = "MIT / Apache-2.0"
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
gleam = "0.6"
|
||||
|
||||
[target.x86_64-apple-darwin.dependencies]
|
||||
core-foundation = { path = "../core-foundation", version = "0.6" }
|
||||
cgl = "0.2.3"
|
||||
leaky-cow = "0.1.1"
|
||||
|
||||
Reference in New Issue
Block a user