aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--3rd-party/SingleApplication/meson.build2
-rw-r--r--lang/meson.build2
-rw-r--r--lib/about/meson.build14
-rw-r--r--lib/addressbar/meson.build5
-rw-r--r--lib/bookmarks/meson.build2
-rw-r--r--lib/configuration/meson.build2
-rw-r--r--lib/downloads/meson.build2
-rw-r--r--lib/webprofile/meson.build2
-rw-r--r--meson.build51
-rw-r--r--meson_options.txt1
-rw-r--r--plugins/ConfigurationEditor/meson.build2
-rw-r--r--plugins/ProfileEditor/meson.build2
-rw-r--r--src/cli/cli.cpp51
-rw-r--r--src/cli/meson.build4
-rw-r--r--src/meson.build4
15 files changed, 98 insertions, 48 deletions
diff --git a/3rd-party/SingleApplication/meson.build b/3rd-party/SingleApplication/meson.build
index 1ac04f9..f08b50e 100644
--- a/3rd-party/SingleApplication/meson.build
+++ b/3rd-party/SingleApplication/meson.build
@@ -1,6 +1,6 @@
SingleApplication_inc = include_directories('SingleApplication.git')
-SingleApplication_moc = qt5.preprocess(
+SingleApplication_moc = mod_qt5.preprocess(
moc_headers: ['SingleApplication.git/singleapplication.h', 'SingleApplication.git/singleapplication_p.h'],
moc_extra_arguments: ['-DQAPPLICATION_CLASS=QApplication'],
dependencies: dep_qt5
diff --git a/lang/meson.build b/lang/meson.build
index eeb96ff..8c4a820 100644
--- a/lang/meson.build
+++ b/lang/meson.build
@@ -1,4 +1,4 @@
# translations
-qt5.compile_translations(ts_files: 'bg.ts', install: get_option('translations').enabled(), install_dir: get_option('datadir') / 'smolbote/translations' , build_by_default: false)
+mod_qt5.compile_translations(ts_files: 'bg.ts', install: get_option('translations').enabled(), install_dir: get_option('datadir') / 'smolbote/translations' , build_by_default: false)
diff --git a/lib/about/meson.build b/lib/about/meson.build
index 961c7ef..e6228c4 100644
--- a/lib/about/meson.build
+++ b/lib/about/meson.build
@@ -1,16 +1,12 @@
-about_moc = qt5.preprocess(
+about_moc = mod_qt5.preprocess(
moc_headers: ['aboutdialog.h', 'aboutplugin.h'],
ui_files: ['aboutdialog.ui', 'aboutplugin.ui'],
dependencies: dep_qt5
)
-about_inc = include_directories('.')
-about_lib = static_library('about', ['aboutdialog.cpp', 'aboutplugin.cpp', about_moc],
- dependencies: [dep_qt5, dep_genheaders]
-)
-
dep_about = declare_dependency(
- include_directories: about_inc,
- link_with: about_lib,
- sources: ['aboutdialog.cpp', about_moc]
+ include_directories: include_directories('.'),
+ link_with: static_library('about',
+ ['aboutdialog.cpp', 'aboutplugin.cpp', about_moc],
+ dependencies: [dep_qt5, dep_genheaders])
)
diff --git a/lib/addressbar/meson.build b/lib/addressbar/meson.build
index de54352..486d05d 100644
--- a/lib/addressbar/meson.build
+++ b/lib/addressbar/meson.build
@@ -1,5 +1,5 @@
addressbar_inc = include_directories('.')
-addressbar_moc = qt5.preprocess(
+addressbar_moc = mod_qt5.preprocess(
moc_headers: ['addressbar.h', 'completer.h', 'urllineedit.h'],
ui_files: ['addressbar.ui'],
dependencies: dep_qt5
@@ -11,6 +11,5 @@ addressbar_lib = static_library('addressbar', ['addressbar.cpp', 'completer.cpp'
dep_addressbar = declare_dependency(
include_directories: addressbar_inc,
- link_with: addressbar_lib,
- sources: ['addressbar.cpp', 'completer.cpp', 'urllineedit.cpp', addressbar_moc]
+ link_with: addressbar_lib
)
diff --git a/lib/bookmarks/meson.build b/lib/bookmarks/meson.build
index e0f2a61..cdcdd47 100644
--- a/lib/bookmarks/meson.build
+++ b/lib/bookmarks/meson.build
@@ -1,5 +1,5 @@
bookmarks_inc = include_directories('.')
-bookmarks_moc = qt5.preprocess(
+bookmarks_moc = mod_qt5.preprocess(
moc_headers: ['bookmarkswidget.h', 'model/bookmarkmodel.h', 'forms/editbookmarkdialog.h'],
ui_files: ['bookmarksform.ui', 'forms/editbookmarkdialog.ui'],
dependencies: dep_qt5
diff --git a/lib/configuration/meson.build b/lib/configuration/meson.build
index e93eca9..7234bf0 100644
--- a/lib/configuration/meson.build
+++ b/lib/configuration/meson.build
@@ -1,5 +1,5 @@
configuration_inc = include_directories('.')
-configuration_moc = qt5.preprocess(
+configuration_moc = mod_qt5.preprocess(
moc_headers: ['configuration.h'],
dependencies: dep_qt5
)
diff --git a/lib/downloads/meson.build b/lib/downloads/meson.build
index 761ab78..9b86391 100644
--- a/lib/downloads/meson.build
+++ b/lib/downloads/meson.build
@@ -1,5 +1,5 @@
downloads_inc = include_directories('.')
-downloads_moc = qt5.preprocess(
+downloads_moc = mod_qt5.preprocess(
moc_headers: ['downloadswidget.h', 'widgets/downloaditemwidget.h', 'widgets/elidedlabel.h'],
ui_files: ['downloadsform.ui', 'widgets/downloaditemform.ui'],
dependencies: dep_qt5
diff --git a/lib/webprofile/meson.build b/lib/webprofile/meson.build
index af4cfcb..b3836cc 100644
--- a/lib/webprofile/meson.build
+++ b/lib/webprofile/meson.build
@@ -1,6 +1,6 @@
webprofile_lib = static_library('webprofile',
['webprofilemanager.cpp', 'webprofile.cpp', interfaces_moc,
- qt5.preprocess(moc_headers: ['webprofilemanager.h', 'webprofile.h'], dependencies: dep_qt5)],
+ mod_qt5.preprocess(moc_headers: ['webprofilemanager.h', 'webprofile.h'], dependencies: dep_qt5)],
dependencies: dep_qt5,
include_directories: [include]
)
diff --git a/meson.build b/meson.build
index dcae570..9310eb0 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,9 @@
project('smolbote', 'cpp',
version: 'master',
default_options: ['cpp_std=c++17', 'strip=true', 'warning_level=3'],
- license: 'GPL3')
+ license: 'GPL3',
+ meson_version: '>=0.49.0'
+)
# autogenerate qtcreator project files
# add_postconf_script(script_name, arg1, arg2, ...)
@@ -11,47 +13,46 @@ project('smolbote', 'cpp',
# add -DQT_NO_DEBUG to non-debug builds
if not get_option('debug')
- add_global_arguments('-DQT_NO_DEBUG', language: 'cpp')
+ add_project_arguments('-DQT_NO_DEBUG', language: 'cpp')
endif
-# Qt 5
-qt5 = import('qt5')
-dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Concurrent', 'Test'])
+mod_qt5 = import('qt5')
+dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Concurrent'])
+
+mod_python = import('python')
+python3 = mod_python.find_installation('python3')
-# Boost
dep_boost = dependency('boost', modules: ['program_options'])
-# spdlog
dep_spdlog = dependency('spdlog', fallback: ['spdlog', 'spdlog_dep'], version: '>=1.3.1')
-# Breakpad
+optional_deps = []
+
if get_option('Breakpad').enabled()
-dep_breakpad = declare_dependency(
- compile_args: '-DBREAKPAD',
- dependencies: [dependency('breakpad-client'),
- dependency('threads')]
+optional_deps += declare_dependency(compile_args: '-DBREAKPAD',
+ dependencies: [dependency('breakpad-client'), dependency('threads')]
)
-else
- dep_breakpad = declare_dependency()
endif
-# KDE
if get_option('Plasma').enabled()
-dep_plasma = declare_dependency(
- compile_args: '-DPLASMA',
- dependencies: [ dependency('KF5WindowSystem', method: 'cmake'),
- dependency('KF5Wallet', method: 'cmake')]
+optional_deps += declare_dependency(compile_args: '-DPLASMA',
+ dependencies: [ dependency('KF5WindowSystem', method: 'cmake'), dependency('KF5Wallet', method: 'cmake')]
)
-else
- dep_plasma = declare_dependency()
endif
+if get_option('Python').enabled()
+optional_deps += declare_dependency(compile_args: '-DPYTHON',
+ dependencies: [ meson.get_compiler('cpp').find_library('linenoise'),
+ python3.dependency('python', version: '>=3.0.0')])
+ subdir('src/cli')
+endif
+
+dep_gtest = dependency('gtest', required: get_option('testing'))
+
# Generate config header
include = include_directories('include')
git = find_program('git').path()
-pymod = import('python')
-python3 = pymod.find_installation('python3')
dep_genheaders = declare_dependency(
include_directories: include_directories('.'),
@@ -70,13 +71,11 @@ dep_genheaders = declare_dependency(
)]
)
-interfaces_moc = qt5.preprocess(
+interfaces_moc = mod_qt5.preprocess(
moc_headers: 'include/profileinterface.h',
dependencies: dep_qt5
)
-dep_gtest = dependency('gtest', required: get_option('testing'))
-
subdir('lib/about')
subdir('lib/addressbar')
subdir('lib/bookmarks')
diff --git a/meson_options.txt b/meson_options.txt
index 5362f95..2615eaa 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -9,5 +9,6 @@ option('translations', description: 'Generate and install translations', type: '
# Feature options
option('Breakpad', description: 'Enable breakpad crash reporting', type: 'feature', value: 'auto')
option('Plasma', description: 'Enable KDE plasma integration', type: 'feature', value: 'auto')
+option('Python', description: 'Enable Python interpreter', type: 'feature', value: 'auto')
option('testing', description: 'Build tests (requires gtest)', type: 'feature', value: 'auto')
diff --git a/plugins/ConfigurationEditor/meson.build b/plugins/ConfigurationEditor/meson.build
index 6993531..96acccc 100644
--- a/plugins/ConfigurationEditor/meson.build
+++ b/plugins/ConfigurationEditor/meson.build
@@ -1,4 +1,4 @@
-ConfigurationEditorPlugin_moc = qt5.preprocess(
+ConfigurationEditorPlugin_moc = mod_qt5.preprocess(
include_directories: include,
moc_headers: ['configurationeditorplugin.h', 'forms/configurationdialog.h'],
ui_files: ['forms/configurationdialog.ui'],
diff --git a/plugins/ProfileEditor/meson.build b/plugins/ProfileEditor/meson.build
index c1507ce..c44f5c4 100644
--- a/plugins/ProfileEditor/meson.build
+++ b/plugins/ProfileEditor/meson.build
@@ -1,4 +1,4 @@
-ProfileEditorPlugin_moc = qt5.preprocess(
+ProfileEditorPlugin_moc = mod_qt5.preprocess(
include_directories: include,
moc_headers: ['profileeditorplugin.h', 'forms/profilemanagerdialog.h', 'forms/profileview.h', 'forms/newprofiledialog.h', 'forms/newhttpheaderdialog.h'],
ui_files: ['forms/profilemanagerdialog.ui', 'forms/profileview.ui', 'forms/newprofiledialog.ui', 'forms/newhttpheaderdialog.ui'],
diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp
new file mode 100644
index 0000000..ae3795e
--- /dev/null
+++ b/src/cli/cli.cpp
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <stdlib.h>
+//#include <string.h>
+#include <linenoise.h>
+#include <Python.h>
+
+int main(int argc, char** argv)
+{
+ printf("cli test application\n");
+
+ wchar_t *program = Py_DecodeLocale(argv[0], NULL);
+ if (program == NULL) {
+ fprintf(stderr, "Fatal error: cannot decode argv[0]\n");
+ exit(1);
+ }
+
+ // inform the interpreter about paths to run-time libraries
+ Py_SetProgramName(program); /* optional but recommended */
+
+
+ // Initialize the python interpreter
+ Py_Initialize();
+
+ PyRun_SimpleString("print('Python interpreter ready')\n");
+
+ const char* prompt = "poi> ";
+
+ while(true) {
+ char *cmd = linenoise(prompt);
+
+ if(cmd == nullptr || *cmd == '\0') {
+ printf("break\n");
+ free(cmd);
+ break;
+ }
+
+ //printf("echo(%i):'%s'\n", strlen(cmd), cmd);
+ PyRun_SimpleString(cmd);
+ free(cmd);
+ }
+
+ // finalize the interpreter
+ if (Py_FinalizeEx() < 0) {
+ exit(120);
+ }
+
+ //
+ PyMem_RawFree(program);
+
+ return 0;
+}
diff --git a/src/cli/meson.build b/src/cli/meson.build
new file mode 100644
index 0000000..298e1db
--- /dev/null
+++ b/src/cli/meson.build
@@ -0,0 +1,4 @@
+cli_demo = executable('cli', install: false, dependencies: [ optional_deps ],
+ sources: [ 'cli.cpp' ]
+)
+
diff --git a/src/meson.build b/src/meson.build
index 6d5a42e..ef0f989 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,5 @@
# poi
-poi_moc = qt5.preprocess(
+poi_moc = mod_qt5.preprocess(
moc_headers: ['browser.h',
'mainwindow/mainwindow.h', 'mainwindow/menubar.h', 'mainwindow/widgets/dockwidget.h', 'mainwindow/widgets/menusearch.h', 'mainwindow/widgets/navigationbar.h', 'mainwindow/widgets/searchform.h',
'session/savesessiondialog.h', 'session/sessiondialog.h', 'session/sessionform.h',
@@ -13,7 +13,7 @@ poi_moc = qt5.preprocess(
poi = executable(get_option('poiName'), install: true,
cpp_args: ['-DQAPPLICATION_CLASS=QApplication'],
- dependencies: [dep_qt5, dep_boost, dep_SingleApplication, dep_genheaders, dep_breakpad, dep_plasma, dep_spdlog,
+ dependencies: [dep_qt5, dep_boost, dep_spdlog, dep_SingleApplication, dep_genheaders, optional_deps,
dep_about, dep_addressbar, dep_bookmarks, dep_configuration, dep_downloads, dep_urlfilter, dep_webprofile],
include_directories: [include],
sources: ['main.cpp', 'builtins.cpp', 'crashhandler.cpp', poi_moc,