2018-07-22 12:10:52 +00:00
|
|
|
project('Cutter', 'cpp', default_options: 'cpp_std=c++11', meson_version: '>=0.47.0')
|
2018-02-09 19:51:30 +00:00
|
|
|
|
2018-07-22 12:10:52 +00:00
|
|
|
qt5_mod = import('qt5')
|
|
|
|
py3_exe = import('python3').find_python()
|
|
|
|
|
|
|
|
qt_modules = []
|
2018-03-03 07:03:08 +00:00
|
|
|
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']
|
2018-07-22 12:10:52 +00:00
|
|
|
qt_modules += 'WebEngineWidgets'
|
2018-03-03 07:03:08 +00:00
|
|
|
endif
|
|
|
|
endif
|
2018-03-02 13:15:53 +00:00
|
|
|
|
2018-07-22 12:10:52 +00:00
|
|
|
parse_cmd = [py3_exe, '../scripts/meson_parse_qmake.py']
|
2018-02-09 19:51:30 +00:00
|
|
|
|
2018-07-22 12:10:52 +00:00
|
|
|
qt_modules += run_command(parse_cmd + ['QT'], check: true).stdout().split(';')
|
|
|
|
sources = run_command(parse_cmd + ['SOURCES'], check: true).stdout().split(';')
|
|
|
|
headers = run_command(parse_cmd + ['HEADERS'], check: true).stdout().split(';')
|
|
|
|
ui_files = run_command(parse_cmd + ['FORMS'], check: true).stdout().split(';')
|
|
|
|
qresources = run_command(parse_cmd + ['RESOURCES'], check: true).stdout().split(';')
|
|
|
|
version = run_command(parse_cmd + ['VERSION'], check: true).stdout()
|
2018-02-09 19:51:30 +00:00
|
|
|
|
2018-07-22 12:10:52 +00:00
|
|
|
sp_dir = join_paths(meson.source_root(), 'subprojects')
|
|
|
|
sp_r2_dir = join_paths(sp_dir, 'radare2')
|
|
|
|
exists_cmd = '__import__("sys").exit(__import__("os").path.exists("@0@"))'.format(sp_r2_dir)
|
|
|
|
if run_command(py3_exe, '-c', exists_cmd).returncode() == 0
|
|
|
|
r2_src_dir = join_paths(meson.source_root(), '..', 'radare2')
|
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
sp_dir = '\\'.join(sp_dir.split('/'))
|
|
|
|
sp_r2_dir = '\\'.join(sp_r2_dir.split('/'))
|
|
|
|
r2_src_dir = '\\'.join(r2_src_dir.split('/'))
|
|
|
|
link_cmd = ['CMD', '/C', 'MKDIR', sp_dir, '&', 'MKLINK', '/D', sp_r2_dir, r2_src_dir]
|
|
|
|
else
|
|
|
|
link_cmd = ['sh', '-c', 'mkdir @0@ ; ln -s @1@ @2@'.format(sp_dir, r2_src_dir, sp_r2_dir)]
|
|
|
|
endif
|
|
|
|
run_command(link_cmd, check: true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
r2 = subproject('radare2')
|
|
|
|
libr2_dep = r2.get_variable('libr2_dep')
|
2018-02-09 19:51:30 +00:00
|
|
|
|
|
|
|
qt5dep = dependency('qt5', modules: qt_modules)
|
|
|
|
|
2018-07-22 12:10:52 +00:00
|
|
|
deps = [libr2_dep, qt5dep]
|
|
|
|
if get_option('enable_jupyter')
|
|
|
|
deps += [dependency('python3')]
|
|
|
|
endif
|
|
|
|
|
2018-02-09 19:51:30 +00:00
|
|
|
moc_files = qt5_mod.preprocess(
|
|
|
|
moc_headers: headers,
|
|
|
|
ui_files: ui_files,
|
2018-03-02 15:42:41 +00:00
|
|
|
qresources: qresources,
|
|
|
|
moc_extra_arguments: feature_define_args
|
2018-02-09 19:51:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cpp = meson.get_compiler('cpp')
|
|
|
|
|
|
|
|
platform_inc = []
|
|
|
|
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')
|
2018-04-05 08:05:00 +00:00
|
|
|
platform_inc = include_directories('../radare2/libr/include/msvc')
|
2018-03-03 07:03:08 +00:00
|
|
|
# Workaround for https://github.com/mesonbuild/meson/issues/2327
|
2018-07-22 12:10:52 +00:00
|
|
|
qt_host_libs = run_command('qmake', '-query', 'QT_HOST_LIBS').stdout().strip()
|
2018-08-26 12:35:18 +00:00
|
|
|
if get_option('buildtype').startswith('debug')
|
|
|
|
qtmain_libname = 'qtmaind.lib'
|
|
|
|
else
|
|
|
|
qtmain_libname = 'qtmain.lib'
|
|
|
|
endif
|
|
|
|
add_project_link_arguments(join_paths(qt_host_libs, qtmain_libname), language: 'cpp')
|
2018-02-09 19:51:30 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
add_project_arguments('-DAPP_VERSION="@0@"'.format(version), language: 'cpp')
|
|
|
|
|
|
|
|
cutter_exe = executable(
|
|
|
|
'Cutter',
|
|
|
|
moc_files,
|
2018-03-03 07:03:08 +00:00
|
|
|
gui_app: true,
|
2018-02-09 19:51:30 +00:00
|
|
|
sources: sources,
|
|
|
|
include_directories: platform_inc,
|
2018-03-03 07:03:08 +00:00
|
|
|
dependencies: deps,
|
2018-02-09 19:51:30 +00:00
|
|
|
)
|