aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build70
1 files changed, 37 insertions, 33 deletions
diff --git a/meson.build b/meson.build
index 35541c5..6a7518b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,8 +1,8 @@
-project('smolbote', 'cpp',
+project('smolbote', ['cpp'],
version: '0.1.0',
- default_options: ['cpp_std=c++17', 'strip=true', 'warning_level=3'],
+ default_options: ['cpp_std=c++17', 'warning_level=3'],
license: 'GPL3',
- meson_version: '>=0.51.2'
+ meson_version: '>=0.52.0'
)
kconfig = import('unstable-kconfig')
@@ -10,21 +10,6 @@ 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(),
@@ -37,12 +22,13 @@ if not get_option('debug')
add_project_arguments('-DQT_NO_DEBUG', language: 'cpp')
endif
+sourceset = import('sourceset')
+
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
+ '-ffunction-sections', # Place each function into its own section, 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
@@ -52,26 +38,22 @@ add_project_arguments(cxx.get_supported_arguments([
'-Wdate-time', # Warn when using __TIME__ and __DATE__ macros
'-Wimplicit-fallthrough',
]), language: 'cpp')
+add_project_link_arguments(cxx.get_supported_link_arguments([
+ '-fuse-ld=gold'
+]), language: 'cpp')
mod_qt5 = import('qt5')
-dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Concurrent'])
+dep_qt5 = dependency('qt5',
+ modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Concurrent'],
+ include_type: 'system'
+)
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_breakpad = dependency('breakpad-client', include_type: 'system', required: get_option('crashhandler'))
+dep_threads = dependency('threads', include_type: 'system', required: get_option('crashhandler'))
dep_gtest = dependency('gtest', required: false, disabler: true)
# Generate config header
@@ -82,6 +64,8 @@ interfaces_moc = mod_qt5.preprocess(
dependencies: dep_qt5
)
+poi_sourceset = sourceset.source_set()
+
subdir('lib/about')
subdir('lib/bookmarks')
subdir('lib/configuration')
@@ -95,9 +79,29 @@ subdir('3rd-party/args')
subdir('src')
subdir('lang')
subdir('doc')
+subdir('tools')
#subdir('plugins/ConfigurationEditor')
subdir('plugins/ProfileEditor')
subdir('test/conf')
+ssconfig = poi_sourceset.apply(cdata)
+
+poi_exe = executable(get_option('poi'),
+ cpp_args: ['-DQAPPLICATION_CLASS=QApplication'],
+ sources: [ssconfig.sources()],
+ include_directories: [include, include_directories('src')],
+ dependencies: [dep_qt5, dep_spdlog, dep_SingleApplication, dep_args, optional_deps, dep_about, dep_bookmarks, dep_configuration, dep_downloads, dep_pluginloader, dep_urlfilter],
+ install: true,
+)
+
+subdir(host_machine.system())
+
+# cppcheck target
+cppcheck = find_program('cppcheck', required: false)
+if cppcheck.found()
+run_target('cppcheck',
+ command: [cppcheck, '--enable=all', '--project=' + meson.build_root() / 'compile_commands.json']
+)
+endif