]> git.sesse.net Git - plocate/blob - meson.build
Add -latomic if it exists; seems to be required on armel and sh4.
[plocate] / meson.build
1 project('plocate', 'cpp', default_options: ['buildtype=debugoptimized','cpp_std=c++17'], version: '1.0.5-pre')
2
3 # Make the version available as a #define.
4 add_project_arguments('-DPLOCATE_VERSION="' + meson.project_version() + '"', language: 'cpp')
5
6 cxx = meson.get_compiler('cpp')
7 uringdep = dependency('liburing', required: false)
8 zstddep = dependency('libzstd')
9 threaddep = dependency('threads')
10 atomicdep = dependency('atomic', required: false)
11
12 if not uringdep.found()
13         add_project_arguments('-DWITHOUT_URING', language: 'cpp')
14 endif
15
16 executable('plocate', ['plocate.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp', 'parse_trigrams.cpp', 'serializer.cpp', 'access_rx_cache.cpp', 'needle.cpp'],
17         dependencies: [uringdep, zstddep, threaddep, atomicdep],
18         install: true,
19         install_mode: ['rwxr-sr-x', 'root', 'mlocate'])
20 executable('plocate-build', 'plocate-build.cpp',
21         dependencies: [zstddep],
22         install: true,
23         install_dir: get_option('sbindir'))
24
25 conf_data = configuration_data()
26 conf_data.set('PROCESSED_BY_MESON', '1')
27 conf_data.set('sbindir', get_option('prefix') + '/' + get_option('sbindir'))
28 conf_data.set('locategroup', get_option('locategroup'))
29 update_script = configure_file(input: 'update-plocate.sh',
30                output: 'update-plocate.sh',
31                configuration: conf_data)
32
33 if get_option('install_cron')
34         install_data(update_script,
35                 install_dir: '/etc/cron.daily',
36                 rename: 'plocate')
37 endif
38 install_man('plocate.1')
39 install_man('plocate-build.8')
40
41 # Requires having TurboPFor checked out, so not built by default.
42 # Unless you have a recent Meson, there's no apparently good way
43 # of calling into that directory to run make, and we're not
44 # replicating their build system, so it has to be manual.
45 pfordir = meson.source_root() + '/TurboPFor-Integer-Compression'
46 if run_command('[', '-r', pfordir + '/libic.a', ']').returncode() == 0
47         turbopfordep = declare_dependency(
48                 include_directories: include_directories('TurboPFor-Integer-Compression'),
49                 dependencies: meson.get_compiler('cpp').find_library('ic', dirs: pfordir))
50         executable('bench', ['bench.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp'],
51                 dependencies: [uringdep, turbopfordep],
52                 build_by_default: false,
53                 install: false)
54 endif