Add clang cflags

This commit is contained in:
Lzu Tao 2018-11-30 16:15:33 +07:00
parent 0a0683f5b2
commit c55d65b35d

View File

@ -46,7 +46,7 @@ zstd_libversion = ''
zstd_rootdir = '../..' zstd_rootdir = '../..'
# ============================================================================= # =============================================================================
# Installing directories # Installation directories
# ============================================================================= # =============================================================================
if host_machine_os == os_windows if host_machine_os == os_windows
@ -125,6 +125,9 @@ add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: [ 'c' ])
if [compiler_gcc, compiler_clang].contains(cc_id) if [compiler_gcc, compiler_clang].contains(cc_id)
common_warning_flags = [ '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ] common_warning_flags = [ '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ]
if cc_id == compiler_clang
common_warning_flags += ['-Werror', '-Wconversion', '-Wno-sign-conversion', '-Wdocumentation']
endif
cc_compile_flags = cc.get_supported_arguments(common_warning_flags + ['-Wstrict-prototypes']) cc_compile_flags = cc.get_supported_arguments(common_warning_flags + ['-Wstrict-prototypes'])
cxx_compile_flags = cxx.get_supported_arguments(common_warning_flags) cxx_compile_flags = cxx.get_supported_arguments(common_warning_flags)
add_project_arguments(cc_compile_flags, language : 'c') add_project_arguments(cc_compile_flags, language : 'c')
@ -132,10 +135,10 @@ if [compiler_gcc, compiler_clang].contains(cc_id)
elif cc_id == compiler_msvc elif cc_id == compiler_msvc
msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ] msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ]
if enable_multithread if enable_multithread
msvc_compile_flags += [ '/MP' ] msvc_compile_flags += '/MP'
endif endif
if enable_static_runtime if enable_static_runtime
msvc_compile_flags += [ '/MT' ] msvc_compile_flags += '/MT'
endif endif
add_project_arguments(msvc_compile_flags, language: ['c', 'cpp']) add_project_arguments(msvc_compile_flags, language: ['c', 'cpp'])
endif endif