From 1f1617ad3ca4aad56ff2ba6edb9c444cd2ea6950 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Thu, 29 Jun 2017 19:37:48 -0400 Subject: [PATCH] finished getting 4coder to build on Linux again (custom_4coder.so bug still occurring) --- build.sh | 10 +++++++++- buildsuper.sh | 16 +++++++++++----- meta/build.cpp | 5 +---- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index ca9d55e4..c24ed470 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,15 @@ if [ -z "$BUILD_MODE" ]; then BUILD_MODE="-DDEV_BUILD" 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" g++ $WARNINGS $FLAGS meta/build.cpp -g -o ../build/build diff --git a/buildsuper.sh b/buildsuper.sh index 08daf561..1bf2354d 100755 --- a/buildsuper.sh +++ b/buildsuper.sh @@ -1,8 +1,6 @@ #!/bin/bash # 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` @@ -17,13 +15,11 @@ SCRIPT_FILE=$PHYS_DIR/$TARGET_FILE CODE_HOME=$(dirname "$SCRIPT_FILE") # Find the most reasonable candidate build file - SOURCE="$1" if [ -z "$SOURCE" ]; then SOURCE="$CODE_HOME/4coder_default_bindings.cpp" fi -# 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` @@ -36,7 +32,17 @@ done PHYS_DIR=`pwd -P` 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" -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 diff --git a/meta/build.cpp b/meta/build.cpp index 065a2513..53f994a5 100644 --- a/meta/build.cpp +++ b/meta/build.cpp @@ -247,8 +247,6 @@ build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_ #if defined(IS_LINUX) -# error IS_LINUX - # define GCC_OPTS \ "-Wno-write-strings " \ "-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, "\"%s/%s\"", code_path, code_file); if (flags & LIBS){ build_ap(line, GCC_LIBS); } - build_ap(line, "\"%s/%s\"", code_path, code_file); - swap_ptr(&line.build_options, &line.build_options_prev); Temp_Dir temp = pushdir(out_path);