aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meson.build12
-rw-r--r--meson/warnings/meson.build32
-rw-r--r--meson_options.txt4
3 files changed, 36 insertions, 12 deletions
diff --git a/meson.build b/meson.build
index 70c3dc8..ac2e6a6 100644
--- a/meson.build
+++ b/meson.build
@@ -26,7 +26,7 @@ pkg = import('pkgconfig')
cc = meson.get_compiler('c')
# Enable C++ support if we're building the examples
-if get_option('examples') or get_option('tests')
+if not get_option('examples').disabled() or not get_option('tests').disabled()
if add_languages(['cpp'], required: false)
cpp = meson.get_compiler('cpp')
endif
@@ -318,11 +318,11 @@ subdir('bindings/cpp')
# Tests and Examples #
######################
-if get_option('tests')
+if not get_option('tests').disabled()
subdir('test')
endif
-if get_option('examples')
+if not get_option('examples').disabled()
subdir('examples')
endif
@@ -344,15 +344,15 @@ if meson.version().version_compare('>=0.53.0')
summary('Stub', get_option('stub'), section: 'Backends', bool_yn: true)
summary('Vulkan', vulkan_dep.found(), section: 'Backends', bool_yn: true)
- summary('Tests', get_option('tests'), bool_yn: true)
- summary('Examples', get_option('examples'), bool_yn: true)
+ summary('Tests', not get_option('tests').disabled(), bool_yn: true)
+ summary('Examples', not get_option('examples').disabled(), bool_yn: true)
summary('Documentation', build_docs, bool_yn: true)
summary('Prefix', get_option('prefix'), section: 'Paths')
summary('Headers', get_option('prefix') / get_option('includedir'), section: 'Paths')
summary('Libraries', get_option('prefix') / get_option('libdir'), section: 'Paths')
- if get_option('examples')
+ if not get_option('examples').disabled()
summary('Executables', get_option('prefix') / get_option('bindir'), section: 'Paths')
endif
endif
diff --git a/meson/warnings/meson.build b/meson/warnings/meson.build
index 8973b7a..ffb5907 100644
--- a/meson/warnings/meson.build
+++ b/meson/warnings/meson.build
@@ -29,6 +29,10 @@
# Wtrampolines
# Wvla-larger-than=BYTES
#
+# Build specific:
+#
+# Wpoison-system-directories
+#
# C Specific:
#
# Wc11-c2x-compat
@@ -121,11 +125,16 @@ gcc_common_warnings = [
'-Wwrite-strings',
]
-# Set all_c_warnings for the current C compiler
+#####
+# C #
+#####
+
if is_variable('cc') and not is_variable('all_c_warnings')
all_c_warnings = []
+
if cc.get_id() == 'clang'
all_c_warnings += ['-Weverything']
+
elif cc.get_id() == 'gcc'
all_c_warnings += gcc_common_warnings + [
'-Wabsolute-value',
@@ -143,20 +152,28 @@ if is_variable('cc') and not is_variable('all_c_warnings')
'-Wstrict-prototypes',
'-Wunsuffixed-float-constants',
]
+
elif cc.get_id() == 'msvc'
all_c_warnings += ['/Wall']
endif
+
+ all_c_warnings = cc.get_supported_arguments(all_c_warnings)
endif
-# Set all_cpp_warnings for the current C++ compiler
-if is_variable('cpp') and not is_variable('all_cpp_warnings')
+#######
+# C++ #
+#######
+
+if is_variable('cpp')
all_cpp_warnings = []
+
if cpp.get_id() == 'clang'
all_cpp_warnings += [
'-Weverything',
'-Wno-c++98-compat',
'-Wno-c++98-compat-pedantic'
]
+
elif cpp.get_id() == 'gcc'
all_cpp_warnings += gcc_common_warnings + [
'-Wabi-tag',
@@ -199,19 +216,26 @@ if is_variable('cpp') and not is_variable('all_cpp_warnings')
'-Wvolatile',
'-Wzero-as-null-pointer-constant',
]
+
elif cpp.get_id() == 'msvc'
all_cpp_warnings += ['/Wall']
endif
+
+ all_cpp_warnings = cpp.get_supported_arguments(all_cpp_warnings)
endif
# Set all_objc_warnings for the current Objective C compiler
-if is_variable('objcc') and not is_variable('all_objc_warnings')
+if is_variable('objcc')
all_objc_warnings = []
+
if objcc.get_id() == 'clang'
all_objc_warnings += ['-Weverything']
+
elif objc.get_id() == 'gcc'
all_objc_warnings += gcc_common_warnings + [
'-Wno-direct-ivar-access',
]
endif
+
+ all_objc_warnings = objcc.get_supported_arguments(all_objc_warnings)
endif
diff --git a/meson_options.txt b/meson_options.txt
index 40dfa3a..78856a7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,7 +1,7 @@
option('cairo', type: 'feature', value: 'auto',
description : 'Enable support for the Cairo graphics API')
-option('examples', type: 'boolean', value: true,
+option('examples', type: 'feature', value: 'auto', yield: true,
description: 'Build example programs')
option('docs', type: 'feature', value: 'auto',
@@ -16,7 +16,7 @@ option('strict', type: 'boolean', value: false,
option('stub', type: 'boolean', value: true,
description: 'Build stub backend')
-option('tests', type: 'boolean', value: true,
+option('tests', type: 'feature', value: 'auto', yield: true,
description: 'Build tests')
option('vulkan', type: 'feature', value: 'auto',