Add clang as compiler option
This commit is contained in:
parent
5ff769a8d6
commit
a1f328f239
1 changed files with 23 additions and 25 deletions
48
meson.build
48
meson.build
|
@ -15,13 +15,22 @@ host_system = host_machine.system()
|
||||||
arch = get_option('arch')
|
arch = get_option('arch')
|
||||||
buildtype = get_option('buildtype')
|
buildtype = get_option('buildtype')
|
||||||
|
|
||||||
if compiler == 'msvc'
|
# Sanity checks
|
||||||
elif compiler == 'gcc'
|
if compiler != 'gcc' and compiler != 'clang'
|
||||||
|
error('Unsupported compiler "@0@"', compiler)
|
||||||
|
endif
|
||||||
|
if host_system != 'linux' and host_system != 'windows'
|
||||||
|
error('Unsupported host system system "@0@"', host_system)
|
||||||
|
endif
|
||||||
|
if arch != 'x86' and arch != 'x64'
|
||||||
|
error('Unsupported arch "@0@"', arch)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Compiler specific defines
|
||||||
|
if compiler == 'gcc' or compiler == 'clang'
|
||||||
compiler_args += [
|
compiler_args += [
|
||||||
'-DGNUC'
|
'-DGNUC'
|
||||||
]
|
]
|
||||||
else
|
|
||||||
error('Unsupported compiler "@0@"', compiler)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
|
@ -37,8 +46,12 @@ elif compiler == 'gcc'
|
||||||
# '-Werror',
|
# '-Werror',
|
||||||
'-Wno-overloaded-virtual',
|
'-Wno-overloaded-virtual',
|
||||||
]
|
]
|
||||||
else
|
elif compiler == 'clang'
|
||||||
error('Unsupported compiler "@0@"', compiler)
|
compiler_args += [
|
||||||
|
# '-Werror',
|
||||||
|
'-Wno-overloaded-virtual',
|
||||||
|
'-fms-extensions', # narrowing casts
|
||||||
|
]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Debug/Release target
|
# Debug/Release target
|
||||||
|
@ -51,13 +64,11 @@ if buildtype == 'debug'
|
||||||
compiler_args += [
|
compiler_args += [
|
||||||
'/Od',
|
'/Od',
|
||||||
]
|
]
|
||||||
elif compiler == 'gcc'
|
elif compiler == 'gcc' or compiler == 'clang'
|
||||||
compiler_args += [
|
compiler_args += [
|
||||||
'-g',
|
'-g',
|
||||||
'-O0',
|
'-O0',
|
||||||
]
|
]
|
||||||
else
|
|
||||||
error('Unsupported compiler "@0@"', compiler)
|
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
compiler_args += [
|
compiler_args += [
|
||||||
|
@ -67,12 +78,10 @@ else
|
||||||
compiler_args += [
|
compiler_args += [
|
||||||
'/O2',
|
'/O2',
|
||||||
]
|
]
|
||||||
elif compiler == 'gcc'
|
elif compiler == 'gcc' or compiler == 'clang'
|
||||||
compiler_args += [
|
compiler_args += [
|
||||||
'-O3',
|
'-O3',
|
||||||
]
|
]
|
||||||
else
|
|
||||||
error('Unsupported compiler "@0@"', compiler)
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -113,13 +122,11 @@ elif host_system == 'linux'
|
||||||
linker_args += [
|
linker_args += [
|
||||||
'-static-libgcc',
|
'-static-libgcc',
|
||||||
]
|
]
|
||||||
else
|
|
||||||
error('Unsupported host system system "@0@"', host_system)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# CPU architecture
|
# CPU architecture
|
||||||
if arch == 'x86'
|
if arch == 'x86'
|
||||||
if compiler == 'gcc'
|
if compiler == 'gcc' or compiler == 'clang'
|
||||||
compiler_args += [
|
compiler_args += [
|
||||||
'-m32',
|
'-m32',
|
||||||
]
|
]
|
||||||
|
@ -132,7 +139,7 @@ elif arch == 'x64'
|
||||||
'-DX64BITS',
|
'-DX64BITS',
|
||||||
'-DPLATFORM_64BITS',
|
'-DPLATFORM_64BITS',
|
||||||
]
|
]
|
||||||
if compiler == 'gcc'
|
if compiler == 'gcc' or compiler == 'clang'
|
||||||
compiler_args += [
|
compiler_args += [
|
||||||
'-m64',
|
'-m64',
|
||||||
]
|
]
|
||||||
|
@ -140,8 +147,6 @@ elif arch == 'x64'
|
||||||
'-m64',
|
'-m64',
|
||||||
]
|
]
|
||||||
endif
|
endif
|
||||||
else
|
|
||||||
error('Unsupported arch "@0@"', arch)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Target specific workarounds
|
# Target specific workarounds
|
||||||
|
@ -161,7 +166,6 @@ endif
|
||||||
sdk_includes = include_directories([
|
sdk_includes = include_directories([
|
||||||
'include/hl2sdk/public',
|
'include/hl2sdk/public',
|
||||||
'include/hl2sdk/public/engine',
|
'include/hl2sdk/public/engine',
|
||||||
'include/hl2sdk/public/game/client',
|
|
||||||
'include/hl2sdk/public/game/server',
|
'include/hl2sdk/public/game/server',
|
||||||
'include/hl2sdk/public/mathlib',
|
'include/hl2sdk/public/mathlib',
|
||||||
'include/hl2sdk/public/tier0',
|
'include/hl2sdk/public/tier0',
|
||||||
|
@ -188,8 +192,6 @@ if host_system == 'windows'
|
||||||
cpp.find_library('tier1', dirs: [dir_x64], required: true),
|
cpp.find_library('tier1', dirs: [dir_x64], required: true),
|
||||||
cpp.find_library('vstdlib', dirs: [dir_x64], required: true),
|
cpp.find_library('vstdlib', dirs: [dir_x64], required: true),
|
||||||
]
|
]
|
||||||
else
|
|
||||||
error('Unsupported host system "@0@" and arch "@1@" for libraries')
|
|
||||||
endif
|
endif
|
||||||
elif host_system == 'linux'
|
elif host_system == 'linux'
|
||||||
if arch == 'x86'
|
if arch == 'x86'
|
||||||
|
@ -220,11 +222,7 @@ elif host_system == 'linux'
|
||||||
cpp.find_library('tier1', dirs: [dir_x64], required: true),
|
cpp.find_library('tier1', dirs: [dir_x64], required: true),
|
||||||
cpp.find_library('vstdlib_srv', dirs: [dir_x64], required: true),
|
cpp.find_library('vstdlib_srv', dirs: [dir_x64], required: true),
|
||||||
]
|
]
|
||||||
else
|
|
||||||
error('Unsupported host system "@0@" and arch "@1@" for libraries')
|
|
||||||
endif
|
endif
|
||||||
else
|
|
||||||
error('Unsupported host system "@0@" and arch "@1@" for libraries')
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
add_project_arguments(cpp.get_supported_arguments(compiler_args), language: 'cpp')
|
add_project_arguments(cpp.get_supported_arguments(compiler_args), language: 'cpp')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue