forked from numas13/xash3d-ffi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.sh
More file actions
executable file
·138 lines (114 loc) · 4.61 KB
/
generate.sh
File metadata and controls
executable file
·138 lines (114 loc) · 4.61 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/sh
set -e
script=$(readlink -f "$0")
root=$(dirname "$script")
cd "$root"
target="${1:-i686-unknown-linux-gnu}"
MSRV=1.64
CFLAGS=""
CFLAGS+=" -target $target"
CFLAGS+=" -Iinclude"
CFLAGS+=" -Ixash3d-fwgs"
CFLAGS+=" -Ixash3d-fwgs/common"
CFLAGS+=" -Ixash3d-fwgs/public"
CFLAGS+=" -Ixash3d-fwgs/pm_shared"
CFLAGS+=" -Ixash3d-fwgs/filesystem"
CFLAGS+=" -Ixash3d-fwgs/engine"
function generate() {
wrapper_h="$1"
output="$2"
shift 2
echo "generate $output ($wrapper_h)"
bindgen \
"include/$wrapper_h" \
--rust-target $MSRV \
--use-core \
--generate-cstr \
--ignore-functions \
--no-doc-comments \
--no-layout-tests \
--use-array-pointers-in-arguments \
--default-macro-constant-type signed \
--blocklist-file "/usr/.*" \
--blocklist-file "xash3d-fwgs/public/build.h" \
--blocklist-item "NUM_AMBIENTS" \
--blocklist-type "mnode_s" \
--blocklist-type "mnode_s__.*" \
--blocklist-type "float_bits_[st]" \
--blocklist-type "vec[234]_t" \
--blocklist-var "boxpnt" \
--blocklist-var "gEntityInterface" \
--blocklist-var "gNewDLLFunctions" \
--blocklist-var "m_bytenormals" \
--blocklist-var "svc_.*strings" \
--opaque-type va_list \
"$@" -- $CFLAGS > "$output"
}
##############################################################################
# common definitions
##############################################################################
generate "wrapper-common.h" "src/generated/common.rs" \
--allowlist-file "xash3d-fwgs/.*" \
--blocklist-type "netadr_s" \
--blocklist-type "mstudio.*" \
--blocklist-var "ATTN_NONE"
generate "wrapper-keys.h" "src/generated/keys.rs" \
--allowlist-file "xash3d-fwgs/.*"
##############################################################################
# shared apis
##############################################################################
generate "wrapper-player-move.h" "src/generated/player_move.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/pm_shared/pm_defs.h"
generate "wrapper-net-api.h" "src/generated/net_api.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/common/net_api.h"
generate "wrapper-studio-api.h" "src/generated/studio_api.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/common/r_studioint.h" \
--allowlist-file "xash3d-fwgs/common/studio_event.h" \
--allowlist-file "xash3d-fwgs/engine/studio.h"
generate "wrapper-tri-api.h" "src/generated/tri_api.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/common/triangleapi.h"
generate "wrapper-render-api.h" "src/generated/render_api.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/common/lightstyle.h" \
--allowlist-file "xash3d-fwgs/common/render_api.h"
generate "wrapper-fs-api.h" "src/generated/fs_api.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/filesystem/filesystem.h"
generate "wrapper-event-api.h" "src/generated/event_api.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/common/event_api.h"
generate "wrapper-efx-api.h" "src/generated/efx_api.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/common/r_efx.h"
generate "wrapper-phys-api.h" "src/generated/phys_api.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/engine/physint.h"
##############################################################################
# dlls
##############################################################################
generate "wrapper-server.h" "src/generated/server.rs" \
--no-recursive-allowlist \
--allowlist-type "edict_t" \
--allowlist-type "delta_s" \
--allowlist-file "xash3d-fwgs/engine/progdefs.h" \
--allowlist-file "xash3d-fwgs/engine/edict.h" \
--allowlist-file "xash3d-fwgs/engine/eiface.h"
generate "wrapper-client.h" "src/generated/client.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/common/ivoicetweak.h" \
--allowlist-file "xash3d-fwgs/common/demo_api.h" \
--allowlist-file "xash3d-fwgs/engine/cdll_int.h" \
--allowlist-file "xash3d-fwgs/engine/cdll_exp.h"
generate "wrapper-menu.h" "src/generated/menu.rs" \
--no-recursive-allowlist \
--allowlist-file "xash3d-fwgs/common/gameinfo.h" \
--allowlist-file "xash3d-fwgs/engine/menu_int.h"
generate "wrapper-render.h" "src/generated/render.rs" \
--no-recursive-allowlist \
--allowlist-type "convar_[st]" \
--allowlist-file "xash3d-fwgs/common/com_image.h" \
--allowlist-file "xash3d-fwgs/engine/ref_api.h"