Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
nirbheek authored and sarum9in committed May 29, 2018
1 parent 933a624 commit 0078d6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 14 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ project('zlib', 'c', version : '1.2.11', license : 'zlib')
cc = meson.get_compiler('c')

link_args = []
compile_args = []
if cc.get_id() == 'msvc'
add_project_arguments('-D_CRT_SECURE_NO_DEPRECATE',
'-D_CRT_NONSTDC_NO_DEPRECATE', language : 'c')
elif cc.get_id() == 'gcc' and host_machine.system() != 'windows'
vflag = '-Wl,--version-script,@0@/zlib.map'.format(meson.current_source_dir())
link_args += [vflag]
else
# Don't spam consumers of this wrap with these warnings
compile_args += cc.get_supported_arguments(['-Wno-implicit-fallthrough',
'-Wno-implicit-function-declaration'])
if cc.get_id() == 'gcc' and host_machine.system() != 'windows'
vflag = '-Wl,--version-script,@0@/zlib.map'.format(meson.current_source_dir())
link_args += [vflag]
endif
endif

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

if get_option('solo')
compile_args += ['-DZ_SOLO']
endif

zlib = library('z', src,
c_args : compile_args,
link_args : link_args,
vs_module_defs : 'win32/zlib.def',
install : true)
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('solo', type: 'boolean', value: false, description: 'Build a minimal zlib without file I/O API')

0 comments on commit 0078d6b

Please sign in to comment.