import os
Import("iotbx_mtz_env", "env_etc")

env = iotbx_mtz_env.Clone()
ccp4io_lib = getattr(env_etc, "ccp4io_lib", "cmtz")
  # XXX backward compatibility 2008-09-10
env.Prepend(LIBS=["cctbx", ccp4io_lib]+env_etc.libm)
env.Append(CXXFLAGS=env_etc.ccp4io_defines)
env.Append(SHCXXFLAGS=env_etc.ccp4io_defines)
env_etc.enable_more_warnings(env=env)
if (env_etc.static_libraries): builder = env.StaticLibrary
else:                          builder = env.SharedLibrary
builder(
  target="#lib/iotbx_mtz",
  source=[
    "object.cpp",
    "crystal.cpp",
    "dataset.cpp",
    "column.cpp"])

if (not env_etc.no_boost_python):
  Import("env_iotbx_boost_python_ext")
  env = env_iotbx_boost_python_ext.Clone()
  env.Append(CXXFLAGS=env_etc.ccp4io_defines)
  env.Append(SHCXXFLAGS=env_etc.ccp4io_defines)
  env.Prepend(LIBS=["iotbx_mtz", "cctbx", ccp4io_lib, "scitbx_boost_python"])
  if (os.name == "nt") :
    env.Prepend(LIBS=["Advapi32"])
  env_etc.enable_more_warnings(env=env)
  env.SharedLibrary(
    target="#lib/iotbx_mtz_ext",
    source=[
      "ext.cpp",
      "object_bpl.cpp",
      "crystal_bpl.cpp",
      "dataset_bpl.cpp",
      "column_bpl.cpp",
      "batch_bpl.cpp"])
