aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build45
1 files changed, 38 insertions, 7 deletions
diff --git a/meson.build b/meson.build
index 0f1a77f..8a6587b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,10 @@
-project('libfuse3', ['cpp', 'c'], version: '3.8.0',
+project('libfuse3', ['c'], version: '3.10.5',
meson_version: '>= 0.42',
- default_options: [ 'buildtype=debugoptimized' ])
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'cpp_std=c++11',
+ 'warning_level=2',
+ ])
platform = host_machine.system()
@@ -63,13 +67,12 @@ configure_file(output: 'config.h',
#
# Compiler configuration
#
-add_project_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H', '-Wall', '-Wextra', '-Wno-sign-compare',
+add_project_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H', '-Wno-sign-compare',
'-Wstrict-prototypes', '-Wmissing-declarations', '-Wwrite-strings',
'-fno-strict-aliasing', language: 'c')
add_project_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H', '-D_GNU_SOURCE',
- '-Wall', '-Wextra', '-Wno-sign-compare', '-std=c++11',
- '-Wmissing-declarations', '-Wwrite-strings',
- '-fno-strict-aliasing', language: 'cpp')
+ '-Wno-sign-compare', '-Wmissing-declarations',
+ '-Wwrite-strings', '-fno-strict-aliasing', language: 'cpp')
# Some (stupid) GCC versions warn about unused return values even when they are
# casted to void. This makes -Wunused-result pretty useless, since there is no
@@ -87,6 +90,30 @@ if not cc.compiles(code, args: [ '-O0', '-Werror=unused-result' ])
add_project_arguments('-Wno-unused-result', language: 'c')
endif
+# gcc-10 and newer support the symver attribute which we need to use if we
+# want to support LTO
+# recent clang and gcc both support __has_attribute (and if they are too old
+# to have __has_attribute, then they are too old to support symver)
+# other compilers might not have __has_attribute, but in those cases
+# it is safe for this check to fail and for us to fallback to the old _asm_
+# method for symver. Anyway the attributes not supported by __has_attribute()
+# unfortunately return true giving a false positive. So let's try to build
+# using __attribute__ ((symver )) and see the result.
+code = '''
+__attribute__ ((symver ("test@TEST")))
+void foo(void) {
+}
+
+int main(void) {
+ return 0;
+}'''
+if cc.compiles(code, args: [ '-O0', '-c', '-Werror'])
+ message('Compiler supports symver attribute')
+ add_project_arguments('-DHAVE_SYMVER_ATTRIBUTE', language: 'c')
+else
+ message('Compiler does not support symver attribute')
+endif
+
# '.' will refer to current build directory, which contains config.h
include_dirs = include_directories('include', 'lib', '.')
@@ -96,7 +123,7 @@ thread_dep = dependency('threads')
#
# Read build files from sub-directories
#
-subdirs = [ 'lib', 'include', 'test' ]
+subdirs = [ 'lib', 'include']
if get_option('utils') and not platform.endswith('bsd') and platform != 'dragonfly'
subdirs += [ 'util', 'doc' ]
endif
@@ -105,6 +132,10 @@ if get_option('examples')
subdirs += 'example'
endif
+if get_option('tests')
+ subdirs += 'test'
+endif
+
foreach n : subdirs
subdir(n)
endforeach