import libtbx.load_env
import os
Import("env_etc")

env_etc.cudatbx_dist = libtbx.env.dist_path("cudatbx")
env_etc.cudatbx_include = os.path.dirname(env_etc.cudatbx_dist)

if (not env_etc.no_boost_python):
  Import("env_boost_python_ext")
  env_bpl = env_boost_python_ext.Copy()
  env_etc.include_registry.append(
    env=env_bpl,
    paths=[env_etc.cudatbx_include])

if (env_etc.enable_cuda):
  env_bpl.cudaSharedLibrary(
    target = "#lib/cudatbx_ext",
    source = ['cuda_utilities.cu',
              'cudatbx_ext.cpp',
              ])

  env_bpl.cudaSharedLibrary(
    target = "#lib/cudatbx_special_functions_ext",
    source = ['math/special_functions/spherical_bessel_jn.cu',
              'math/special_functions/special_functions_ext.cpp',
              ])

  env_bpl.Prepend(LIBS=["cufft"])
  env_bpl.cudaSharedLibrary(
    target = "#lib/cudatbx_cufft_ext",
    source = ['cufft/ext.cpp',
	      'cufft/ext_double.cpp',
	      'cufft/ext_float.cpp',
	     ])

  env_bpl.Prepend(LIBS=["cctbx"])
  env_bpl.cudaSharedLibrary(
    target = "#lib/cudatbx_scattering_ext",
    source = ['scattering/scattering_ext.cpp',
              'scattering/direct_summation.cu',
              ])
