зеркало из https://github.com/mozilla/glean.git
Expand macros before generating the header
BREAKING CHANGE: This requires nightly for cbindgen
This commit is contained in:
Родитель
14f491e873
Коммит
0f6232f543
1
Makefile
1
Makefile
|
@ -36,6 +36,7 @@ test-rust-with-logs:
|
|||
.PHONY: test-rust-with-logs
|
||||
|
||||
cbindgen:
|
||||
RUSTUP_TOOLCHAIN=nightly \
|
||||
cbindgen glean-core/ffi --lockfile Cargo.lock -o glean-core/ffi/examples/glean.h
|
||||
.PHONY: cbindgen
|
||||
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
header = """/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */"""
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
typedef struct ExternError {
|
||||
int32_t code;
|
||||
char *message; // note: nullable
|
||||
} ExternError;
|
||||
typedef const char *FfiStr;
|
||||
typedef uint64_t TimerId;
|
||||
|
||||
"""
|
||||
autogen_warning = """/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||
* To generate this file:
|
||||
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
|
||||
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
|
||||
* 2. Run `cbindgen glean-core/ffi --lockfile Cargo.lock -o glean-core/ffi/examples/glean.h`
|
||||
* 2. Run `RUSTUP_TOOLCHAIN=nightly cbindgen glean-core/ffi --lockfile Cargo.lock -o glean-core/ffi/examples/glean.h`
|
||||
*/"""
|
||||
trailer = """
|
||||
void glean_destroy_glean(uint64_t handle, ExternError *error);
|
||||
void glean_destroy_boolean_metric(uint64_t handle, ExternError *error);
|
||||
void glean_destroy_string_metric(uint64_t handle, ExternError *error);
|
||||
void glean_destroy_counter_metric(uint64_t handle, ExternError *error);
|
||||
void glean_str_free(char *ptr);
|
||||
"""
|
||||
|
||||
language = "C"
|
||||
|
||||
[parse.expand]
|
||||
crates = ["glean_ffi"]
|
||||
|
||||
[parse]
|
||||
parse_deps = true
|
||||
include = ["glean-core", "ffi-support"]
|
||||
|
|
Загрузка…
Ссылка в новой задаче