2016-03-07 19:37:48 +00:00
|
|
|
#!/bin/bash
|
2016-05-07 17:25:45 +00:00
|
|
|
|
2017-06-27 02:47:00 +00:00
|
|
|
echo "Building custom_4coders.so from $SOURCE ..."
|
|
|
|
|
|
|
|
# Find the code home folder
|
|
|
|
|
|
|
|
# NOTE(allen): Copied from stack exchange, hope it's reasonable -- readlink doesn't work on mac
|
|
|
|
TARGET_FILE="$0"
|
|
|
|
cd `dirname $TARGET_FILE`
|
|
|
|
TARGET_FILE=`basename $TARGET_FILE`
|
|
|
|
while [ -L "$TARGET_FILE" ]
|
|
|
|
do
|
|
|
|
TARGET_FILE=`readlink $TARGET_FILE`
|
|
|
|
cd `dirname $TARGET_FILE`
|
|
|
|
TARGET_FILE=`basename $TARGET_FILE`
|
|
|
|
done
|
|
|
|
PHYS_DIR=`pwd -P`
|
|
|
|
SCRIPT_FILE=$PHYS_DIR/$TARGET_FILE
|
2016-07-09 05:21:08 +00:00
|
|
|
CODE_HOME=$(dirname "$SCRIPT_FILE")
|
|
|
|
|
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
|
|
|
|
SOURCE="$CODE_HOME/4coder_default_bindings.cpp"
|
|
|
|
fi
|
|
|
|
|
2017-06-27 02:47:00 +00:00
|
|
|
# NOTE(allen): Copied from stack exchange, hope it's reasonable -- readlink doesn't work on mac
|
|
|
|
TARGET_FILE="$SOURCE"
|
|
|
|
cd `dirname $TARGET_FILE`
|
|
|
|
TARGET_FILE=`basename $TARGET_FILE`
|
|
|
|
while [ -L "$TARGET_FILE" ]
|
|
|
|
do
|
|
|
|
TARGET_FILE=`readlink $TARGET_FILE`
|
|
|
|
cd `dirname $TARGET_FILE`
|
|
|
|
TARGET_FILE=`basename $TARGET_FILE`
|
|
|
|
done
|
|
|
|
PHYS_DIR=`pwd -P`
|
|
|
|
SOURCE=$PHYS_DIR/$TARGET_FILE
|
2017-02-20 21:05:42 +00:00
|
|
|
|
2017-06-27 02:47:00 +00:00
|
|
|
FLAGS="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings"
|
|
|
|
g++ -I"$CODE_HOME" $FLAGS -std=gnu++0x "$SOURCE" -shared -o custom_4coder.so -fPIC
|
2016-03-07 19:37:48 +00:00
|
|
|
|