core_plugins_list = [
  'java',
  'dex',
]

core_plugins = {
  'base_name': 'rz_core',
  'base_struct': 'RzCorePlugin',
  'list': core_plugins_list,
}

subdir('cmd_descs')

rz_core_sources = [
  'agraph.c',
  'analysis_objc.c',
  'analysis_tp.c',
  'basefind.c',
  'caddr.c',
  'cagraph.c',
  'canalysis.c',
  'cannotated_code.c',
  'carch.c',
  'carg.c',
  'casm.c',
  'cautocmpl.c',
  'cbin.c',
  'cbounds.c',
  'cconfig.c',
  'ccrypto.c',
  'cdebug.c',
  'cesil.c',
  'cfile.c',
  'cflag.c',
  'cgraph.c',
  'chash.c',
  'cil.c',
  'cio.c',
  'clang.c',
  'cmark.c',
  'cmath.c',
  'cmeta.c',
  'cmp.c',
  'core.c',
  'cparser.c',
  'cpdb.c',
  'cplugin.c',
  'cprint.c',
  'creg.c',
  'csearch.c',
  'csign.c',
  'csyscall.c',
  'ctypes.c',
  'cvfile.c',
  'devirtualize_cxx.c',
  'devirtualize_objc.c',
  'disasm.c',
  'fortune.c',
  'golang.c',
  'hack.c',
  'heap_glibc.c',
  'heap_jemalloc.c',
  'heap_windows.c',
  'libs.c',
  'project.c',
  'project_migrate.c',
  'gadget.c',
  'rtr.c',
  #'rtr_http.c',
  #'rtr_shell.c',
  'seek.c',
  'serialize_core.c',
  'task.c',
  'yank.c',
  'p/core_dex.c',
  'p/core_java.c',
  cmd_descs_ch,
  'cmd/cmd.c',
  'cmd/cmd_alias.c',
  #'cmd/cmd_analysis.c',
  'cmd/cmd_api.c',
  'cmd/cmd_block.c',
  'cmd/cmd_mark.c',
  'cmd/cmd_cmp.c',
  #'cmd/cmd_debug.c',
  'cmd/cmd_egg.c',
  'cmd/cmd_eval.c',
  'cmd/cmd_flag.c',
  'cmd/cmd_flirt.c',
  'cmd/cmd_hash.c',
  'cmd/cmd_help.c',
  'cmd/cmd_history.c',
  'cmd/cmd_info.c',
  'cmd/cmd_interactive.c',
  'cmd/cmd_interactive_panel.c',
  'cmd/cmd_interpret.c',
  'cmd/cmd_macro.c',
  #'cmd/cmd_magic.c',
  'cmd/cmd_meta.c',
  'cmd/cmd_open.c',
  'cmd/cmd_plugins.c',
  #'cmd/cmd_print.c',
  'cmd/cmd_project.c',
  'cmd/cmd_query.c',
  'cmd/cmd_quit.c',
  'cmd/cmd_remote.c',
  'cmd/cmd_resize.c',
  #'cmd/cmd_search.c',
  #'cmd/cmd_search_rop.c',
  'cmd/cmd_seek.c',
  'cmd/cmd_shell.c',
  'cmd/cmd_system.c',
  'cmd/cmd_tasks.c',
  'cmd/cmd_type.c',
  'cmd/cmd_write.c',
  'cmd/cmd_yank.c',
  'cmd/cmd_regs.c',
  'cmd/cmd_windows_heap.c',
  'tui/biteditor.c',
  'tui/classes.c',
  'tui/colors.c',
  'tui/comments.c',
  'tui/config.c',
  'tui/define.c',
  'tui/esil.c',
  'tui/flags.c',
  'tui/hud.c',
  'tui/modes.c',
  'tui/visual.c',
  'tui/vmenus.c',
  'tui/vmenus_graph.c',
  'tui/vasm.c',
  'tui/vmarks.c',
  'tui/panels.c',
  'tui/tabs.c',
]

rz_core_inc = ['.']
if host_machine.system() == 'windows'
  rz_core_sources += 'windows_heap_live_debug.c'
endif
rz_core_inc = [platform_inc, 'cmd_descs']

shell_parser_dep = dependency('rizin-shell-parser')

rz_core_deps = [
  rz_util_dep,
  rz_demangler_dep,
  rz_diff_dep,
  rz_magic_dep,
  rz_socket_dep,
  rz_flag_dep,
  rz_cons_dep,
  rz_lang_dep,
  rz_hash_dep,
  rz_crypto_dep,
  rz_io_dep,
  rz_reg_dep,
  rz_syscall_dep,
  rz_egg_dep,
  rz_search_dep,
  rz_sign_dep,
  rz_il_dep,
  rz_arch_dep,
  rz_type_dep,
  rz_debug_dep,
  rz_config_dep,
  rz_bin_dep,
  rz_mark_dep,
  platform_deps,
  dependency('rzgdb'),
  rzheap_dep,
  shell_parser_dep,
  lrt,
  mth,
]

rz_core = library('rz_core', rz_core_sources,
  include_directories: rz_core_inc,
  dependencies: rz_core_deps,
  install: true,
  implicit_include_directories: false,
  install_rpath: rpath_lib,
  soversion: rizin_libversion,
  version: rizin_version,
  name_suffix: lib_name_suffix,
  name_prefix: lib_name_prefix,
)

rz_core_dep = declare_dependency(link_with: rz_core,
                                include_directories: rz_core_inc)
meson.override_dependency('rz_core', rz_core_dep)

modules += { 'rz_core': {
    'target': rz_core,
    'dependencies': [
      'rz_magic',
      'rz_util',
      'rz_demangler',
      'rz_diff',
      'rz_reg',
      'rz_syscall',
      'rz_search',
      'rz_cons',
      'rz_socket',
      'rz_type',
      'rz_io',
      'rz_lang',
      'rz_hash',
      'rz_flag',
      'rz_mark',
      'rz_egg',
      'rz_debug',
      'rz_crypto',
      'rz_config',
      'rz_bin',
      'rz_arch',
      'rz_sign',
      'rz_il'
    ],
    'plugins': [core_plugins]
}}
