# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os

binary = SM.Library(builder, 'sourcepawn.jit.x86')
binary.compiler.includes += [
  os.path.join(SM.mms_root, 'core', 'sourcehook'),
  os.path.join(builder.sourcePath, 'sourcepawn', 'jit'),
  os.path.join(builder.sourcePath, 'sourcepawn', 'jit', 'x86'),
  os.path.join(builder.sourcePath, 'public'),
  os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
  os.path.join(builder.sourcePath, 'public', 'amtl'),
  os.path.join(builder.sourcePath, 'public', 'jit'),
  os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
  os.path.join(builder.sourcePath, 'knight', 'shared'),
]

if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
  binary.compiler.cxxflags += ['-fno-rtti']
elif binary.compiler.vendor == 'msvc':
  binary.compiler.cxxflags += ['/GR-']

if builder.target_platform == 'linux':
  binary.compiler.postlink += ['-lpthread', '-lrt']

binary.sources += [
  'BaseRuntime.cpp',
  'engine2.cpp',
  'dll_exports.cpp',
  'jit_function.cpp',
  'sp_vm_basecontext.cpp',
  'sp_vm_engine.cpp',
  'sp_vm_function.cpp',
  'opcodes.cpp',
  'interpreter.cpp',
  'watchdog_timer.cpp',
  'x86/jit_x86.cpp',
  'zlib/adler32.c',
  'zlib/compress.c',
  'zlib/crc32.c',
  'zlib/deflate.c',
  'zlib/gzio.c',
  'zlib/infback.c',
  'zlib/inffast.c',
  'zlib/inflate.c',
  'zlib/inftrees.c',
  'zlib/trees.c',
  'zlib/uncompr.c',
  'zlib/zutil.c',
  'md5/md5.cpp',
  '../../knight/shared/KeCodeAllocator.cpp',
  '../../public/jit/x86/assembler-x86.cpp',
]
SM.binaries += [builder.Add(binary)]