finished getting 4coder to build on Linux again (custom_4coder.so bug still occurring)

This commit is contained in:
Allen Webster 2017-06-29 19:37:48 -04:00
parent 613361ddb7
commit 1f1617ad3c
3 changed files with 21 additions and 10 deletions

View File

@ -5,7 +5,15 @@ if [ -z "$BUILD_MODE" ]; then
BUILD_MODE="-DDEV_BUILD" BUILD_MODE="-DDEV_BUILD"
fi fi
WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch" chmod 777 detect_os.sh
os=$("./detect_os.sh")
if [[ "$os" == "linux" ]]; then
WARNINGS="-Wno-write-strings -Wno-comment "
elif [[ "$os" == "mac" ]]; then
WARNINGS="-Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch"
fi
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE" FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
g++ $WARNINGS $FLAGS meta/build.cpp -g -o ../build/build g++ $WARNINGS $FLAGS meta/build.cpp -g -o ../build/build

View File

@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
# Find the code home folder # Find the code home folder
# NOTE(allen): Copied from stack exchange, hope it's reasonable -- readlink doesn't work on mac
TARGET_FILE="$0" TARGET_FILE="$0"
cd `dirname $TARGET_FILE` cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE` TARGET_FILE=`basename $TARGET_FILE`
@ -17,13 +15,11 @@ SCRIPT_FILE=$PHYS_DIR/$TARGET_FILE
CODE_HOME=$(dirname "$SCRIPT_FILE") CODE_HOME=$(dirname "$SCRIPT_FILE")
# Find the most reasonable candidate build file # Find the most reasonable candidate build file
SOURCE="$1" SOURCE="$1"
if [ -z "$SOURCE" ]; then if [ -z "$SOURCE" ]; then
SOURCE="$CODE_HOME/4coder_default_bindings.cpp" SOURCE="$CODE_HOME/4coder_default_bindings.cpp"
fi fi
# NOTE(allen): Copied from stack exchange, hope it's reasonable -- readlink doesn't work on mac
TARGET_FILE="$SOURCE" TARGET_FILE="$SOURCE"
cd `dirname $TARGET_FILE` cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE` TARGET_FILE=`basename $TARGET_FILE`
@ -36,7 +32,17 @@ done
PHYS_DIR=`pwd -P` PHYS_DIR=`pwd -P`
SOURCE=$PHYS_DIR/$TARGET_FILE SOURCE=$PHYS_DIR/$TARGET_FILE
# Detect the OS and choose appropriate flags
chmod 777 "$CODE_HOME/detect_os.sh"
os=$("$CODE_HOME/detect_os.sh")
echo "Building on $os"
if [[ "$os" == "linux" ]]; then
FLAGS="-Wno-write-strings"
elif [[ "$os" == "mac" ]]; then
FLAGS="-Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings"
fi
echo "Building custom_4coders.so from $SOURCE" echo "Building custom_4coders.so from $SOURCE"
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 g++ -I"$CODE_HOME" $FLAGS -std=gnu++0x "$SOURCE" -shared -o custom_4coder.so -fPIC

View File

@ -247,8 +247,6 @@ build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_
#if defined(IS_LINUX) #if defined(IS_LINUX)
# error IS_LINUX
# define GCC_OPTS \ # define GCC_OPTS \
"-Wno-write-strings " \ "-Wno-write-strings " \
"-D_GNU_SOURCE -fPIC " \ "-D_GNU_SOURCE -fPIC " \
@ -346,13 +344,12 @@ build_gcc(u32 flags, char *code_path, char *code_file, char *out_path, char *out
} }
build_ap(line, "-I\"%s\"", code_path); build_ap(line, "-I\"%s\"", code_path);
build_ap(line, "\"%s/%s\"", code_path, code_file);
if (flags & LIBS){ if (flags & LIBS){
build_ap(line, GCC_LIBS); build_ap(line, GCC_LIBS);
} }
build_ap(line, "\"%s/%s\"", code_path, code_file);
swap_ptr(&line.build_options, &line.build_options_prev); swap_ptr(&line.build_options, &line.build_options_prev);
Temp_Dir temp = pushdir(out_path); Temp_Dir temp = pushdir(out_path);