#!/usr/bin/env python
# Build the project on AppVeyor.

import os
import shutil
from subprocess import check_call

preprocess_command = ['bash.exe', '-login', 'make_mcell.sh']
check_call(preprocess_command)

mcell_src = "./mcell/src"
files = ["config.h", "version.h", "mdllex.c", "mdlparse.h", "mdlparse.c"]
for f in files:
    shutil.move("./mcell/build/%s" % f, mcell_src)
os.chdir(mcell_src)

build_command = ['gcc.exe', '-mconsole', '-std=c99', '-O3', '-fno-schedule-insns2', '-o', 'mcell.exe', '*.c']
check_call(build_command)
