2019-12-23 23:22:56 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# If any command errors, stop the script
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Store the real CWD
|
|
|
|
ME="$(realpath "$0")"
|
|
|
|
LOCATION="$(dirname "$ME")"
|
|
|
|
CODE_HOME="$(dirname "$LOCATION")"
|
|
|
|
|
|
|
|
# Find the most reasonable candidate build file
|
|
|
|
SOURCE="$1"
|
|
|
|
if [ -z "$SOURCE" ]; then
|
2020-01-21 21:24:42 +00:00
|
|
|
SOURCE="$(realpath "$CODE_HOME/4coder_default_bindings.cpp")"
|
2019-12-23 23:22:56 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# NOTE(yuval): Removed -Wno-writable-strings as it is the same as -Wno-write-strings
|
2020-02-08 01:02:42 +00:00
|
|
|
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-missing-declarations -Wno-logical-op-parentheses -g -DOS_MAC=1 -DOS_WINDOWS=0 -DOS_LINUX=0"
|
2019-12-23 23:22:56 +00:00
|
|
|
arch=-m64
|
|
|
|
|
|
|
|
preproc_file=4coder_command_metadata.i
|
|
|
|
meta_macros="-DMETA_PASS"
|
2019-12-24 00:46:58 +00:00
|
|
|
clang++ -I"$CODE_HOME" $meta_macros $arch $opts $debug -std=gnu++0x "$SOURCE" -E -o $preproc_file
|
|
|
|
clang++ -I"$CODE_HOME" $opts $debug -std=gnu++0x "$CODE_HOME/4coder_metadata_generator.cpp" -o "$CODE_HOME/metadata_generator"
|
2019-12-23 23:22:56 +00:00
|
|
|
"$CODE_HOME/metadata_generator" -R "$CODE_HOME" "$PWD/$preproc_file"
|
|
|
|
|
2020-01-15 00:21:02 +00:00
|
|
|
clang++ -I"$CODE_HOME" $arch $opts $debug -std=c++11 "$SOURCE" -shared -o custom_4coder.so -fPIC
|
2019-12-23 23:22:56 +00:00
|
|
|
|
|
|
|
rm "$CODE_HOME/metadata_generator"
|
|
|
|
rm $preproc_file
|