aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli/cli.cpp51
-rw-r--r--src/cli/meson.build4
-rw-r--r--src/meson.build4
3 files changed, 57 insertions, 2 deletions
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,