зеркало из https://github.com/mozilla/glean.git
Update C example
This commit is contained in:
Родитель
73c4f8cdab
Коммит
847f127efb
|
@ -25,4 +25,4 @@ Carthage
|
|||
# local stuff
|
||||
data/
|
||||
glean-core/data
|
||||
glean_app
|
||||
glean_app*
|
||||
|
|
|
@ -1,12 +1,24 @@
|
|||
objects = glean_app.c $(wildcard ../../../target/release/libglean_ffi.so) $(wildcard ../../../target/release/libglean_ffi.dylib)
|
||||
headers = glean.h
|
||||
SRC = glean_app.c
|
||||
HEADERS = glean.h
|
||||
|
||||
glean_app: $(objects) $(headers)
|
||||
$(CC) $(CFLAGS) -o $@ $(objects)
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
OBJECTS_RELEASE = ../../../target/release/libglean_ffi.so
|
||||
OBJECTS_DEBUG = ../../../target/debug/libglean_ffi.so
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
OBJECTS_RELEASE = ../../../target/release/libglean_ffi.dylib
|
||||
OBJECTS_DEBUG = ../../../target/debug/libglean_ffi.dylib
|
||||
endif
|
||||
|
||||
glean_app: $(SRC) $(OBJECTS_DEBUG) $(HEADERS)
|
||||
$(CC) $(CFLAGS) -o $@ $(SRC) $(OBJECTS_DEBUG)
|
||||
|
||||
../../../target/debug/libglean_ffi.dylib: ../src/lib.rs
|
||||
glean_app_release: $(SRC) $(OBJECTS_RELEASE) $(HEADERS)
|
||||
$(CC) $(CFLAGS) -o $@ $(SRC) $(OBJECTS_RELEASE)
|
||||
|
||||
$(OBJECTS_DEBUG): ../src/lib.rs
|
||||
cargo build
|
||||
|
||||
../../../target/release/libglean_ffi.dylib: ../src/lib.rs
|
||||
$(OBJECTS_RELEASE): ../src/lib.rs
|
||||
cargo build --release
|
||||
|
|
|
@ -3,12 +3,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
// Not exported in glean.h right now.
|
||||
typedef struct ExternError {
|
||||
uint32_t code;
|
||||
char *message;
|
||||
} ExternError;
|
||||
|
||||
#include "glean.h"
|
||||
|
||||
int main(void)
|
||||
|
|
Загрузка…
Ссылка в новой задаче