Skip to content

Commit

Permalink
add minimal meson build system for subprojects
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaricchi committed Jan 24, 2024
1 parent 51b7f2a commit 78502ea
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
project('zlib', 'c', version : '1.3.1', license : 'zlib')

# Based on https://github.com/mesonbuild/zlib/blob/1.2.11/meson.build

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')
else
# Don't spam consumers of this wrap with these warnings
compile_args += cc.get_supported_arguments(['-Wno-implicit-fallthrough',
'-Wno-implicit-function-declaration',
'-Wno-deprecated-non-prototype'])
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([
'adler32.c',
'crc32.c',
'deflate.c',
'infback.c',
'inffast.c',
'inflate.c',
'inftrees.c',
'trees.c',
'zutil.c',
'compress.c',
'uncompr.c',
'gzclose.c',
'gzlib.c',
'gzread.c',
'gzwrite.c'])

headers = files(['zconf.h', 'zlib.h'])

if host_machine.system() == 'windows'
win = import('windows')
win_args = []
if cc.get_id() != 'msvc'
win_args += '-DGCC_WINDRES'
endif
src += win.compile_resources('win32/zlib1.rc', args : win_args)
endif

zlib = library('z', src,
c_args : compile_args,
link_args : link_args,
vs_module_defs : 'win32/zlib.def',
install : false,
build_by_default : false)

incdir = include_directories('.')

zlib_dep = declare_dependency(
link_with : zlib,
include_directories : incdir)

meson.override_dependency('zlib', zlib_dep)

0 comments on commit 78502ea

Please sign in to comment.