-
Notifications
You must be signed in to change notification settings - Fork 2
/
do-gen
executable file
·38 lines (32 loc) · 1.3 KB
/
do-gen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# N.B. this is for OSHMEM in Open-MPI
#
impl="ompi-c"
inc_dir="`pkg-config --variable includedir $impl`"
flags="`pkg-config --cflags-only-I $impl`"
hdr="$inc_dir/shmem.h"
bindgen \
--no-doc-comments \
--enable-function-attribute-detection \
--allowlist-var '^SHMEM_.*' \
--allowlist-type '^shmem_.*' \
--allowlist-var '^_SHMEM_.*' \
--allowlist-function '^sh.*' \
--constified-enum '.*' --no-prepend-enum-name \
--translate-enum-integer-types \
--raw-line '// these caused by bindgen' \
--raw-line '#![allow(non_camel_case_types)]' \
--raw-line '#![allow(improper_ctypes)]' \
-o shmemlib/src/lib.rs \
$hdr \
-- \
$flags
exit $?
#
# This script generates the Rust source from the C <shmem.h> file. It
# pulls out constants, globals, enums etc. that need to be replicated
# as part of the Rust-based API (./shmemlib). Our shmem interface
# (./shmem) then hides the nasty details of the generated bindings and
# presents them in a Rust-safe manner to the end-programmer.
#