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

def configure_library(name, linux_defines):
  binary = MMS.Library(builder, name)
  binary.compiler.cxxincludes += [os.path.join(builder.sourcePath, 'core', 'sourcehook')]
  binary.sources += [
    'loader.cpp',
    'gamedll.cpp',
    'serverplugin.cpp',
    'utility.cpp',
  ]

  if builder.target.platform == 'linux':
    binary.compiler.defines += linux_defines

  nodes = builder.Add(binary)
  MMS.binaries += [nodes]

libname = 'server'
if builder.target.platform == 'linux' and builder.target.arch == 'x86_64':
  libname = 'libserver'

configure_library(libname, ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'])

if builder.target.platform == 'linux' and builder.target.arch == 'x86':
  configure_library('server_i486', ['LIB_PREFIX=""', 'LIB_SUFFIX="_i486.so"'])
