1 import nil.directory, nil.environment, sys, os
6 is_windows = nil.environment.is_windows()
9 boost = ARGUMENTS.get('boost')
10 bzip2 = ARGUMENTS.get('bzip2')
11 zlib = ARGUMENTS.get('zlib')
15 print 'This library requires boost (www.boost.org) so you will have to specify the path to the boost library in the scons arguments:'
16 print 'scons boost=<boost directory>'
17 print 'The bzip2 (www.bzip.org) and the zlib (www.zlib.net) components of this library are optional and will require you to specify their locations the same way:'
18 print 'scons boost=<boost directory> bzip2=<bzip2 directory> zlib=<zlib directory>'
27 '_WIN32_WINNT': '0x0501',
28 '_CRT_SECURE_NO_WARNINGS': '1',
29 '_SCL_SECURE_NO_WARNINGS': '1',
30 'BOOST_LIB_DIAGNOSTIC': 1
42 dependencies = [boost, bzip2, zlib]
51 relative_source = os.path.join('..', source)
53 source_files = nil.directory.get_files_by_extension(relative_source, 'cpp')
54 map_path = lambda path: os.path.basename(path)
55 source_files = map(map_path, source_files)
56 if len(source_files) == 0:
57 print 'No targets. CWD: %s' % os.getcwd()
60 print '%d targets:' % len(source_files)
62 for source_file in source_files:
65 for path, file in optional_files:
67 source_files.remove(file)
70 include_directories = ['..'] + filter(lambda path: path != None, dependencies)
72 cpus = int(os.environ.get('NUMBER_OF_PROCESSORS', 1))
74 thread_string = 'thread'
77 print 'Compiling project with %d %s' % (cpus, thread_string)
79 source_files = map(lambda path: os.path.join('..', source, path), source_files)
81 environment = Environment(CPPPATH = include_directories, CPPDEFINES = defines, CCFLAGS = flags)
82 environment.Append(LINKFLAGS = linker_flags)
83 environment.SetOption('num_jobs', cpus)
84 environment.StaticLibrary(library, source_files)