]> git.cworth.org Git - apitrace/blob - SConstruct
Basic logging mechanism.
[apitrace] / SConstruct
1 #######################################################################
2 # Top-level SConstruct
3 #
4 # For example, invoke scons as 
5 #
6 #   scons debug=1
7 #
8 # to set configuration variables. Or you can write those options to a file
9 # named config.py:
10 #
11 #   # config.py
12 #   debug=1
13 #   dxsdk='C:\\DXSDK'
14
15 # Invoke
16 #
17 #   scons -h
18 #
19 # to get the full list of options. See scons manpage for more info.
20 #  
21
22 import os
23 import os.path
24 import sys
25
26 opts = Options('config.py')
27 opts.Add(BoolOption('debug', 'build debug version', 'no'))
28 opts.Add(PathOption('dxsdk', 'DirectX SDK installation dir', os.environ.get('DXSDK_DIR', 'C:\\DXSDK')))
29
30 env = Environment(
31     options = opts, 
32     ENV = os.environ)
33 Help(opts.GenerateHelpText(env))
34
35 env.Append(CPPDEFINES = [
36     'WIN32', 
37     '_WINDOWS', 
38     '_UNICODE',
39     'UNICODE',
40     '_CRT_SECURE_NO_DEPRECATE',
41     '_CRT_NON_CONFORMING_SWPRINTFS',
42     'WIN32_LEAN_AND_MEAN',
43 ])
44
45 if env['debug']:
46     env.Append(CPPDEFINES = ['_DEBUG'])
47 else:
48     env.Append(CPPDEFINES = ['NDEBUG'])
49 #env['PDB'] = '${TARGET.base}.pdb'
50
51 cflags = [
52     '/W3', # warning level
53 ]
54 if env['debug']:
55     cflags += [
56       '/Od', # disable optimizations
57       '/Oi', # enable intrinsic functions
58       '/Oy-', # disable frame pointer omission
59     ]
60 else:
61     cflags += [
62       '/Ox', # maximum optimizations
63       '/Oi', # enable intrinsic functions
64       '/Os', # favor code space
65     ]
66 env.Append(CFLAGS = cflags)
67 env.Append(CXXFLAGS = cflags)
68
69 env.Prepend(LIBS = [
70     'kernel32',
71     'user32',
72     'gdi32',
73     'comdlg32',
74     'advapi32',
75     'shell32',
76 ])
77
78 env.Append(CPPPATH = [
79     os.path.join(env['dxsdk'], 'Include'),
80     '#common',
81 ])
82
83 Export('env')
84
85 SConscript([
86     'common/SConscript',
87     'd3d8/SConscript',
88     'd3d9/SConscript',
89 ])