working on getting right flags to compiler for OS

This commit is contained in:
Allen Webster 2017-06-29 19:20:18 -04:00
parent 2723d6df12
commit 613361ddb7
3 changed files with 18 additions and 2 deletions

View File

@ -1,7 +1,5 @@
#!/bin/bash
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
@ -38,6 +36,7 @@ done
PHYS_DIR=`pwd -P`
SOURCE=$PHYS_DIR/$TARGET_FILE
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

9
detect_os.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
os="unknown"
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "mac"
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "linux"
fi

View File

@ -246,20 +246,28 @@ 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 " \
"-fno-threadsafe-statics -pthread"
#define GCC_LIBS \
"-L/usr/local/lib -lX11 -lpthread -lm -lrt " \
"-lGL -ldl -lXfixes -lfreetype -lfontconfig"
#elif defined(IS_MAC)
# define GCC_OPTS \
"-Wno-write-strings -Wno-deprecated-declarations " \
"-Wno-comment -Wno-switch -Wno-null-dereference "
#define GCC_LIBS \
"-framework Cocoa -framework QuartzCore " \
"-framework OpenGL -framework IOKit"
#else
# error gcc options not set for this platform
#endif