1 project('ncmpc', 'cpp',
9 cc = meson.get_compiler('cpp')
11 conf = configuration_data()
12 conf.set_quoted('PACKAGE', meson.project_name())
13 conf.set_quoted('VERSION', meson.project_version())
14 conf.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
15 conf.set_quoted('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir')))
17 mini = get_option('mini')
18 conf.set('NCMPC_MINI', mini)
20 enable_locale = get_option('locale')
21 if enable_locale == 'false' or mini
23 elif cc.has_header('locale.h')
25 elif enable_locale == 'auto'
28 error('locale.h not found')
30 conf.set('ENABLE_LOCALE', enable_locale)
32 enable_nls = get_option('nls')
33 if enable_nls == 'false' or mini
35 elif cc.has_header('libintl.h')
37 elif enable_nls == 'auto'
40 error('libintl.h not found')
42 conf.set('ENABLE_NLS', enable_nls)
44 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
49 conf.set('ENABLE_TCP', true)
50 conf.set('HAVE_GETADDRINFO', cc.has_function('getaddrinfo'))
53 async_connect = get_option('async_connect')
54 conf.set('ENABLE_ASYNC_CONNECT', async_connect)
56 conf.set('ENABLE_MULTIBYTE', get_option('multibyte'))
58 curses = get_option('curses')
59 if curses == 'ncursesw'
60 curses_dep = dependency('ncursesw')
61 elif curses == 'ncurses'
62 curses_dep = dependency('ncurses')
64 curses_dep = dependency('ncursesw', required: false)
68 curses_dep = dependency('ncurses', required: false)
73 curses_dep = cc.find_library('ncursesw', required: false)
74 if not curses_dep.found()
75 curses_dep = cc.find_library('ncurses')
78 # TODO: find other curses implementation (pdcurses?)
83 if curses == 'ncursesw'
84 conf.set('HAVE_NCURSESW', true)
85 curses_enhanced = true
87 if cc.has_header('ncursesw/curses.h', dependencies: curses_dep)
88 conf.set('HAVE_NCURSESW_CURSES_H', true)
89 elif cc.has_header('ncursesw.h', dependencies: curses_dep)
90 conf.set('HAVE_NCURSESW_H', true)
92 error('No ncursesw header found')
94 elif curses == 'ncurses'
95 conf.set('HAVE_NCURSES', true)
96 curses_enhanced = true
98 if cc.has_header('ncurses/curses.h', dependencies: curses_dep)
99 conf.set('HAVE_NCURSES_CURSES_H', true)
100 elif cc.has_header('ncurses.h', dependencies: curses_dep)
101 conf.set('HAVE_NCURSES_H', true)
103 error('No ncurses header found')
106 if cc.has_header('curses.h', dependencies: curses_dep)
107 conf.set('HAVE_CURSES_H', true)
109 # TODO: test this with pdcurses
110 curses_enhanced = cc.has_header_symbol('curses.h', '_XOPEN_CURSES', dependencies: curses_dep)
111 curses_color = curses_enhanced or cc.has_header_symbol('curses.h', 'COLOR_PAIR', dependencies: curses_dep)
113 error('No curses header found')
116 conf.set('HAVE_CURSES_ENHANCED', curses_enhanced)
118 enable_mouse = get_option('mouse')
119 if enable_mouse == 'false'
121 elif cc.has_function('getmouse', dependencies: curses_dep)
123 elif enable_mouse == 'auto'
126 error('getmouse() not available')
128 conf.set('HAVE_GETMOUSE', enable_mouse)
130 enable_lirc = get_option('lirc')
131 if enable_lirc == 'false'
135 lirc_dep = dependency('lirc', required: false)
136 if not lirc_dep.found()
137 lirc_dep = dependency('liblircclient0', required: false)
142 elif enable_lirc == 'auto'
145 error('liblirc not found')
148 conf.set('ENABLE_LIRC', enable_lirc)
150 conf.set('ENABLE_COLORS', curses_color)
153 # for getaddrinfo() and sigaction() with glibc
160 '-Wno-deprecated-declarations',
166 '-Wmissing-declarations', '-Wmissing-noreturn', '-Wmissing-format-attribute',
167 '-Wredundant-decls', '-Wundef',
168 '-fvisibility=hidden',
176 if get_option('buildtype') != 'debug'
178 '-ffunction-sections',
186 foreach f: test_cflags
187 if cc.has_argument(f)
188 common_cflags += [ f ]
192 add_global_arguments(common_cflags, language: 'cpp')
194 foreach f: test_ldflags
195 if cc.has_argument(f)
196 add_global_link_arguments(f, language: 'cpp')
200 glib_dep = dependency('glib-2.0', version: '>= 2.30')
201 libmpdclient_dep = dependency('libmpdclient', version: '>= 2.9')
203 inc = include_directories(
206 # for the generated config.h
212 need_screen_text = false
213 need_plugin_library = false
215 if host_machine.system() != 'windows'
223 'src/db_completion.cxx',
224 'src/xterm_title.cxx',
225 'src/BasicMarquee.cxx',
234 'src/net/socket.cxx',
235 'src/net/resolver.cxx',
236 'src/net/async_connect.cxx',
237 'src/net/async_rconnect.cxx',
248 enable_help_screen = get_option('help_screen') and not mini
249 conf.set('ENABLE_HELP_SCREEN', enable_help_screen)
250 if enable_help_screen
251 sources += ['src/screen_help.cxx']
254 enable_artist_screen = get_option('artist_screen') and not mini
255 conf.set('ENABLE_ARTIST_SCREEN', enable_artist_screen)
256 if enable_artist_screen
257 sources += ['src/screen_artist.cxx']
260 enable_search_screen = get_option('search_screen') and not mini
261 conf.set('ENABLE_SEARCH_SCREEN', enable_search_screen)
262 if enable_search_screen
263 sources += ['src/screen_search.cxx']
266 enable_song_screen = get_option('song_screen') and not mini
267 conf.set('ENABLE_SONG_SCREEN', enable_song_screen)
268 if enable_song_screen
269 sources += ['src/screen_song.cxx']
272 enable_keydef_screen = get_option('key_screen') and not mini
273 conf.set('ENABLE_KEYDEF_SCREEN', enable_keydef_screen)
274 if enable_keydef_screen
275 sources += ['src/screen_keydef.cxx']
278 enable_lyrics_screen = get_option('lyrics_screen') and not mini
279 conf.set('ENABLE_LYRICS_SCREEN', enable_lyrics_screen)
280 if enable_lyrics_screen
281 sources += ['src/screen_lyrics.cxx', 'src/lyrics.cxx']
283 lyrics_plugin_dir = get_option('lyrics_plugin_dir')
284 if lyrics_plugin_dir == ''
285 lyrics_plugin_dir = join_paths(get_option('prefix'), get_option('libdir'), meson.project_name(), 'lyrics')
288 conf.set_quoted('LYRICS_PLUGIN_DIR', lyrics_plugin_dir)
291 'lyrics/20-lyricwiki.rb',
292 install_dir: lyrics_plugin_dir)
294 need_screen_text = true
295 need_plugin_library = true
298 enable_outputs_screen = get_option('outputs_screen') and not mini
299 conf.set('ENABLE_OUTPUTS_SCREEN', enable_outputs_screen)
300 if enable_outputs_screen
301 sources += ['src/screen_outputs.cxx']
304 enable_chat_screen = get_option('chat_screen') and not mini
305 conf.set('ENABLE_CHAT_SCREEN', enable_chat_screen)
306 if enable_chat_screen
307 sources += ['src/screen_chat.cxx']
308 need_screen_text = true
312 sources += ['src/TextPage.cxx']
315 if need_plugin_library
316 if host_machine.system() == 'windows'
317 error('Plugins not yet compatible with Windows')
320 sources += ['src/plugin.cxx']
323 if host_machine.system() == 'windows'
327 ncmpc = executable('ncmpc',
338 'src/player_command.cxx',
340 'src/ProgressBar.cxx',
343 'src/screen_init.cxx',
344 'src/screen_paint.cxx',
345 'src/screen_utils.cxx',
346 'src/screen_status.cxx',
347 'src/screen_list.cxx',
348 'src/screen_find.cxx',
349 'src/screen_client.cxx',
350 'src/screen_queue.cxx',
351 'src/screen_browser.cxx',
352 'src/screen_file.cxx',
354 'src/ListWindow.cxx',
355 'src/save_playlist.cxx',
356 'src/song_paint.cxx',
361 'src/time_format.cxx',
364 include_directories: inc,
374 configure_file(output: 'config.h', configuration: conf)
376 docdir = join_paths(get_option('datadir'), 'doc', meson.project_name())
377 install_data('AUTHORS', 'COPYING', 'NEWS', 'README.rst',