# Dependencies installed via wrap
inih_proj = subproject('inih', default_options: ['default_library=static', 'b_sanitize=none', 'utf-8_bom=true', 'multi-line_entries=true', 'report_line_numbers=true'])
inih_dep = inih_proj.get_variable('inih_dep')
lz4_proj = subproject('lz4', default_options: ['default_library=static', 'b_sanitize=none'])
lz4_dep = lz4_proj.get_variable('liblz4_dep')
xxhash_proj = subproject('xxhash', default_options: ['default_library=static', 'b_sanitize=none'])
xxhash_dep = xxhash_proj.get_variable('xxhash_dep')

runtime_deps = [thread_dep, m_dep, inih_dep, lz4_dep, xxhash_dep]

if host_machine.system() == 'linux'
  rt_dep = declare_dependency(link_args: ['-lrt'])
  runtime_deps += rt_dep
endif

runtime_incdirs = contrib_incdir
runtime_lib = library('rt',
  # Project Sources
  'atomics.h',
  'buffer_manager.h',
  'compression.h',
  'config.h',
  'cross_sal.h',
  'ds.h',
  'dynamic_libs.h',
  'file_tab.h',
  'fsutils.h',
  'handles.h',
  'hashing.h',
  'jobs.h',
  'mem_arena.h',
  'resources.h',
  'rt_aio.h',
  'runtime.h',
  'string_storage.h',
  'threading.h',
  'threading_helpers.hpp',
  'timing.h',

  'assert.c',
  'buffer_manager.c',
  'compression.c',
  'config.c',
  'ds_hashtable.c',
  'ds_minheap.c',
  'ds_queue.c',
  'dynamic_libs.c',
  'error_report.c',
  'file_tab.c',
  'fsutils.c',
  'hashing.c',
  'init.c',
  'jobs.c',
  'mem_arena.c',
  'resource_manager.c',
  'rt_aio.c',
  'sprint.c',
  'string_storage.c',
  'text.c',
  'threading_cond.c',
  'threading_mutex.c',
  'threading_rwlock.c',
  'threading_semaphore.c',
  'threading_thread.c',
  'timing.c',

  dependencies : runtime_deps,
  include_directories : [engine_incdir, runtime_incdirs],
  c_pch : 'pch/rt_pch.h',
  install : true)

engine_libs += runtime_lib
engine_lib_paths += runtime_lib.full_path()
