From 1a19f05a0e3a7cb7af66257c119ff956c15dc569 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 30 Apr 2019 16:07:39 +0800 Subject: [PATCH] build: Force-include msvc_recommended_pragmas.h on Visual Studio By doing so, we essentially cover the various compiler flags that we want to use for non-Visual Studio builds to check for warnings that might cause real concern. This also skips the checks for the various GCC-isque CFlag checks that are scattered in the various build files on Visual Studio builds, since they are essentially meaningless on Visual Studio builds. --- cmph/meson.build | 38 +++++++++++++++++++++++--------------- meson.build | 43 +++++++++++++++++++++++++++---------------- 2 files changed, 50 insertions(+), 31 deletions(-) diff --git a/cmph/meson.build b/cmph/meson.build index d7b1e4230..5bc41a33f 100644 --- a/cmph/meson.build +++ b/cmph/meson.build @@ -29,17 +29,22 @@ cmph_deps = [ cc.find_library('m', required: false), ] -custom_c_args = cc.get_supported_arguments([ - '-Wno-implicit-fallthrough', - '-Wno-old-style-definition', - '-Wno-suggest-attribute=noreturn', - '-Wno-type-limits', - '-Wno-undef', - '-Wno-unused-parameter', - '-Wno-cast-align', - '-Wno-unused-function', - '-Wno-return-type', -]) +custom_c_args = [] + +if cc.get_id() != 'msvc' + custom_c_args = cc.get_supported_arguments([ + '-Wno-implicit-fallthrough', + '-Wno-old-style-definition', + '-Wno-suggest-attribute=noreturn', + '-Wno-type-limits', + '-Wno-undef', + '-Wno-unused-parameter', + '-Wno-cast-align', + '-Wno-unused-function', + '-Wno-return-type', + ]) +endif + cmph = static_library('cmph', sources: cmph_sources, c_args: gi_hidden_visibility_cflags + custom_c_args, @@ -51,10 +56,13 @@ cmph_dep = declare_dependency( include_directories: include_directories('.'), ) -custom_c_args = cc.get_supported_arguments([ - '-Wno-old-style-definition', - '-Wno-type-limits', -]) +if cc.get_id() != 'msvc' + custom_c_args = cc.get_supported_arguments([ + '-Wno-old-style-definition', + '-Wno-type-limits', + ]) +endif + cmph_test = executable('cmph-bdz-test', '../cmph-bdz-test.c', dependencies: [ cmph_dep, diff --git a/meson.build b/meson.build index 0261e1a55..1d7aed6b8 100644 --- a/meson.build +++ b/meson.build @@ -1,9 +1,14 @@ subdir('cmph') -custom_c_args = cc.get_supported_arguments([ - '-Wno-old-style-definition', - '-Wno-cast-align', -]) +custom_c_args = [] + +if cc.get_id() != 'msvc' + custom_c_args = cc.get_supported_arguments([ + '-Wno-old-style-definition', + '-Wno-cast-align', + ]) +endif + girepo_gthash_lib = static_library('girepository-gthash', sources: 'gthash.c', include_directories : configinc, @@ -21,11 +26,14 @@ girepo_gthash_dep = declare_dependency( include_directories: include_directories('.'), ) -custom_c_args = cc.get_supported_arguments([ - '-Wno-unused-parameter', - '-Wno-duplicated-branches', - '-Wno-cast-align', -]) +if cc.get_id() != 'msvc' + custom_c_args = cc.get_supported_arguments([ + '-Wno-unused-parameter', + '-Wno-duplicated-branches', + '-Wno-cast-align', + ]) +endif + girepo_internals_lib = static_library('girepository-internals', sources: [ 'girmodule.c', @@ -145,13 +153,16 @@ girepo_gir_sources = files( install_headers(girepo_headers, subdir: 'gobject-introspection-1.0') -custom_c_args = cc.get_supported_arguments([ - '-Wno-unused-parameter', - '-Wno-duplicated-branches', - '-Wno-type-limits', - '-Wno-cast-align', - '-Wno-missing-field-initializers', -]) +if cc.get_id() != 'msvc' + custom_c_args = cc.get_supported_arguments([ + '-Wno-unused-parameter', + '-Wno-duplicated-branches', + '-Wno-type-limits', + '-Wno-cast-align', + '-Wno-missing-field-initializers', + ]) +endif + girepo_lib = shared_library('girepository-1.0', sources: girepo_sources, include_directories : configinc,