forked from dvidelabs/flatcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_user_build.in
More file actions
32 lines (22 loc) · 725 Bytes
/
_user_build.in
File metadata and controls
32 lines (22 loc) · 725 Bytes
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
#!/bin/bash
set -e
CC=${CC:-cc}
# assume we are in a subdirectory of the project to build
HERE=$(dirname $0)/..
cd $HERE
ROOT=$(pwd)
NAME=$(basename $ROOT)
mkdir -p build
mkdir -p generated
cd build
if [[ "$FLATCC_PORTABLE" = "yes" ]]; then
CFLAGS="$CFLAGS -DFLATCC_PORTABLE"
fi
CFLAGS="$CFLAGS -I ${ROOT}/include -I ${ROOT}/generated"
CFLAGS_DEBUG=${CFLAGS_DEBUG:--g}
CFLAGS_RELEASE=${CFLAGS_RELEASE:--O2 -DNDEBUG}
${ROOT}/bin/flatcc -a -o ${ROOT}/generated ${ROOT}/src/*.fbs
echo "building '$NAME' for debug"
$CC $CFLAGS $CFLAGS_DEBUG ${ROOT}/src/*.c ${ROOT}/lib/libflatccrt_d.a -o ${NAME}_d
echo "building '$NAME' for release"
$CC $CFLAGS $CFLAGS_RELEASE ${ROOT}/src/*.c ${ROOT}/lib/libflatccrt.a -o ${NAME}