aboutsummaryrefslogtreecommitdiff
path: root/meson.build
blob: 35541c50ded1141f88a679537952b0ffeec2266f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
project('smolbote', 'cpp',
    version: '0.1.0',
    default_options: ['cpp_std=c++17', 'strip=true', 'warning_level=3'],
    license: 'GPL3',
    meson_version: '>=0.51.2'
)

kconfig = import('unstable-kconfig')
kconf = kconfig.load(host_machine.system() + '/.config')

cdata = configuration_data(kconf)

conf_init_list = '\n'
foreach key, value : kconf
  n = key.split('_')[1]
  if n.contains('.')
    if n.endswith('.width') or n.endswith('.height')
      conf_init_list += '        { "@0@", @1@ },\n'.format(n.to_lower(), value.to_int())
    else
      conf_init_list += '        { "@0@", std::string(@1@) },\n'.format(n.to_lower(), value)
    endif
  endif
endforeach
cdata.set('conf_init_list', conf_init_list)

configure_file(input: 'src/conf.hpp.in', output: 'conf.hpp', configuration: cdata)

version_h = vcs_tag(
    command: [find_program('git').path(), 'describe', '--long', '--abbrev=40'],
    #fallback: defaults to meson.project_version(),
    input: 'include/version.h.in',
    output: 'version.h'
)

# add -DQT_NO_DEBUG to non-debug builds
if not get_option('debug')
    add_project_arguments('-DQT_NO_DEBUG', language: 'cpp')
endif

cxx = meson.get_compiler('cpp')

# add some specific flags
add_project_arguments(cxx.get_supported_arguments([
  '-ffunction-sections',      # Place each function into its own section
                              # Leads to better ASLR but larger executables
  '-fstack-protector-all',    # Emit code to check for buffer overflows on all functions
  '-fstack-clash-protection', # Emit code to check for stack clash attacks

  '-mspeculative-load-hardening', # Spectre v1 mitigation

  '-Wconsumed',   # (clang) use-after-move warnings
  '-Wdate-time',  # Warn when using __TIME__ and __DATE__ macros
  '-Wimplicit-fallthrough',
]), language: 'cpp')

mod_qt5 = import('qt5')
dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Concurrent'])

dep_spdlog = dependency('spdlog', fallback: ['spdlog', 'spdlog_dep'], version: '>=1.3.1')

optional_deps = []

if get_option('Breakpad').enabled()
optional_deps += declare_dependency(compile_args: '-DBREAKPAD',
    dependencies: [dependency('breakpad-client'), dependency('threads')]
)
endif

if get_option('Plasma').enabled()
optional_deps += declare_dependency(compile_args: '-DPLASMA',
    dependencies: [ dependency('KF5WindowSystem', method: 'cmake'), dependency('KF5Wallet', method: 'cmake')]
)
endif

dep_gtest = dependency('gtest', required: false, disabler: true)

# Generate config header
include = include_directories('include')

interfaces_moc = mod_qt5.preprocess(
    moc_headers: 'include/profileinterface.h',
    dependencies: dep_qt5
)

subdir('lib/about')
subdir('lib/bookmarks')
subdir('lib/configuration')
subdir('lib/downloads')
subdir('lib/pluginloader')
subdir('lib/urlfilter')

subdir('3rd-party/SingleApplication')
subdir('3rd-party/args')

subdir('src')
subdir('lang')
subdir('doc')

#subdir('plugins/ConfigurationEditor')
subdir('plugins/ProfileEditor')

subdir('test/conf')