]> git.cworth.org Git - apitrace/blob - SConstruct
9313f4bb2e2ee7c837eccd28ec7f2fc310df7515
[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     'winspool',
74     'comdlg32',
75     'advapi32',
76     'shell32',
77     'ole32',
78     'oleaut32',
79     'uuid',
80     'odbc32',
81     'odbccp32',
82 ])
83
84 env.Append(CPPPATH = [
85     os.path.join(env['dxsdk'], 'Include'),
86 ])
87
88 Export('env')
89
90 SConscript('d3d8/SConscript')
91 SConscript('d3d9/SConscript')