mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
meson: Make Jupyter optional (#348)
This commit is contained in:
parent
bac63d3479
commit
98b9de504b
10
meson.py
10
meson.py
@ -60,7 +60,7 @@ def parse_qmake_file():
|
||||
if end_of_def:
|
||||
var_name = None
|
||||
qt_mod_translation = { "webenginewidgets": "WebEngineWidgets" }
|
||||
VARS['QT'] = list(map(lambda s: qt_mod_translation[s] if s in qt_mod_translation else str.title(s), VARS['QT']))
|
||||
VARS['QT'] = list(map(lambda s: qt_mod_translation.get(s, str.title(s)), VARS['QT']))
|
||||
log.debug('Variables: \n%s', pprint.pformat(VARS, compact=True))
|
||||
|
||||
def win_dist(args):
|
||||
@ -76,6 +76,8 @@ def win_dist(args):
|
||||
def build(args):
|
||||
r2_meson_mod.prepare_capstone()
|
||||
cutter_builddir = os.path.join(ROOT, args.dir)
|
||||
if not args.webengine:
|
||||
VARS['QT'].remove('WebEngineWidgets')
|
||||
if not os.path.exists(cutter_builddir):
|
||||
defines = []
|
||||
defines.append('-Dversion=%s' % VARS['VERSION'][0])
|
||||
@ -84,6 +86,8 @@ def build(args):
|
||||
defines.append('-Dheaders=%s' % ','.join(VARS['HEADERS']))
|
||||
defines.append('-Dui_files=%s' % ','.join(VARS['FORMS']))
|
||||
defines.append('-Dqresources=%s' % ','.join(VARS['RESOURCES']))
|
||||
defines.append('-Denable_jupyter=%s' % str(args.jupyter).lower())
|
||||
defines.append('-Denable_webengine=%s' % str(args.webengine).lower())
|
||||
r2_meson_mod.meson(os.path.join(ROOT, 'src'), cutter_builddir,
|
||||
prefix=cutter_builddir, backend=args.backend,
|
||||
release=True, shared=False, options=defines)
|
||||
@ -118,6 +122,10 @@ def main():
|
||||
default='ninja', help='Choose build backend')
|
||||
parser.add_argument('--dir', default='build',
|
||||
help='Destination build directory')
|
||||
parser.add_argument('--jupyter', action='store_true',
|
||||
help='Enable Jupyter support')
|
||||
parser.add_argument('--webengine', action='store_true',
|
||||
help='Enable QtWebEngine support')
|
||||
if os.name == 'nt':
|
||||
parser.add_argument('--dist', help='dist directory')
|
||||
args = parser.parse_args()
|
||||
|
@ -1,16 +1,17 @@
|
||||
#TODO: icon
|
||||
project('cutter', 'cpp', default_options: 'cpp_std=c++11')
|
||||
|
||||
#TODO: add console option
|
||||
console = false
|
||||
|
||||
#TODO: make optional
|
||||
feature_define_args = [
|
||||
'-DCUTTER_ENABLE_JUPYTER',
|
||||
'-DCUTTER_ENABLE_QTWEBENGINE'
|
||||
]
|
||||
|
||||
add_project_arguments(feature_define_args, language: 'cpp')
|
||||
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']
|
||||
endif
|
||||
endif
|
||||
|
||||
qt5_mod = import('qt5')
|
||||
|
||||
@ -38,11 +39,9 @@ if host_machine.system() == 'windows'
|
||||
add_project_arguments('-D_CRT_NONSTDC_NO_DEPRECATE', language: 'cpp')
|
||||
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'cpp')
|
||||
platform_inc = include_directories('../cutter_win32/include')
|
||||
if not console
|
||||
# Workaround for https://github.com/mesonbuild/meson/issues/2327
|
||||
qt_lib = run_command('qmake', '-query', 'QT_HOST_LIBS').stdout().strip()
|
||||
add_project_link_arguments('@0@/qtmain.lib'.format(qt_lib), language: 'cpp')
|
||||
endif
|
||||
# Workaround for https://github.com/mesonbuild/meson/issues/2327
|
||||
qt_lib = run_command('qmake', '-query', 'QT_HOST_LIBS').stdout().strip()
|
||||
add_project_link_arguments(join_paths(qt_lib, 'qtmain.lib'), language: 'cpp')
|
||||
endif
|
||||
|
||||
add_project_arguments('-DAPP_VERSION="@0@"'.format(version), language: 'cpp')
|
||||
@ -50,11 +49,16 @@ add_project_arguments('-DAPP_VERSION="@0@"'.format(version), language: 'cpp')
|
||||
r2 = subproject('radare2')
|
||||
libr2_dep = r2.get_variable('libr2_dep')
|
||||
|
||||
deps = [libr2_dep, qt5dep]
|
||||
if get_option('enable_jupyter')
|
||||
deps += [dependency('python3')]
|
||||
endif
|
||||
|
||||
cutter_exe = executable(
|
||||
'Cutter',
|
||||
moc_files,
|
||||
gui_app: not console,
|
||||
gui_app: true,
|
||||
sources: sources,
|
||||
include_directories: platform_inc,
|
||||
dependencies: [libr2_dep, qt5dep, dependency('python3')],
|
||||
dependencies: deps,
|
||||
)
|
||||
|
@ -1,6 +1,9 @@
|
||||
option('version', type : 'string')
|
||||
option('qt_modules', type : 'array')
|
||||
option('sources', type : 'array')
|
||||
option('headers', type : 'array')
|
||||
option('ui_files', type : 'array')
|
||||
option('qresources', type : 'array')
|
||||
option('version', type: 'string')
|
||||
option('qt_modules', type: 'array')
|
||||
option('sources', type: 'array')
|
||||
option('headers', type: 'array')
|
||||
option('ui_files', type: 'array')
|
||||
option('qresources', type: 'array')
|
||||
|
||||
option('enable_jupyter', type: 'boolean', value: false)
|
||||
option('enable_webengine', type: 'boolean', value: false)
|
||||
|
Loading…
Reference in New Issue
Block a user