2016-11-23 03:37:28 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-06-30 00:34:11 +00:00
|
|
|
# Store the real CWD
|
|
|
|
REAL_PWD="$PWD"
|
|
|
|
|
|
|
|
# Find the code home folder
|
|
|
|
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
|
|
|
|
CODE_HOME=$(dirname "$SCRIPT_FILE")
|
|
|
|
|
|
|
|
# Restore the PWD
|
|
|
|
cd "$REAL_PWD"
|
|
|
|
|
|
|
|
# Get the build mode
|
2017-02-26 20:13:06 +00:00
|
|
|
BUILD_MODE="$1"
|
|
|
|
if [ -z "$BUILD_MODE" ]; then
|
|
|
|
BUILD_MODE="-DDEV_BUILD"
|
|
|
|
fi
|
|
|
|
|
2017-06-30 00:34:11 +00:00
|
|
|
# Get the OS specific flags
|
2017-06-29 23:37:48 +00:00
|
|
|
chmod 777 detect_os.sh
|
|
|
|
os=$("./detect_os.sh")
|
|
|
|
|
|
|
|
if [[ "$os" == "linux" ]]; then
|
|
|
|
WARNINGS="-Wno-write-strings -Wno-comment "
|
|
|
|
elif [[ "$os" == "mac" ]]; then
|
2017-06-29 23:41:39 +00:00
|
|
|
WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch"
|
2017-06-29 23:37:48 +00:00
|
|
|
fi
|
|
|
|
|
2017-02-26 20:13:06 +00:00
|
|
|
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
|
2016-11-23 03:37:28 +00:00
|
|
|
|
2017-06-30 00:34:11 +00:00
|
|
|
# Execute
|
|
|
|
g++ $WARNINGS $FLAGS $CODE_HOME/meta/build.cpp -g -o ../build/build
|
2016-11-23 03:37:28 +00:00
|
|
|
../build/build
|
|
|
|
|
|
|
|
|
|
|
|
|