diff --git a/buildsuper.sh b/buildsuper.sh index bd9a20ec..08daf561 100755 --- a/buildsuper.sh +++ b/buildsuper.sh @@ -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 diff --git a/detect_os.sh b/detect_os.sh new file mode 100644 index 00000000..2160aa9e --- /dev/null +++ b/detect_os.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +os="unknown" +if [[ "$OSTYPE" == "darwin"* ]]; then +echo "mac" +elif [[ "$OSTYPE" == "linux-gnu" ]]; then +echo "linux" +fi + diff --git a/meta/build.cpp b/meta/build.cpp index 505763d4..065a2513 100644 --- a/meta/build.cpp +++ b/meta/build.cpp @@ -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