Add clang to the build matrix

This commit is contained in:
Lauri Räsänen 2024-04-28 17:12:51 +03:00
parent a1f328f239
commit d5eddc8376
3 changed files with 72 additions and 60 deletions

View file

@ -4,51 +4,47 @@ A starter template for hl2sdk server plugins.
## Requirements ## Requirements
Meson, Ninja, gcc. Meson, Ninja, gcc/clang.
## Support ## 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. 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 ## Building
1. Check out the correct SDK branch, e.g. `tf2`: 1. Check out the correct SDK branch, e.g. `tf2`:

View file

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -eo pipefail
ARCHS=('x86' 'x64') ARCHS=('x86' 'x64')
COMPILERS=('g++') COMPILERS=('g++' 'clang++')
BUILDTYPES=('debug' 'release') BUILDTYPES=('debug' 'release')
BRANCHES=( BRANCHES=(
'bgt' 'bgt'
@ -13,11 +13,11 @@ BRANCHES=(
# 'cs2' #new.h # 'cs2' #new.h
# 'csgo' #new.h # 'csgo' #new.h
'css' 'css'
# 'darkm' #public/game/client # 'darkm' #public/game/server
'dods' 'dods'
# 'doi' #new.h # 'doi' #new.h
# 'dota' #new.h # 'dota' #new.h
# 'episode1' #public/game/client # 'episode1' #public/game/server
'eye' 'eye'
'gmod' 'gmod'
'hl2dm' 'hl2dm'
@ -74,6 +74,18 @@ do
for CMP in "${COMPILERS[@]}" for CMP in "${COMPILERS[@]}"
do 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" export CXX="$CMP"
for TYPE in "${BUILDTYPES[@]}" for TYPE in "${BUILDTYPES[@]}"

View file

@ -26,17 +26,12 @@ if arch != 'x86' and arch != 'x64'
error('Unsupported arch "@0@"', arch) error('Unsupported arch "@0@"', arch)
endif endif
# Compiler specific defines
if compiler == 'gcc' or compiler == 'clang'
compiler_args += [
'-DGNUC'
]
endif
# Warnings # Warnings
compiler_args += [ compiler_args += [
'-Wall', '-Wall',
] ]
# Compiler specific stuff
if compiler == 'msvc' if compiler == 'msvc'
compiler_args += [ compiler_args += [
# '/WX', # '/WX',
@ -44,14 +39,30 @@ if compiler == 'msvc'
elif compiler == 'gcc' elif compiler == 'gcc'
compiler_args += [ compiler_args += [
# '-Werror', # '-Werror',
'-DGNUC',
'-DNO_MALLOC_OVERRIDE',
'-msse',
'-fPIC',
'-fpermissive',
'-Wno-overloaded-virtual', '-Wno-overloaded-virtual',
] ]
linker_args += [
'-static-libgcc',
]
elif compiler == 'clang' elif compiler == 'clang'
compiler_args += [ compiler_args += [
# '-Werror', # '-Werror',
'-DGNUC',
'-msse',
'-fPIC',
'-fpermissive',
'-Wno-overloaded-virtual', '-Wno-overloaded-virtual',
'-Wno-register',
'-fms-extensions', # narrowing casts '-fms-extensions', # narrowing casts
] ]
linker_args += [
'-static-libgcc',
]
endif endif
# Debug/Release target # Debug/Release target
@ -114,13 +125,6 @@ elif host_system == 'linux'
'-D_vsnprintf=vsnprintf', '-D_vsnprintf=vsnprintf',
'-D_alloca=alloca', '-D_alloca=alloca',
'-Dstrcmpi=strcasecmp', '-Dstrcmpi=strcasecmp',
'-DNO_MALLOC_OVERRIDE',
'-msse',
'-fPIC',
'-fpermissive',
]
linker_args += [
'-static-libgcc',
] ]
endif endif
@ -150,12 +154,12 @@ elif arch == 'x64'
endif endif
# Target specific workarounds # Target specific workarounds
if host_system == 'linux' and buildtype == 'release' if host_system == 'linux' and buildtype == 'release' and compiler == 'gcc'
compiler_args += [ compiler_args += [
'-Wno-strict-aliasing', '-Wno-strict-aliasing',
] ]
endif endif
if host_system == 'linux' and arch == 'x64' if host_system == 'linux' and arch == 'x64' and compiler == 'gcc'
compiler_args += [ compiler_args += [
# CThreadSpinRWLock() COMPILE_TIME_ASSERT wrong LockInfo_t size # CThreadSpinRWLock() COMPILE_TIME_ASSERT wrong LockInfo_t size
'-U_DEBUG', '-U_DEBUG',