-
Notifications
You must be signed in to change notification settings - Fork 43
/
regen.sh
executable file
·42 lines (30 loc) · 1.29 KB
/
regen.sh
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
#!/bin/bash
set -e
# Regenerates the physx_generated.hpp and physx_generated.rs files, as well
# as compiling and running structgen to regenerate the POD layouts. This script
# is only intended to work on Linux
if [[ -n "$1" && -f ast-dump.json ]]; then
rm ast-dump.json
fi
# note we use nightly as obtaining command output on linux is horrendously slow
# in stable, which is a problem given the size of the JSON AST output
RUST_LOG=debug cargo +nightly run --release -p pxbind
out=$(mktemp -d)
# Compile and run structgen for linux
clang++ -std=c++14 -fuse-ld=lld -w -o "$out/structgen" \
-DPX_PHYSX_STATIC_LIB -DNDEBUG \
-I physx-sys/physx/physx/include \
physx-sys/src/structgen/structgen.cpp
(cd $out && ./structgen)
generated=physx-sys/src/generated
mv $out/structgen_out.hpp $generated/unix
mv $out/structgen_out.rs $generated/unix/structgen.rs
# Compile and run structgen for windows
# clang-cl -fuse-ld=lld-link --target=x86_64-pc-windows-msvc '/std:c++14' '/w' -o "$out/structgen.exe" \
# -DPX_PHYSX_STATIC_LIB -DNDEBUG \
# -I physx-sys/physx/physx/include \
# physx-sys/src/structgen/structgen.cpp
# (cd $out && wine structgen.exe)
# generated=$generated/x86_64-pc-windows-msvc
# mv $out/structgen_out.hpp $generated
# mv $out/structgen_out.rs $generated/structgen.rs