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

for sdk_name in MMS.sdks:
  for cxx in MMS.all_targets:
    sdk = MMS.sdks[sdk_name]

    if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
      continue

    name = 'metamod.' + sdk.ext
    binary = MMS.HL2Library(builder, cxx, name, sdk)

    binary.sources += [
      'metamod.cpp',
      'metamod_console.cpp',
      'metamod_oslink.cpp',
      'metamod_plugins.cpp',
      'metamod_util.cpp',
      'provider/console.cpp',
      'provider/provider_ep2.cpp',
      'sourcehook/sourcehook.cpp',
      'sourcehook/sourcehook_impl_chookidman.cpp',
      'sourcehook/sourcehook_impl_chookmaninfo.cpp',
      'sourcehook/sourcehook_impl_cproto.cpp',
      'sourcehook/sourcehook_impl_cvfnptr.cpp',
      'gamedll_bridge.cpp',
      'vsp_bridge.cpp'
    ]

    # Source2 hack. TODO: check this more deterministically, "are we doing an x64 build?"
    if binary.compiler.target.arch == 'x86':
      binary.sources += ['sourcehook/sourcehook_hookmangen.cpp']
    nodes = builder.Add(binary)
    MMS.binaries += [nodes]
