import sys

Import('env')

prio_env = env.Clone()

test_srcs = [
    "mutest.c",
    "client_test.c",
    "example_test.c",
    "encrypt_test.c",
    "fft_test.c",
    "mpi_test.c",
    "prg_test.c",
    "rand_test.c",
    "serial_test.c",
    "server_test.c",
    "share_test.c",
]

libs = [
  "nss3",
  "mpi",
  "mprio",
  "msgpackc"
]

# Run the mutest script to generate the test harness code
bld = Builder(action = 'ptest/mkmutest ptest/mutest.h $SOURCES | $CC -c -xc -o $TARGET -')
prio_env.Append(BUILDERS = {'MkMutest' : bld})

prio_env.Append(LIBS = libs)

# Enable mpi print
prio_env.Append(CFLAGS = ['-DMP_IOFUNC'])

# Copy the mutest scripts to the build dir
prio_env.Install("mkmutest")
prio_env.Install("mutest.h")

test_objs = prio_env.Object(test_srcs)
test_main = prio_env.MkMutest(test_objs)
prio_env.Program("ptest", [test_main] + test_objs)

