Cargoify rust-cocoa
This must build on non-mac platform too, since Cargo doesn't have support for conditional dependencies yet.
This commit is contained in:
@@ -9,3 +9,5 @@
|
||||
*.dummy
|
||||
cocoa-test
|
||||
build
|
||||
/target
|
||||
/Cargo.lock
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
|
||||
name = "cocoa"
|
||||
version = "0.1.0"
|
||||
authors = ["The Servo Project Developers"]
|
||||
|
||||
build = "make -f makefile.msgsend"
|
||||
|
||||
[lib]
|
||||
|
||||
name = "cocoa"
|
||||
crate-type = ["rlib"]
|
||||
+3
-3
@@ -6,16 +6,16 @@ AR ?= ar
|
||||
RUSTFLAGS ?=
|
||||
CFLAGS += -Wall
|
||||
|
||||
RUST_SRC = $(shell find $(VPATH)/. -type f -name '*.rs')
|
||||
RUST_SRC = $(shell find $(VPATH)/src -type f -name '*.rs')
|
||||
|
||||
.PHONY: all
|
||||
all: libcocoa.dummy
|
||||
|
||||
libcocoa.dummy: cocoa.rc $(RUST_SRC) libmsgsend.a
|
||||
libcocoa.dummy: src/lib.rs $(RUST_SRC) libmsgsend.a
|
||||
$(RUSTC) $(RUSTFLAGS) $< --out-dir .
|
||||
touch $@
|
||||
|
||||
cocoa-test: cocoa.rc $(RUST_SRC) libmsgsend.a
|
||||
cocoa-test: src/lib.rs $(RUST_SRC) libmsgsend.a
|
||||
$(RUSTC) $(RUSTFLAGS) $< -o $@ --test
|
||||
|
||||
libmsgsend.a: msgsend.o
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
CC ?= gcc
|
||||
AR ?= ar
|
||||
CFLAGS += -Wall
|
||||
|
||||
.PHONY : all
|
||||
ifeq (darwin,$(findstring darwin,$(TARGET)))
|
||||
|
||||
all: $(OUT_DIR)/libmsgsend.a
|
||||
|
||||
$(OUT_DIR)/libmsgsend.a: $(OUT_DIR)/msgsend.o
|
||||
$(AR) rcs $(OUT_DIR)/libmsgsend.a $(OUT_DIR)/msgsend.o
|
||||
|
||||
$(OUT_DIR)/msgsend.o: src/msgsend.m
|
||||
$(CC) $(CFLAGS) $< -o $@ -c
|
||||
|
||||
else
|
||||
|
||||
all:
|
||||
|
||||
endif
|
||||
@@ -20,6 +20,8 @@
|
||||
extern crate libc;
|
||||
extern crate std;
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
pub mod appkit;
|
||||
#[cfg(target_os="macos")]
|
||||
pub mod base;
|
||||
|
||||
Reference in New Issue
Block a user