From 32ae91d54f6005bf5f90119d51d0f51db7ab3baa Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 5 May 2022 09:13:16 -0700 Subject: [PATCH] build.cfg: Add BUILD_CLANG option. Set this to 1 if you're having issues with WS/VMAP and recent versionf of GCC. --- build.cfg | 3 +++ build_editor.sh | 10 ++++++++-- build_engine.sh | 31 ++++++++++++++++++++++++------- build_tools.sh | 17 ++++++++++++++++- 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/build.cfg b/build.cfg index 2f7f18ed..5483583b 100644 --- a/build.cfg +++ b/build.cfg @@ -36,3 +36,6 @@ BUILD_ENGINEREVISION=6235 # Whether or not to run 'git pull' or 'svn up' before building a component BUILD_UPDATE=1 + +# If we should try to use CLANG instead of GCC (Linux only) +BUILD_CLANG=0 diff --git a/build_editor.sh b/build_editor.sh index f7eef802..5a90ba52 100755 --- a/build_editor.sh +++ b/build_editor.sh @@ -49,8 +49,14 @@ then else WS_CFLAGS="$WS_CFLAGS" WS_LDFLAGS="$WS_LDFLAGS -ldl" - WS_CC=gcc - WS_CXX=g++ + + if [ "$BUILD_CLANG" = "1" ]; then + WS_CC=clang + WS_CXX=clang++ + else + WS_CC=gcc + WS_CXX=g++ + fi fi mkdir -p ./bin diff --git a/build_engine.sh b/build_engine.sh index fd1251e4..f5708e45 100755 --- a/build_engine.sh +++ b/build_engine.sh @@ -26,6 +26,21 @@ else BUILD_PROC=$(nproc) fi +# Compiler choice +if [ "$COMPILE_SYS" = "OpenBSD" ] +then + ENGINE_CC=cc + ENGINE_CXX=c++ +else + if [ "$BUILD_CLANG" = "1" ]; then + ENGINE_CC=clang + ENGINE_CXX=clang++ + else + ENGINE_CC=gcc + ENGINE_CXX=g++ + fi +fi + if [ "$BUILD_DEBUG" -eq 1 ] then MAKETARGET=gl-dbg @@ -107,24 +122,25 @@ fi if [ "$BUILD_ENGINE_DEPENDENCIES" -eq 1 ] then - gmake -j $BUILD_PROC makelibs FTE_TARGET=$PLATFORM + CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC makelibs FTE_TARGET=$PLATFORM printf "Built the static dependencies successfully.\n\n" fi -gmake -j $BUILD_PROC $MAKETARGET CFLAGS=-DMULTITHREAD FTE_TARGET=$PLATFORM +CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC $MAKETARGET CFLAGS=-DMULTITHREAD FTE_TARGET=$PLATFORM cp -v "$OUTPUT" ../../../bin/fteqw printf "Built the client engine successfully.\n\n" -gmake -j $BUILD_PROC sv-dbg +CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC sv-dbg cp -v ./debug/fteqw-sv ../../../bin/fteqw-sv printf "Built the dedicated server successfully.\n\n" -gmake -j $BUILD_PROC qcc-rel +CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC qcc-rel cp -v ./release/fteqcc ../../../bin/fteqcc printf "Built the QuakeC compiler successfully.\n\n" if [ "$BUILD_IMGTOOL" -eq 1 ] then + # Note: DOESN'T LIKE CLANG! gmake -j $BUILD_PROC imgtool-rel cp -v ./release/imgtool ../../../bin/imgtool printf "Built the imgtool successfully.\n\n" @@ -132,6 +148,7 @@ fi if [ "$BUILD_SOURCE" -eq 1 ] then + # Note: DOESN'T LIKE CLANG! gmake -j $BUILD_PROC plugins-rel CFLAGS=-DGLQUAKE NATIVE_PLUGINS="hl2" find ./release/ -name 'fteplug_hl2_*.so' -exec cp -prv '{}' '../../../bin/' ';' printf "Built the Source Engine plugin successfully.\n\n" @@ -139,21 +156,21 @@ fi if [ "$BUILD_BULLET" -eq 1 ] then - gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="bullet" + CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="bullet" find ./release/ -name 'fteplug_bullet_*.so' -exec cp -prv '{}' '../../../bin/' ';' printf "Built the bullet plugin successfully.\n\n" fi if [ "$BUILD_ODE" -eq 1 ] then - gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ode" + CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ode" find ./release/ -name 'fteplug_ode_*.so' -exec cp -prv '{}' '../../../bin/' ';' printf "Built the ode plugin successfully.\n\n" fi if [ "$BUILD_FFMPEG" -eq 1 ] then - gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ffmpeg" + CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ffmpeg" find ./release/ -name 'fteplug_ffmpeg_*.so' -exec cp -prv '{}' '../../../bin/' ';' printf "Built the ffmpeg plugin successfully.\n\n" fi diff --git a/build_tools.sh b/build_tools.sh index eb98c2f6..bf03948a 100755 --- a/build_tools.sh +++ b/build_tools.sh @@ -26,6 +26,21 @@ else BUILD_PROC=$(nproc) fi +# Compiler choice +if [ "$COMPILE_SYS" = "OpenBSD" ] +then + ENGINE_CC=cc + ENGINE_CXX=c++ +else + if [ "$BUILD_CLANG" = "1" ]; then + ENGINE_CC=clang + ENGINE_CXX=clang++ + else + ENGINE_CC=gcc + ENGINE_CXX=g++ + fi +fi + mkdir -p ./bin if [ -f "$VVM_MAKEFILE" ] @@ -50,7 +65,7 @@ then gmake clean fi -gmake -j $BUILD_PROC +CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC printf "Built vvmtool successfully.\n" cp -v vvmtool ../../bin/vvmtool printf "DONE. Built ALL components successfully.\n"