Filthy newline drama?
[craw.git] / SConscript
blobf35a0050ecd8456d1f624059b134631a2c8407a5
1 import nil.directory, sys, os
3 module = 'craw'
4 boost = ARGUMENTS.get('boost')
5 boost_lib = ARGUMENTS.get('boost_lib')
6 ail = ARGUMENTS.get('ail')
7 ail_lib = ARGUMENTS.get('ail_lib')
8 python = ARGUMENTS.get('python')
10 dependencies = [boost, ail, boost_lib, ail_lib, python]
12 if len(filter(lambda x: x == None, dependencies)) > 0:
13         print 'This module requires boost (http://www.boost.org/), ail (http://repo.or.cz/w/ail.git) and Python 2.6 (32-bit version, http://www.python.org/) so you will have to specify the paths in the scons arguments:'
14         print 'scons boost=<boost header directory> boost_lib=<boost binary directory> ail=<ail header directory> ail_lib=<path to ail.lib> python=<path to your Python installation>'
15         sys.exit(1)
16         
17 python_library = os.path.join(python, 'libs', 'python26.lib')
18 python_include = os.path.join(python, 'include')
19         
20 include_directories = [boost, ail, python_include]
22 defines = {
23         '_CRT_SECURE_NO_WARNINGS': 1,
24         'BOOST_LIB_DIAGNOSTIC': 1
27 """
28 flags = [
29         '/O2',
30         '/Oi',
31         '/GL',
32         #'/FD',
33         '/MD',
34         '/Gy',
35         '/W3',
36         '/nologo',
37         '/c',
38         #'/Zi',
39         '/EHsc'
41 """
43 flags = [
44         '/EHsc'
47 relative_source_directory = os.path.join('..', module)
49 source_files = map(lambda path: os.path.basename(path), nil.directory.get_files_by_extension(relative_source_directory, 'cpp'))
51 include_directories += [module]
53 cpus = int(os.environ.get('NUMBER_OF_PROCESSORS', 2))
55 thread_string = 'thread'
56 if cpus > 1:
57         thread_string += 's'
58 print 'Compiling project with %d %s' % (cpus, thread_string)
60 environment = Environment(CPPPATH = include_directories, CCFLAGS = flags, LIBPATH = boost_lib, LIBS = [ail_lib, python_library, 'user32.lib', 'kernel32.lib'], CPPDEFINES = defines)
61 environment.SetOption('num_jobs', cpus)
62 environment.SharedLibrary(module, source_files)