Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

Commit 0078d6b

Browse files
nirbheeksarum9in
authored andcommitted
More fixes
* Suppress warnings with gcc and clang * Add a new option for a more minimal build * Disable warnings by adding them to the target c_args This way we can be sure that they won't crop up no matter how extra warning args are enabled by the user.
1 parent 933a624 commit 0078d6b

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

meson.build

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@ project('zlib', 'c', version : '1.2.11', license : 'zlib')
33
cc = meson.get_compiler('c')
44

55
link_args = []
6+
compile_args = []
67
if cc.get_id() == 'msvc'
78
add_project_arguments('-D_CRT_SECURE_NO_DEPRECATE',
89
'-D_CRT_NONSTDC_NO_DEPRECATE', language : 'c')
9-
elif cc.get_id() == 'gcc' and host_machine.system() != 'windows'
10-
vflag = '-Wl,--version-script,@0@/zlib.map'.format(meson.current_source_dir())
11-
link_args += [vflag]
10+
else
11+
# Don't spam consumers of this wrap with these warnings
12+
compile_args += cc.get_supported_arguments(['-Wno-implicit-fallthrough',
13+
'-Wno-implicit-function-declaration'])
14+
if cc.get_id() == 'gcc' and host_machine.system() != 'windows'
15+
vflag = '-Wl,--version-script,@0@/zlib.map'.format(meson.current_source_dir())
16+
link_args += [vflag]
17+
endif
1218
endif
1319

1420
src = files([
@@ -39,7 +45,12 @@ if host_machine.system() == 'windows'
3945
src += win.compile_resources('win32/zlib1.rc', args : win_args)
4046
endif
4147

48+
if get_option('solo')
49+
compile_args += ['-DZ_SOLO']
50+
endif
51+
4252
zlib = library('z', src,
53+
c_args : compile_args,
4354
link_args : link_args,
4455
vs_module_defs : 'win32/zlib.def',
4556
install : true)

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
option('solo', type: 'boolean', value: false, description: 'Build a minimal zlib without file I/O API')

0 commit comments

Comments
 (0)