]> git.cworth.org Git - apitrace/blob - SConstruct
Autogenerate d3d8.dll wrapper.
[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
86
87 env.Command(
88     target = 'd3d8.cpp', 
89     source = ['d3d8.py', 'd3d8types.py', 'd3d8caps.py', 'windows.py', 'base.py'],
90     action = 'python $SOURCE > $TARGET',
91 )
92     
93
94 env.SharedLibrary(
95     target = 'd3d8.dll',
96     source = [
97         'd3d8.def',
98         'd3d8.cpp',
99     ]
100 )
101
102 SConscript([
103     'd3d9/SConscript',
104 ])