1+ project (' wapcaplet' , ' c' ,
2+ version : ' 0.4.3' ,
3+ default_options : [' c_std=c99' , ' warning_level=2' ])
4+
5+ cc = meson .get_compiler(' c' )
6+
7+ # Compiler flags
8+ cflags = [' -D_BSD_SOURCE' , ' -D_DEFAULT_SOURCE' , ' -DSTMTEXPR' ]
9+ if cc.get_id() != ' gcc' or cc.version().split(' .' )[0 ].to_int() >= 3
10+ cflags += [' -Wstrict-prototypes' , ' -Wmissing-prototypes' , ' -Wmissing-declarations' , ' -Wnested-externs' ]
11+ endif
12+ if host_machine .system() != ' haiku'
13+ cflags += [' -Werror' ]
14+ endif
15+
16+ # Source files
17+ wapcaplet_sources = files (
18+ ' src/libwapcaplet.c'
19+ )
20+
21+ # Include directories
22+ inc = include_directories (' include' )
23+
24+ # Build the static library
25+ wapcaplet_lib = static_library (' wapcaplet' ,
26+ sources : wapcaplet_sources,
27+ include_directories : inc,
28+ c_args : cflags,
29+ install : true
30+ )
31+
32+ # Install headers
33+ install_headers (' include/libwapcaplet/libwapcaplet.h' ,
34+ subdir : ' libwapcaplet'
35+ )
36+
37+ # Pkg-config file
38+ pkg = import (' pkgconfig' )
39+ pkg.generate(wapcaplet_lib,
40+ name : ' libwapcaplet' ,
41+ description : ' A string internment library' ,
42+ version : ' 0.4.3' ,
43+ subdirs : '' # Set to empty to use ${includedir} instead of ${includedir}/libwapcaplet
44+ )
45+
46+ # Tests
47+ if get_option (' tests' )
48+ check_dep = dependency (' check' , required : false )
49+ if check_dep.found()
50+ test_exe = executable (' wapcaplet_test' ,
51+ sources : [' test/testmain.c' , ' test/basictests.c' ],
52+ include_directories : inc,
53+ link_with : wapcaplet_lib,
54+ c_args : cflags,
55+ dependencies : check_dep
56+ )
57+ test (' wapcaplet_tests' , test_exe)
58+ endif
59+ endif
0 commit comments