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

builder.SetBuildFolder('libjansson')

rvalue = {}
for cxx in builder.targets:
  binary = Extension.StaticLibrary(builder, cxx, 'jansson')
  binary.compiler.includes += [
    os.path.join(builder.sourcePath, 'jansson', 'include'),
    os.path.join(builder.sourcePath, 'jansson', 'private_include'),
    os.path.join(builder.sourcePath, 'jansson', 'src'),
  ]
  binary.compiler.defines += ['HAVE_CONFIG_H']

  if binary.compiler.family == 'clang':
    # https://llvm.org/bugs/show_bug.cgi?id=16428
    binary.compiler.cflags += ['-Wno-attributes']

  # Defined as JANSSON_SRC in jansson/CMakeLists.txt
  binary.sources += [
    'dump.c',
    'error.c',
    'hashtable.c',
    'hashtable_seed.c',
    'load.c',
    'memory.c',
    'pack_unpack.c',
    'strbuffer.c',
    'strconv.c',
    'utf.c',
    'value.c',
  ]

  rvalue[binary.compiler.target.arch] = builder.Add(binary)
