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
258 'src/screen_artist.cxx',
259 'src/ArtistListPage.cxx',
260 'src/AlbumListPage.cxx',
264 enable_search_screen = get_option('search_screen') and not mini
265 conf.set('ENABLE_SEARCH_SCREEN', enable_search_screen)
266 if enable_search_screen
267 sources += ['src/screen_search.cxx']
270 enable_song_screen = get_option('song_screen') and not mini
271 conf.set('ENABLE_SONG_SCREEN', enable_song_screen)
272 if enable_song_screen
273 sources += ['src/screen_song.cxx']
276 enable_keydef_screen = get_option('key_screen') and not mini
277 conf.set('ENABLE_KEYDEF_SCREEN', enable_keydef_screen)
278 if enable_keydef_screen
279 sources += ['src/screen_keydef.cxx']
282 enable_lyrics_screen = get_option('lyrics_screen') and not mini
283 conf.set('ENABLE_LYRICS_SCREEN', enable_lyrics_screen)
284 if enable_lyrics_screen
285 sources += ['src/screen_lyrics.cxx', 'src/lyrics.cxx']
287 lyrics_plugin_dir = get_option('lyrics_plugin_dir')
288 if lyrics_plugin_dir == ''
289 lyrics_plugin_dir = join_paths(get_option('prefix'), get_option('libdir'), meson.project_name(), 'lyrics')
292 conf.set_quoted('LYRICS_PLUGIN_DIR', lyrics_plugin_dir)
295 'lyrics/20-lyricwiki.rb',
296 install_dir: lyrics_plugin_dir)
298 need_screen_text = true
299 need_plugin_library = true
302 enable_outputs_screen = get_option('outputs_screen') and not mini
303 conf.set('ENABLE_OUTPUTS_SCREEN', enable_outputs_screen)
304 if enable_outputs_screen
305 sources += ['src/screen_outputs.cxx']
308 enable_chat_screen = get_option('chat_screen') and not mini
309 conf.set('ENABLE_CHAT_SCREEN', enable_chat_screen)
310 if enable_chat_screen
311 sources += ['src/screen_chat.cxx']
312 need_screen_text = true
316 sources += ['src/TextPage.cxx']
319 if need_plugin_library
320 if host_machine.system() == 'windows'
321 error('Plugins not yet compatible with Windows')
324 sources += ['src/plugin.cxx']
327 if host_machine.system() == 'windows'
331 ncmpc = executable('ncmpc',
342 'src/player_command.cxx',
344 'src/ProgressBar.cxx',
347 'src/screen_init.cxx',
348 'src/screen_paint.cxx',
349 'src/screen_utils.cxx',
350 'src/screen_status.cxx',
351 'src/screen_list.cxx',
352 'src/screen_find.cxx',
353 'src/screen_client.cxx',
354 'src/screen_queue.cxx',
355 'src/screen_browser.cxx',
356 'src/screen_file.cxx',
358 'src/ListWindow.cxx',
359 'src/save_playlist.cxx',
360 'src/song_paint.cxx',
365 'src/time_format.cxx',
368 include_directories: inc,
378 configure_file(output: 'config.h', configuration: conf)
380 docdir = join_paths(get_option('datadir'), 'doc', meson.project_name())
381 install_data('AUTHORS', 'COPYING', 'NEWS', 'README.rst',