project('smolbote', ['cpp'], version: '0.1.0', default_options: ['cpp_std=c++2a', 'warning_level=3'], license: 'GPL3', meson_version: '>=0.52.0' ) kconfig = import('unstable-kconfig') kconf = kconfig.load(host_machine.system() + '/.config') cdata = configuration_data(kconf) 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 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, 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 '-fconcepts', '-mspeculative-load-hardening', # Spectre v1 mitigation '-Wconsumed', # (clang) use-after-move warnings '-Wdate-time', # Warn when using __TIME__ and __DATE__ macros '-Wimplicit-fallthrough', '-Wold-style-cast' ]), language: 'cpp') if get_option('buildtype') == 'release' add_project_arguments(cxx.get_supported_arguments([ '-flto=4', ]), language: 'cpp') endif mod_qt5 = import('qt5') dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Concurrent', 'Test'], include_type: 'system' ) dep_spdlog = dependency('spdlog', fallback: ['spdlog', 'spdlog_dep'], version: '>=1.3.1') optional_deps = [] poi_cpp_args = [] dep_breakpad = dependency('breakpad-client', include_type: 'system', required: get_option('crashhandler')) dep_threads = dependency('threads', include_type: 'system', required: get_option('crashhandler')) if dep_breakpad.found() poi_cpp_args += '-DHAVE_BREAKPAD' endif dep_gtest = dependency('gtest', required: false, disabler: true) # Generate config header include = include_directories('include') poi_sourceset = sourceset.source_set() subdir('include') # plugin interaces 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('tools') #subdir('plugins/ConfigurationEditor') #subdir('plugins/ProfileEditor') subdir('test/firefox-bookmarks-json-parser') ssconfig = poi_sourceset.apply(cdata) poi_exe = executable(get_option('poi'), cpp_args: ['-DQAPPLICATION_CLASS=QApplication', poi_cpp_args], 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, dep_plugininterface, ssconfig.dependencies() ], install: true, ) test('poi-bookmarks: xbel', poi_exe, args: [ 'bookmarks', '-x', files('test/bookmarks.xbel'), '--export=stdout' ]) 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