]> git.cworth.org Git - apitrace/blob - SConstruct
aeeb3f691f13222f5231c8dc6ffdb9cccc88b690
[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 ])
43
44 if env['debug']:
45     env.Append(CPPDEFINES = ['_DEBUG'])
46 else:
47     env.Append(CPPDEFINES = ['NDEBUG'])
48 #env['PDB'] = '${TARGET.base}.pdb'
49
50 cflags = [
51         '/W3', # warning level
52 ]
53 if env['debug']:
54         cflags += [
55           '/Od', # disable optimizations
56           '/Oi', # enable intrinsic functions
57           '/Oy-', # disable frame pointer omission
58         ]
59 else:
60         cflags += [
61           '/Ox', # maximum optimizations
62           '/Oi', # enable intrinsic functions
63           '/Os', # favor code space
64         ]
65 env.Append(CFLAGS = cflags)
66 env.Append(CXXFLAGS = cflags)
67
68 env.Prepend(LIBS = [
69     'kernel32',
70     'user32',
71     'gdi32',
72     'winspool',
73     'comdlg32',
74     'advapi32',
75     'shell32',
76     'ole32',
77     'oleaut32',
78     'uuid',
79     'odbc32',
80     'odbccp32',
81 ])
82
83 env.Append(CPPPATH = [
84     os.path.join(env['dxsdk'], 'Include'),
85 ])
86
87 Export('env')
88
89 SConscript('d3d8/SConscript')
90 SConscript('d3d9/SConscript')