mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 10:00:14 +01:00
move c binding into separate dir
This commit is contained in:
parent
27a87cc80a
commit
3bf5249d08
|
@ -2,24 +2,21 @@ ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
|||
OUT_DIR := ${ROOT_DIR}/out
|
||||
|
||||
SP2_DIR := ${ROOT_DIR}/../../servicepoint2
|
||||
SP2_INCLUDE := ${SP2_DIR}/include
|
||||
SP2_INCLUDE := ${ROOT_DIR}/../../servicepoint2-binding-c
|
||||
SP2_TARGET_RELEASE := ${ROOT_DIR}/../../target/release
|
||||
|
||||
.PHONY: clean
|
||||
.PHONY: build run clean
|
||||
|
||||
build: ${OUT_DIR}/lang_c
|
||||
|
||||
run: ${OUT_DIR}/lang_c
|
||||
out/lang_c
|
||||
|
||||
all: ${OUT_DIR}/lang_c
|
||||
|
||||
${OUT_DIR}/lang_c: ${SP2_TARGET_RELEASE} main.c
|
||||
mkdir -p ${OUT_DIR}
|
||||
gcc main.c -I ${SP2_INCLUDE} -L ${SP2_TARGET_RELEASE} -Wl,-Bstatic -lservicepoint2 -Wl,-Bdynamic -o ${OUT_DIR}/lang_c
|
||||
|
||||
${SP2_TARGET_RELEASE}:
|
||||
cd ${SP2_DIR} && cargo build --release --all-features
|
||||
|
||||
clean:
|
||||
rm -r ${SP2_INCLUDE_DIR} || true
|
||||
rm -r ${OUT_DIR} || true
|
||||
rm -r ${SP2_TARGET_RELEASE} || true
|
||||
|
||||
${OUT_DIR}/lang_c: main.c
|
||||
cd ${SP2_DIR} && cargo build --release --all-features
|
||||
mkdir -p ${OUT_DIR}
|
||||
gcc main.c -I ${SP2_INCLUDE} -L ${SP2_TARGET_RELEASE} -Wl,-Bstatic -lservicepoint2 -Wl,-Bdynamic -o ${OUT_DIR}/lang_c
|
4
servicepoint2-binding-c/generate.sh
Executable file
4
servicepoint2-binding-c/generate.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# if the script crashes here, run `cargo install cbindgen`
|
||||
cbindgen --config cbindgen.toml --clean --output servicepoint2.h ../servicepoint2
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
rm -r include || true
|
||||
|
||||
# if the script crashes here, run `cargo install cbindgen`
|
||||
cbindgen --config cbindgen.toml --clean --output include/servicepoint2.h
|
Loading…
Reference in a new issue