mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Add enable_python option to meson
This commit is contained in:
parent
2be8ec8456
commit
f945ebf9ae
@ -103,6 +103,8 @@ or, if you don't want to build with Python at all, use -DCUTTER_ENABLE_PYTHON=OF
|
||||
|
||||
include_directories(${SHIBOKEN_INCLUDE_DIR})
|
||||
include_directories(${PYSIDE_INCLUDE_DIR} ${PYSIDE_INCLUDE_DIR}/QtCore ${PYSIDE_INCLUDE_DIR}/QtGui ${PYSIDE_INCLUDE_DIR}/QtWidgets)
|
||||
|
||||
add_definitions(-DCUTTER_ENABLE_PYTHON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -54,7 +54,9 @@ void PythonManager::initPythonHome()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CUTTER_ENABLE_PYTHON_BINDINGS
|
||||
extern "C" PyObject *PyInit_CutterBindings();
|
||||
#endif
|
||||
|
||||
void PythonManager::initialize()
|
||||
{
|
||||
@ -65,7 +67,9 @@ void PythonManager::initialize()
|
||||
PyImport_AppendInittab("cutter_internal", &PyInit_api_internal);
|
||||
#endif
|
||||
PyImport_AppendInittab("_qtres", &PyInit_qtres);
|
||||
#ifdef CUTTER_ENABLE_PYTHON_BINDINGS
|
||||
PyImport_AppendInittab("CutterBindings", &PyInit_CutterBindings);
|
||||
#endif
|
||||
Py_Initialize();
|
||||
PyEval_InitThreads();
|
||||
pyThreadStateCounter = 1; // we have the thread now => 1
|
||||
|
@ -5,18 +5,22 @@ py3_exe = import('python').find_installation('python3')
|
||||
|
||||
qt_modules = []
|
||||
feature_define_args = []
|
||||
if get_option('enable_jupyter')
|
||||
message('Jupyter support enabled')
|
||||
add_project_arguments('-DCUTTER_ENABLE_JUPYTER', language: 'cpp')
|
||||
feature_define_args += ['-DCUTTER_ENABLE_JUPYTER']
|
||||
if get_option('enable_webengine')
|
||||
message('QtWebEngine support enabled')
|
||||
add_project_arguments('-DCUTTER_ENABLE_QTWEBENGINE', language: 'cpp')
|
||||
feature_define_args += ['-DCUTTER_ENABLE_QTWEBENGINE']
|
||||
qt_modules += 'WebEngineWidgets'
|
||||
if get_option('enable_python')
|
||||
message('Python is enabled')
|
||||
feature_define_args += ['-DCUTTER_ENABLE_PYTHON']
|
||||
if get_option('enable_jupyter')
|
||||
message('Jupyter support enabled')
|
||||
feature_define_args += ['-DCUTTER_ENABLE_JUPYTER']
|
||||
if get_option('enable_webengine')
|
||||
message('QtWebEngine support enabled')
|
||||
feature_define_args += ['-DCUTTER_ENABLE_QTWEBENGINE']
|
||||
qt_modules += 'WebEngineWidgets'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
add_project_arguments(feature_define_args, language: 'cpp')
|
||||
|
||||
parse_cmd = [py3_exe, join_paths(meson.current_source_dir(), '../scripts/meson_parse_qmake.py')]
|
||||
|
||||
qt_modules += run_command(parse_cmd + ['QT'], check: true).stdout().split(';')
|
||||
@ -59,7 +63,7 @@ libr2_dep = r2.get_variable('libr2_dep')
|
||||
qt5dep = dependency('qt5', modules: qt_modules)
|
||||
|
||||
deps = [libr2_dep, qt5dep]
|
||||
if get_option('enable_jupyter')
|
||||
if get_option('enable_python')
|
||||
deps += [dependency('python3')]
|
||||
endif
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
option('enable_python', type: 'boolean', value: true)
|
||||
option('enable_jupyter', type: 'boolean', value: false)
|
||||
option('enable_webengine', type: 'boolean', value: false)
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#ifdef CUTTER_ENABLE_PYTHON
|
||||
#ifdef CUTTER_ENABLE_PYTHON_BINDINGS
|
||||
#include <Python.h>
|
||||
#include <cutterbindings_python.h>
|
||||
#include "PythonManager.h"
|
||||
@ -51,7 +51,7 @@ void PluginManager::loadPlugins()
|
||||
loadNativePlugins(nativePluginsDir);
|
||||
}
|
||||
|
||||
#ifdef CUTTER_ENABLE_PYTHON
|
||||
#ifdef CUTTER_ENABLE_PYTHON_BINDINGS
|
||||
QDir pythonPluginsDir = pluginsDir;
|
||||
pythonPluginsDir.mkdir("python");
|
||||
if (pythonPluginsDir.cd("python")) {
|
||||
@ -87,7 +87,7 @@ void PluginManager::loadNativePlugins(const QDir &directory)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CUTTER_ENABLE_PYTHON
|
||||
#ifdef CUTTER_ENABLE_PYTHON_BINDINGS
|
||||
|
||||
void PluginManager::loadPythonPlugins(const QDir &directory)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ private:
|
||||
|
||||
void loadNativePlugins(const QDir &directory);
|
||||
|
||||
#ifdef CUTTER_ENABLE_PYTHON
|
||||
#ifdef CUTTER_ENABLE_PYTHON_BINDINGS
|
||||
void loadPythonPlugins(const QDir &directory);
|
||||
CutterPlugin *loadPythonPlugin(const char *moduleName);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user