mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 12:15:19 +00:00
meson: Fix MSVC build with GST_DISABLE_GST_DEBUG
MSVC does not understand Wno-unused Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5585>
This commit is contained in:
parent
e7479a8c94
commit
5e147ed3b8
7 changed files with 153 additions and 72 deletions
|
@ -57,8 +57,6 @@ if cc.get_id() == 'msvc'
|
||||||
|
|
||||||
# Enable some warnings on MSVC to match GCC/Clang behaviour
|
# Enable some warnings on MSVC to match GCC/Clang behaviour
|
||||||
'/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
'/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
||||||
'/w14101', # 'identifier' : unreferenced local variable
|
|
||||||
'/w14189', # 'identifier' : local variable is initialized but not referenced
|
|
||||||
]
|
]
|
||||||
add_project_arguments(msvc_args, language: 'c')
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
endif
|
endif
|
||||||
|
@ -233,8 +231,26 @@ else
|
||||||
gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
|
gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if gst_debug_disabled and cc.has_argument('-Wno-unused')
|
if gst_debug_disabled
|
||||||
add_project_arguments('-Wno-unused', language: 'c')
|
message('GStreamer debug system is disabled')
|
||||||
|
if cc.get_argument_syntax() == 'msvc'
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/wd4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/wd4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
|
elif cc.has_argument('-Wno-unused')
|
||||||
|
add_project_arguments(['-Wno-unused'], language: 'c')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/we4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
|
endif
|
||||||
|
message('GStreamer debug system is enabled')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
warning_flags = [
|
warning_flags = [
|
||||||
|
|
|
@ -133,8 +133,6 @@ if cc.get_id() == 'msvc'
|
||||||
'/we4053', # one void operand for '?:'
|
'/we4053', # one void operand for '?:'
|
||||||
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
||||||
'/we4098', # 'function' : void function returning a value
|
'/we4098', # 'function' : void function returning a value
|
||||||
'/we4101', # 'identifier' : unreferenced local variable
|
|
||||||
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
|
||||||
])
|
])
|
||||||
endif
|
endif
|
||||||
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
||||||
|
@ -161,28 +159,36 @@ if cc.has_argument('-fno-strict-aliasing')
|
||||||
add_project_arguments('-fno-strict-aliasing', language: 'c')
|
add_project_arguments('-fno-strict-aliasing', language: 'c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Disable compiler warnings for unused variables and args if gst debug system is disabled
|
||||||
if gst_dep.type_name() == 'internal'
|
if gst_dep.type_name() == 'internal'
|
||||||
gst_proj = subproject('gstreamer')
|
gst_proj = subproject('gstreamer')
|
||||||
|
gst_debug_disabled = not gst_proj.get_variable('gst_debug')
|
||||||
if not gst_proj.get_variable('gst_debug')
|
|
||||||
message('GStreamer debug system is disabled')
|
|
||||||
add_project_arguments('-Wno-unused', language: 'c')
|
|
||||||
else
|
|
||||||
message('GStreamer debug system is enabled')
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
# We can't check that in the case of subprojects as we won't
|
# We can't check that in the case of subprojects as we won't
|
||||||
# be able to build against an internal dependency (which is not built yet)
|
# be able to build against an internal dependency (which is not built yet)
|
||||||
if not cc.compiles('''
|
gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
|
||||||
#include <gst/gstconfig.h>
|
endif
|
||||||
#ifdef GST_DISABLE_GST_DEBUG
|
|
||||||
#error "debugging disabled, make compiler fail"
|
if gst_debug_disabled
|
||||||
#endif''' , dependencies: gst_dep)
|
|
||||||
message('GStreamer debug system is disabled')
|
message('GStreamer debug system is disabled')
|
||||||
add_project_arguments('-Wno-unused', language: 'c')
|
if cc.get_argument_syntax() == 'msvc'
|
||||||
else
|
msvc_args = cc.get_supported_arguments([
|
||||||
message('GStreamer debug system is enabled')
|
'/wd4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/wd4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
|
elif cc.has_argument('-Wno-unused')
|
||||||
|
add_project_arguments(['-Wno-unused'], language: 'c')
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/we4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
|
endif
|
||||||
|
message('GStreamer debug system is enabled')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
warning_flags = [
|
warning_flags = [
|
||||||
|
|
|
@ -83,8 +83,6 @@ if cc.get_id() == 'msvc'
|
||||||
'/we4053', # one void operand for '?:'
|
'/we4053', # one void operand for '?:'
|
||||||
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
||||||
'/we4098', # 'function' : void function returning a value
|
'/we4098', # 'function' : void function returning a value
|
||||||
'/we4101', # 'identifier' : unreferenced local variable
|
|
||||||
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
|
||||||
])
|
])
|
||||||
endif
|
endif
|
||||||
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
||||||
|
@ -489,13 +487,28 @@ endif
|
||||||
|
|
||||||
if gst_debug_disabled
|
if gst_debug_disabled
|
||||||
message('GStreamer debug system is disabled')
|
message('GStreamer debug system is disabled')
|
||||||
|
if cc.get_argument_syntax() == 'msvc'
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/wd4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/wd4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
||||||
|
else
|
||||||
if cc.has_argument('-Wno-unused')
|
if cc.has_argument('-Wno-unused')
|
||||||
add_project_arguments('-Wno-unused', language: 'c')
|
add_project_arguments('-Wno-unused', language: 'c')
|
||||||
endif
|
endif
|
||||||
if cxx.has_argument ('-Wno-unused')
|
if cxx.has_argument ('-Wno-unused')
|
||||||
add_project_arguments('-Wno-unused', language: 'cpp')
|
add_project_arguments('-Wno-unused', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
|
if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/we4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
||||||
|
endif
|
||||||
message('GStreamer debug system is enabled')
|
message('GStreamer debug system is enabled')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,6 @@ if cc.get_id() == 'msvc'
|
||||||
'/we4053', # one void operand for '?:'
|
'/we4053', # one void operand for '?:'
|
||||||
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
||||||
'/we4098', # 'function' : void function returning a value
|
'/we4098', # 'function' : void function returning a value
|
||||||
'/we4101', # 'identifier' : unreferenced local variable
|
|
||||||
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
|
||||||
])
|
])
|
||||||
endif
|
endif
|
||||||
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
||||||
|
@ -410,28 +408,36 @@ int32x4_t testfunc(int16_t *a, int16_t *b) {
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Disable compiler warnings for unused variables and args if gst debug system is disabled
|
||||||
if gst_dep.type_name() == 'internal'
|
if gst_dep.type_name() == 'internal'
|
||||||
gst_proj = subproject('gstreamer')
|
gst_proj = subproject('gstreamer')
|
||||||
|
gst_debug_disabled = not gst_proj.get_variable('gst_debug')
|
||||||
if not gst_proj.get_variable('gst_debug')
|
|
||||||
message('GStreamer debug system is disabled')
|
|
||||||
add_project_arguments('-Wno-unused', language: 'c')
|
|
||||||
else
|
|
||||||
message('GStreamer debug system is enabled')
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
# We can't check that in the case of subprojects as we won't
|
# We can't check that in the case of subprojects as we won't
|
||||||
# be able to build against an internal dependency (which is not built yet)
|
# be able to build against an internal dependency (which is not built yet)
|
||||||
if not cc.compiles('''
|
gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
|
||||||
#include <gst/gstconfig.h>
|
endif
|
||||||
#ifdef GST_DISABLE_GST_DEBUG
|
|
||||||
#error "debugging disabled, make compiler fail"
|
if gst_debug_disabled
|
||||||
#endif''' , dependencies: gst_dep)
|
|
||||||
message('GStreamer debug system is disabled')
|
message('GStreamer debug system is disabled')
|
||||||
add_project_arguments('-Wno-unused', language: 'c')
|
if cc.get_argument_syntax() == 'msvc'
|
||||||
else
|
msvc_args = cc.get_supported_arguments([
|
||||||
message('GStreamer debug system is enabled')
|
'/wd4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/wd4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
|
elif cc.has_argument('-Wno-unused')
|
||||||
|
add_project_arguments(['-Wno-unused'], language: 'c')
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/we4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
|
endif
|
||||||
|
message('GStreamer debug system is enabled')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cc.has_member('struct tcp_info', '__tcpi_reordering', prefix: '#include <netinet/tcp.h>')
|
if cc.has_member('struct tcp_info', '__tcpi_reordering', prefix: '#include <netinet/tcp.h>')
|
||||||
|
|
|
@ -68,8 +68,6 @@ if cc.get_id() == 'msvc'
|
||||||
'/we4053', # one void operand for '?:'
|
'/we4053', # one void operand for '?:'
|
||||||
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
||||||
'/we4098', # 'function' : void function returning a value
|
'/we4098', # 'function' : void function returning a value
|
||||||
'/we4101', # 'identifier' : unreferenced local variable
|
|
||||||
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
|
||||||
])
|
])
|
||||||
endif
|
endif
|
||||||
if have_cxx
|
if have_cxx
|
||||||
|
@ -457,13 +455,28 @@ endif
|
||||||
|
|
||||||
if gst_debug_disabled
|
if gst_debug_disabled
|
||||||
message('GStreamer debug system is disabled')
|
message('GStreamer debug system is disabled')
|
||||||
|
if cc.get_argument_syntax() == 'msvc'
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/wd4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/wd4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
||||||
|
else
|
||||||
if cc.has_argument('-Wno-unused')
|
if cc.has_argument('-Wno-unused')
|
||||||
add_project_arguments('-Wno-unused', language: 'c')
|
add_project_arguments('-Wno-unused', language: 'c')
|
||||||
endif
|
endif
|
||||||
if have_cxx and cxx.has_argument ('-Wno-unused')
|
if have_cxx and cxx.has_argument ('-Wno-unused')
|
||||||
add_project_arguments('-Wno-unused', language: 'cpp')
|
add_project_arguments('-Wno-unused', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
|
if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/we4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
||||||
|
endif
|
||||||
message('GStreamer debug system is enabled')
|
message('GStreamer debug system is enabled')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,6 @@ if cc.get_id() == 'msvc'
|
||||||
'/we4053', # one void operand for '?:'
|
'/we4053', # one void operand for '?:'
|
||||||
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
||||||
'/we4098', # 'function' : void function returning a value
|
'/we4098', # 'function' : void function returning a value
|
||||||
'/we4101', # 'identifier' : unreferenced local variable
|
|
||||||
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
|
||||||
])
|
])
|
||||||
endif
|
endif
|
||||||
if have_cxx
|
if have_cxx
|
||||||
|
@ -220,13 +218,28 @@ endif
|
||||||
|
|
||||||
if gst_debug_disabled
|
if gst_debug_disabled
|
||||||
message('GStreamer debug system is disabled')
|
message('GStreamer debug system is disabled')
|
||||||
|
if cc.get_argument_syntax() == 'msvc'
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/wd4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/wd4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
||||||
|
else
|
||||||
if cc.has_argument('-Wno-unused')
|
if cc.has_argument('-Wno-unused')
|
||||||
add_project_arguments('-Wno-unused', language: 'c')
|
add_project_arguments('-Wno-unused', language: 'c')
|
||||||
endif
|
endif
|
||||||
if have_cxx and cxx.has_argument ('-Wno-unused')
|
if have_cxx and cxx.has_argument ('-Wno-unused')
|
||||||
add_project_arguments('-Wno-unused', language: 'cpp')
|
add_project_arguments('-Wno-unused', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
|
if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/we4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: ['c', 'cpp'])
|
||||||
|
endif
|
||||||
message('GStreamer debug system is enabled')
|
message('GStreamer debug system is enabled')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,6 @@ if cc.get_id() == 'msvc'
|
||||||
'/we4053', # one void operand for '?:'
|
'/we4053', # one void operand for '?:'
|
||||||
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
'/we4062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
|
||||||
'/we4098', # 'function' : void function returning a value
|
'/we4098', # 'function' : void function returning a value
|
||||||
'/we4101', # 'identifier' : unreferenced local variable
|
|
||||||
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
|
||||||
])
|
])
|
||||||
endif
|
endif
|
||||||
add_project_arguments(msvc_args, language: 'c')
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
|
@ -488,7 +486,23 @@ endif
|
||||||
|
|
||||||
gst_debug = get_option('gst_debug')
|
gst_debug = get_option('gst_debug')
|
||||||
if not gst_debug
|
if not gst_debug
|
||||||
|
if cc.get_argument_syntax() == 'msvc'
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/wd4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/wd4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
|
elif cc.has_argument('-Wno-unused')
|
||||||
add_project_arguments(['-Wno-unused'], language: 'c')
|
add_project_arguments(['-Wno-unused'], language: 'c')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if cc.get_argument_syntax() == 'msvc' and gst_version_is_dev
|
||||||
|
msvc_args = cc.get_supported_arguments([
|
||||||
|
'/we4101', # 'identifier' : unreferenced local variable
|
||||||
|
'/we4189', # 'identifier' : local variable is initialized but not referenced
|
||||||
|
])
|
||||||
|
add_project_arguments(msvc_args, language: 'c')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
warning_flags = [
|
warning_flags = [
|
||||||
|
|
Loading…
Reference in a new issue