]> git.sesse.net Git - plocate/blob - meson.build
c5622eb209d4c2282f63fcc9e2aaa28a91ad2a38
[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
11 if not uringdep.found()
12         add_project_arguments('-DWITHOUT_URING', language: 'cpp')
13 endif
14
15 executable('plocate', ['plocate.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp', 'parse_trigrams.cpp', 'serializer.cpp', 'access_rx_cache.cpp', 'needle.cpp'],
16         dependencies: [uringdep, zstddep, threaddep],
17         install: true,
18         install_mode: ['rwxr-sr-x', 'root', 'mlocate'])
19 executable('plocate-build', 'plocate-build.cpp',
20         dependencies: [zstddep],
21         install: true,
22         install_dir: get_option('sbindir'))
23
24 conf_data = configuration_data()
25 conf_data.set('PROCESSED_BY_MESON', '1')
26 conf_data.set('sbindir', get_option('prefix') + '/' + get_option('sbindir'))
27 conf_data.set('locategroup', get_option('locategroup'))
28 update_script = configure_file(input: 'update-plocate.sh',
29                output: 'update-plocate.sh',
30                configuration: conf_data)
31
32 if get_option('install_cron')
33         install_data(update_script,
34                 install_dir: '/etc/cron.daily',
35                 rename: 'plocate')
36 endif
37 install_man('plocate.1')
38 install_man('plocate-build.8')
39
40 # Requires having TurboPFor checked out, so not built by default.
41 # Unless you have a recent Meson, there's no apparently good way
42 # of calling into that directory to run make, and we're not
43 # replicating their build system, so it has to be manual.
44 pfordir = meson.source_root() + '/TurboPFor-Integer-Compression'
45 if run_command('[', '-r', pfordir + '/libic.a', ']').returncode() == 0
46         turbopfordep = declare_dependency(
47                 include_directories: include_directories('TurboPFor-Integer-Compression'),
48                 dependencies: meson.get_compiler('cpp').find_library('ic', dirs: pfordir))
49         executable('bench', ['bench.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp'],
50                 dependencies: [uringdep, turbopfordep],
51                 build_by_default: false,
52                 install: false)
53 endif