Debian Codegraph @

src/meson.build

raw
1 libev = dependency('libev', required: false)
2 if not libev.found()
3 libev = cc.find_library('ev')
4 endif
5 base_deps = [cc.find_library('m'), libev]
6
7 srcs = [
8 files(
9 'api.c',
10 'atom.c',
11 'c2.c',
12 'config.c',
13 'config_libconfig.c',
14 'diagnostic.c',
15 'event.c',
16 'inspect.c',
17 'log.c',
18 'options.c',
19 'picom.c',
20 'vblank.c',
21 'x.c',
22 ),
23 ]
24 picom_inc = include_directories(['.', '../include'])
25
26 cflags = []
27
28 required_xcb_packages = [
29 'xcb',
30 'xcb-composite',
31 'xcb-damage',
32 'xcb-glx',
33 'xcb-present',
34 'xcb-randr',
35 'xcb-render',
36 'xcb-shape',
37 'xcb-sync',
38 'xcb-xfixes',
39 ]
40
41 # Some XCB packages are here because their versioning differs (see check below).
42 required_packages = [
43 'pixman-1',
44 'x11',
45 'x11-xcb',
46 'xcb-image',
47 'xcb-renderutil',
48 'xcb-util',
49 'threads',
50 ]
51
52 foreach i : required_packages
53 base_deps += [dependency(i, required: true)]
54 endforeach
55
56 foreach i : required_xcb_packages
57 base_deps += [dependency(i, version: '>=1.12.0', required: true)]
58 endforeach
59
60 libconfig_dep = dependency('libconfig', version: '>=1.7', required: false)
61
62 if not libconfig_dep.found()
63 warning('Trying to clone and build libconfig as a subproject.')
64
65 cmake = import('cmake')
66 sub_libconfig_opts = cmake.subproject_options()
67 sub_libconfig_opts.add_cmake_defines(
68 {
69 'BUILD_SHARED_LIBS': false,
70 },
71 )
72 sub_libconfig_opts.set_install(false)
73 sub_libconfig = cmake.subproject('libconfig', options: sub_libconfig_opts)
74 base_deps += [sub_libconfig.dependency('config')]
75 else
76 base_deps += [libconfig_dep]
77 endif
78
79 if not cc.has_header('uthash.h')
80 error('Dependency uthash not found')
81 endif
82
83 deps = []
84
85 if get_option('regex')
86 pcre = dependency('libpcre2-8', required: true)
87 cflags += ['-DCONFIG_REGEX_PCRE']
88 deps += [pcre]
89 endif
90
91 if get_option('opengl')
92 cflags += ['-DCONFIG_OPENGL']
93 deps += [dependency('epoxy', required: true)]
94 endif
95
96 if get_option('dbus')
97 cflags += ['-DCONFIG_DBUS']
98 deps += [dependency('dbus-1', required: true)]
99 srcs += ['dbus.c', 'rtkit.c']
100 endif
101
102 if get_option('unittest')
103 cflags += ['-DUNIT_TEST']
104 endif
105
106 host_system = host_machine.system()
107 if host_system == 'linux'
108 cflags += ['-DHAS_INOTIFY']
109 elif (
110 host_system == 'freebsd'
111 or host_system == 'netbsd'
112 or host_system == 'dragonfly'
113 or host_system == 'openbsd'
114 )
115 cflags += ['-DHAS_KQUEUE']
116 endif
117
118 subdir('backend')
119 subdir('wm')
120 subdir('renderer')
121 subdir('transition')
122 subdir('utils')
123
124 dl_dep = []
125 if not cc.has_function('dlopen')
126 dl_dep = [cc.find_library('dl', required: true)]
127 endif
128
129 libtools = static_library(
130 'libtools',
131 [
132 'log.c',
133 'utils/dynarr.c',
134 'utils/misc.c',
135 'utils/str.c',
136 'transition/curve.c',
137 'transition/script.c',
138 ],
139 include_directories: picom_inc,
140 dependencies: [test_h_dep],
141 install: false,
142 build_by_default: false,
143 )
144
145 picom = executable(
146 'picom',
147 srcs,
148 c_args: cflags,
149 dependencies: [base_deps, deps, test_h_dep] + dl_dep,
150 install: true,
151 include_directories: picom_inc,
152 export_dynamic: true,
153 gnu_symbol_visibility: 'hidden',
154 )
155
156 if get_option('unittest')
157 test('picom unittest', picom, args: ['--unittest'])
158 endif
159
160 install_symlink('picom-inspect', install_dir: 'bin', pointing_to: 'picom')
161
162 if cc.has_argument('-fsanitize=fuzzer')
163 c2_fuzz = executable(
164 'c2_fuzz',
165 srcs + ['fuzzer/c2.c'],
166 c_args: cflags + ['-fsanitize=fuzzer', '-DCONFIG_FUZZER'],
167 link_args: ['-fsanitize=fuzzer'],
168 dependencies: [base_deps, deps, test_h_dep],
169 build_by_default: false,
170 install: false,
171 include_directories: picom_inc,
172 )
173 endif