@@ -19,7 +19,7 @@ if get_option('default_library') == 'static'
1919 static_subproject = meson .is_subproject()
2020endif
2121
22- if get_option (' enable_opt' ) == false
22+ if not get_option (' enable_opt' )
2323 add_project_arguments (' -DSPNG_DISABLE_OPT' , language : ' c' )
2424endif
2525
@@ -30,64 +30,67 @@ if cc.compiles(files('tests/target_clones.c'), args : '-Werror', name : 'have ta
3030 add_project_arguments (' -DSPNG_ENABLE_TARGET_CLONES' , language : ' c' )
3131endif
3232
33- if get_option (' use_miniz' ) == true
33+ spng_deps = [ cc.find_library (' m' , required : false ) ]
34+
35+ if get_option (' use_miniz' )
3436 add_project_arguments (' -DSPNG_USE_MINIZ' , language : ' c' )
35- zlib_dep = dependency (' miniz' , fallback : [ ' miniz' , ' miniz_dep' ])
37+ spng_deps += dependency (' miniz' ,
38+ default_options : [ ' default_library=static' ],
39+ fallback : [ ' miniz' , ' miniz_dep' ],
40+ )
3641else
3742 zlib_dep = dependency (' zlib' ,
43+ default_options : [ ' default_library=static' ],
44+ fallback : [ ' zlib' , ' zlib_dep' ],
3845 required : false ,
39- fallback : [' zlib' , ' zlib_dep' ],
40- static : get_option (' static_zlib' ))
41-
42- if not zlib_dep.found()
43- zlib_dep = cc.find_library (' z' )
44- endif
46+ static : get_option (' static_zlib' ),
47+ )
48+ spng_deps += zlib_dep.found() ? zlib_dep : cc.find_library (' z' )
4549endif
4650
47- m_dep = cc.find_library (' m' , required : false )
48-
49- spng_deps = [ zlib_dep, m_dep ]
50-
5151spng_inc = include_directories (' spng' )
5252
5353spng_src = files (' spng/spng.c' )
5454
55- spng_lib = library (' spng' ,
56- spng_src,
55+ spng_lib = library (' spng' , spng_src,
5756 c_args : spng_args,
5857 dependencies : spng_deps,
5958 install : not static_subproject,
6059 version : meson .project_version()
6160)
6261
6362spng_dep = declare_dependency (
64- link_with : spng_lib,
6563 compile_args : spng_args,
6664 include_directories : spng_inc,
67- version : meson .project_version()
65+ link_with : spng_lib,
6866)
6967
7068if meson .version().version_compare(' >= 0.54.0' )
7169 meson .override_dependency(' spng' , spng_dep)
7270endif
7371
72+ if meson .is_subproject()
73+ subdir_done ()
74+ endif
75+
76+ install_headers (' spng/spng.h' )
77+
7478subdir (' examples' )
75- subdir (' tests' )
7679
77- if get_option (' benchmarks' ) == true
80+ if get_option (' dev_build' )
81+ subdir (' tests' )
82+ endif
83+
84+ if get_option (' benchmarks' )
7885 subproject (' spngt' )
7986endif
8087
8188if static_subproject
8289 subdir_done ()
8390endif
8491
85- install_headers (' spng/spng.h' )
86-
87- pkg = import (' pkgconfig' )
88-
89- pkg.generate(spng_lib,
92+ pc= import (' pkgconfig' )
93+ pc.generate(spng_lib,
94+ description : ' PNG decoding and encoding library' ,
9095 extra_cflags : spng_args,
91- libraries_private : [ ' -lm' , ' -lz' ],
92- description : ' PNG decoding and encoding library'
9396)
0 commit comments