2016-03-07 19:37:48 +00:00
|
|
|
#!/bin/bash
|
2016-05-07 17:25:45 +00:00
|
|
|
|
2019-12-14 01:00:55 +00:00
|
|
|
# If any command errors, stop the script
|
|
|
|
set -e
|
2017-06-30 00:02:36 +00:00
|
|
|
|
2019-12-14 01:00:55 +00:00
|
|
|
# Store the real CWD
|
|
|
|
ME="$(readlink -f "$0")"
|
|
|
|
LOCATION="$(dirname "$ME")"
|
|
|
|
CODE_HOME="$(dirname "$LOCATION")"
|
2016-07-09 05:21:08 +00:00
|
|
|
|
2017-06-27 02:47:00 +00:00
|
|
|
# Find the most reasonable candidate build file
|
2016-07-09 05:21:08 +00:00
|
|
|
SOURCE="$1"
|
|
|
|
if [ -z "$SOURCE" ]; then
|
2019-12-14 01:00:55 +00:00
|
|
|
SOURCE="$(readlink -f "$CODE_HOME/4coder_default_bindings.cpp")"
|
2016-07-09 05:21:08 +00:00
|
|
|
fi
|
|
|
|
|
2020-02-20 05:18:38 +00:00
|
|
|
|
|
|
|
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-missing-declarations -Wno-logical-op-parentheses -g -DOS_LINUX=1 -DOS_WINDOWS=0 -DOS_MAC=1"
|
2018-06-15 20:12:00 +00:00
|
|
|
arch=-m64
|
2017-11-09 00:12:14 +00:00
|
|
|
|
2018-06-15 20:12:00 +00:00
|
|
|
preproc_file=4coder_command_metadata.i
|
2018-06-22 20:59:21 +00:00
|
|
|
meta_macros="-DMETA_PASS"
|
2020-02-20 05:18:38 +00:00
|
|
|
g++ -I"$CODE_HOME" $meta_macros $arch $opts $debug -std=c++11 "$SOURCE" -E -o $preproc_file
|
2020-02-20 05:32:07 +00:00
|
|
|
g++ -I"$CODE_HOME" $opts $debug -std=c++11 "$CODE_HOME/4coder_metadata_generator.cpp" -o "$CODE_HOME/metadata_generator"
|
2019-12-14 01:00:55 +00:00
|
|
|
"$CODE_HOME/metadata_generator" -R "$CODE_HOME" "$PWD/$preproc_file"
|
2017-11-22 20:05:58 +00:00
|
|
|
|
2019-12-14 01:00:55 +00:00
|
|
|
g++ -I"$CODE_HOME" $arch $opts $debug -std=gnu++0x "$SOURCE" -shared -o custom_4coder.so -fPIC
|
2016-03-07 19:37:48 +00:00
|
|
|
|
2019-12-14 01:00:55 +00:00
|
|
|
rm "$CODE_HOME/metadata_generator"
|
2018-06-15 20:12:00 +00:00
|
|
|
rm $preproc_file
|