aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile14
-rw-r--r--build.rs10
2 files changed, 23 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index b4e76fa..67ae18e 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,13 @@ SOURCE_FILES = $(shell find src -type f -name '*.rs')
LIB := target/debug/libdome_key_map.a
-$(LIB): $(SOURCE_FILES)
+DKESS_LIB_DEBUG := ~/Library/Developer/Xcode/DerivedData/dome_key_event_source_simulator-*/Build/Products/Debug/libdome_key_event_source_simulator.a
+DKESS_LOCAL_LIB_DEBUG := target/debug/deps/libdome_key_event_source_simulator.a
+
+.PHONY: build
+build: $(LIB)
+
+$(LIB): $(SOURCE_FILES) $(DKESS_LOCAL_LIB_DEBUG)
cargo build
includer: clean $(LIB)
@@ -14,3 +20,9 @@ moder: moder.c $(LIB)
.PHONY: clean
clean:
rm -f includer moder
+
+$(DKESS_LIB_DEBUG):
+ $(MAKE) -C lib/dome_key_event_source_simulator $@
+
+$(DKESS_LOCAL_LIB_DEBUG): $(DKESS_LIB_DEBUG)
+ cp -a $< $@
diff --git a/build.rs b/build.rs
index d2a0b5d..8c883f4 100644
--- a/build.rs
+++ b/build.rs
@@ -1,5 +1,7 @@
extern crate cbindgen;
+use std::env;
+
use cbindgen::Language;
fn main() {
@@ -15,4 +17,12 @@ fn main() {
.generate()
.expect("Unable to generate bindings")
.write_to_file("dome_key_map.h");
+
+
+ // Link libdome_key_event_source_simulator.a
+ println!("cargo:rustc-link-lib=static=dome_key_event_source_simulator");
+ println!(
+ "cargo:rustc-link-search=native=./target/{profile}/deps",
+ profile=env::var("PROFILE").unwrap(),
+ );
}