From f3a4607d6a722a862af0eb9747a15dcdf624b6fb Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 3 Nov 2019 00:18:10 +0200 Subject: Drop boost dependency - wrote not-invented-here config file parser and conf class - spent obscene amount of time plugging in said conf class --- meson.build | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index af2dd63..4092f5e 100644 --- a/meson.build +++ b/meson.build @@ -6,8 +6,24 @@ project('smolbote', 'cpp', ) kconfig = import('unstable-kconfig') -cdata = configuration_data(kconfig.load(host_machine.system() + '/.config')) -config_h = configure_file(output: 'config.h', configuration: cdata) +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'], @@ -16,11 +32,6 @@ version_h = vcs_tag( output: 'version.h' ) -autogen_config = declare_dependency( - include_directories: include_directories('.'), - sources: [config_h] -) - # add -DQT_NO_DEBUG to non-debug builds if not get_option('debug') add_project_arguments('-DQT_NO_DEBUG', language: 'cpp') @@ -37,14 +48,13 @@ add_project_arguments(cxx.get_supported_arguments([ '-mspeculative-load-hardening', # Spectre v1 mitigation + '-Wconsumed', '-Wimplicit-fallthrough', ]), language: 'cpp') mod_qt5 = import('qt5') dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Concurrent']) -dep_boost = dependency('boost', modules: ['program_options']) - dep_spdlog = dependency('spdlog', fallback: ['spdlog', 'spdlog_dep'], version: '>=1.3.1') optional_deps = [] @@ -72,7 +82,6 @@ interfaces_moc = mod_qt5.preprocess( ) subdir('lib/about') -subdir('lib/addressbar') subdir('lib/bookmarks') subdir('lib/configuration') subdir('lib/downloads') @@ -87,6 +96,8 @@ subdir('src') subdir('lang') subdir('doc') -subdir('plugins/ConfigurationEditor') +#subdir('plugins/ConfigurationEditor') subdir('plugins/ProfileEditor') +subdir('test/conf') + -- cgit v1.2.1