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

binary = AMXX.Program(builder, 'amxxpc')

binary.compiler.defines += [
  'AMX_ANSIONLY',
]

if builder.compiler.like('gcc'):
  binary.compiler.cxxflags.remove('-fno-exceptions')

if builder.target_platform == 'linux':
  binary.compiler.postlink += [
    '-ldl',
    binary.Dep(AMXX.stdcxx_path),
  ]
elif builder.target_platform == 'windows':
  binary.compiler.defines += ['_MBCS']
  binary.compiler.linkflags.remove('/SUBSYSTEM:WINDOWS')
  binary.compiler.linkflags.append('/SUBSYSTEM:CONSOLE')

binary.sources = [
  'amx.cpp',
  'amxxpc.cpp',
  'Binary.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',
]

if builder.target_platform == 'windows':
  binary.sources += ['amxxpc1.rc']

AMXX.amxxpc = builder.Add(binary)