import os import sys execfile('compiler.py') # Command Line Options opts = Options('options.py') Export('opts') opts.AddOptions( BoolOption('fah', 'Set to 1 to build library for Folding@Home', 0), ) compiler_add_opts() # Create environment and import external PATH env = Environment(options = opts, ENV = os.environ) Export('env') # Configure conf = Configure(env) Export('conf') # Import subdir build files subsrc = SConscript('protomol/SConscript') # Get options fah = int(env.get('fah', 0)) # Configure compiler compiler_configure() # Include protomol env.Append(CPPPATH = '#') # Generate Help Help(opts.GenerateHelpText(env)) # libprotomol libname = 'protomol' if fah: libname = libname + '-fah' libsrc = [] libs = [] libs.append(libname) if not env.GetOption('clean'): # package.h execfile('package_h.py') # libbip2 if os.environ.has_key('LIBBZ2_HOME'): env.Append(LIBPATH = [os.environ['LIBBZ2_HOME']]) env.Append(CPPPATH = [os.environ['LIBBZ2_HOME'] + '/src']) if not conf.CheckLib('bz2'): print 'libbzip2 not found. Please set LIBBZ2_HOME' Exit(1) # libFAH have_libfah=0 if os.environ.has_key('LIBFAH_HOME'): env.Append(CPPPATH = [os.environ['LIBFAH_HOME']]) env.Append(LIBPATH = [os.environ['LIBFAH_HOME']]) if conf.CheckLib('fah'): env.Append(CPPDEFINES = ['HAVE_LIBFAH']) if env['PLATFORM'] == 'win32': env.Append(LIBS = ['wsock32']) have_libfah=1 # pthreads if env['PLATFORM'] != 'win32' and have_libfah: if not conf.CheckLib('pthread'): print ('Need libpthreads for Folding@Home GUI server on non-win32 ' + 'platforms') Exit(1) # Folding@Home library version if fah: # Look for boost::iostreams if os.environ.has_key('BOOST_HOME'): env.Append(CPPPATH = [os.environ['BOOST_HOME']]) if not conf.CheckCXXHeader('boost/iostreams/device/file.hpp'): print 'boost::iostreams not found. Please set BOOST_HOME' Exit(1) if not conf.CheckCXXHeader('fah/core/ChecksumDevice.h'): print 'Folding@Home needed please set LIBFAH_HOME' Exit(1) env.Append(CPPDEFINES = ['BUILD_FOR_FAH']) env = conf.Finish() if fah: libsrc.append('#/protomol/modules.cpp') # Build for s in subsrc: libsrc.append('#/protomol/' + s) # Build libprotomol env.Library(libname, libsrc) # Build Protomol env.Append(LIBPATH = ['.']) env.Prepend(LIBS = [libname]) src = ['protomol/main.cpp', 'protomol/modules.cpp'] protomol = env.Program('ProtoMol', src) Default(protomol) # Tidy env.Command('tidy', '', 'rm -f config.log $$(find . -name \*~ -o -name \#*)')