diff --git a/README.md b/README.md index 08fcae8..9201494 100644 --- a/README.md +++ b/README.md @@ -4,51 +4,47 @@ A starter template for hl2sdk server plugins. ## Requirements -Meson, Ninja, gcc. +Meson, Ninja, gcc/clang. ## Support -### Compiler & targets - -| | Linux x86 | Linux x64 | Windows x86 | Windows x64 | -| ---- | ---- | ---- | ---- | ---- | -| gcc | yes | yes | no | no | -| clang | no | no | no | no | -| msvc | no | no | no | no | - -### SDK branches - -| Branch | Supported | -| ---- | ---- | -| bgt | yes | -| blade | no | -| bms | no | -| contagion | no | -| cs2 | no | -| csgo | no | -| css | yes | -| darkm | no | -| dods | yes | -| doi | no | -| dota | no | -| episode1 | no | -| eye | yes | -| gmod | yes | -| hl2dm | yes | -| insurgency | no | -| l4d | yes | -| l4d2 | yes | -| mcv | no | -| nucleardawn | yes | -| orangebox | yes | -| portal2 | no | -| pvkii | no | -| sdk2013 | no | -| swarm | no | -| tf2 | yes | - For more details check out the `build-matrix.sh` script and meson files. +### Linux + +| Branch | gcc | clang | +| ---- | ---- | ---- | +| bgt | x86 | x86 | +| blade | - | - | +| bms | - | - | +| contagion | - | - | +| cs2 | - | - | +| csgo | - | - | +| css | x86 | x86 | +| darkm | - | - | +| dods | x86 | x86 | +| doi | - | - | +| dota | - | - | +| episode1 | - | - | +| eye | x86 | x86 | +| gmod | x86 | - | +| hl2dm | x86 | x86 | +| insurgency | - | - | +| l4d | x86 | x86 | +| l4d2 | x86 | x86 | +| mcv | - | - | +| nucleardawn | x86 | x86 | +| orangebox | x86 | x86 | +| portal2 | - | - | +| pvkii | - | - | +| sdk2013 | - | - | +| swarm | - | - | +| tf2 | x86/x64 | - | + +### Windows + +Not at the moment. + ## Building 1. Check out the correct SDK branch, e.g. `tf2`: diff --git a/build-matrix.sh b/build-matrix.sh index 100e54c..fadda6c 100755 --- a/build-matrix.sh +++ b/build-matrix.sh @@ -1,9 +1,9 @@ #!/bin/bash -set -euo pipefail +set -eo pipefail ARCHS=('x86' 'x64') -COMPILERS=('g++') +COMPILERS=('g++' 'clang++') BUILDTYPES=('debug' 'release') BRANCHES=( 'bgt' @@ -13,11 +13,11 @@ BRANCHES=( # 'cs2' #new.h # 'csgo' #new.h 'css' - # 'darkm' #public/game/client + # 'darkm' #public/game/server 'dods' # 'doi' #new.h # 'dota' #new.h - # 'episode1' #public/game/client + # 'episode1' #public/game/server 'eye' 'gmod' 'hl2dm' @@ -74,6 +74,18 @@ do for CMP in "${COMPILERS[@]}" do + # memdbgon.h forces NO_MALLOC_OVERRIDE, + # utlmemory.h _aligned_malloc undefined. + # Should we always define NO_MALLOC_OVERRIDE on clang? + if [ "$CMP" = "clang++" ] + then + if [ "$BRANCH" = "gmod" ] || [ "$BRANCH" = "tf2" ] + then + echo "$BRANCH does not support $CMP, skipping!" + continue + fi + fi + export CXX="$CMP" for TYPE in "${BUILDTYPES[@]}" diff --git a/meson.build b/meson.build index fbb8a90..6e4f36f 100644 --- a/meson.build +++ b/meson.build @@ -26,17 +26,12 @@ if arch != 'x86' and arch != 'x64' error('Unsupported arch "@0@"', arch) endif -# Compiler specific defines -if compiler == 'gcc' or compiler == 'clang' - compiler_args += [ - '-DGNUC' - ] -endif - # Warnings compiler_args += [ '-Wall', ] + +# Compiler specific stuff if compiler == 'msvc' compiler_args += [ # '/WX', @@ -44,14 +39,30 @@ if compiler == 'msvc' elif compiler == 'gcc' compiler_args += [ # '-Werror', + '-DGNUC', + '-DNO_MALLOC_OVERRIDE', + '-msse', + '-fPIC', + '-fpermissive', '-Wno-overloaded-virtual', ] + linker_args += [ + '-static-libgcc', + ] elif compiler == 'clang' compiler_args += [ # '-Werror', + '-DGNUC', + '-msse', + '-fPIC', + '-fpermissive', '-Wno-overloaded-virtual', + '-Wno-register', '-fms-extensions', # narrowing casts ] + linker_args += [ + '-static-libgcc', + ] endif # Debug/Release target @@ -114,13 +125,6 @@ elif host_system == 'linux' '-D_vsnprintf=vsnprintf', '-D_alloca=alloca', '-Dstrcmpi=strcasecmp', - '-DNO_MALLOC_OVERRIDE', - '-msse', - '-fPIC', - '-fpermissive', - ] - linker_args += [ - '-static-libgcc', ] endif @@ -150,12 +154,12 @@ elif arch == 'x64' endif # Target specific workarounds -if host_system == 'linux' and buildtype == 'release' +if host_system == 'linux' and buildtype == 'release' and compiler == 'gcc' compiler_args += [ '-Wno-strict-aliasing', ] endif -if host_system == 'linux' and arch == 'x64' +if host_system == 'linux' and arch == 'x64' and compiler == 'gcc' compiler_args += [ # CThreadSpinRWLock() COMPILE_TIME_ASSERT wrong LockInfo_t size '-U_DEBUG',