]> git.cworth.org Git - apitrace/blob - SConstruct
Have logging methods as regular functions.
[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     '_USRDLL',
44 ])
45
46 if env['debug']:
47     env.Append(CPPDEFINES = ['_DEBUG'])
48 else:
49     env.Append(CPPDEFINES = ['NDEBUG'])
50 env['PDB'] = '${TARGET.base}.pdb'
51
52 cflags = [
53     '/W4', # warning level
54 ]
55 if env['debug']:
56     cflags += [
57       '/Od', # disable optimizations
58       '/Oy-', # disable frame pointer omission
59     ]
60 else:
61     cflags += [
62       '/Ox', # maximum optimizations
63       '/Os', # favor code space
64     ]
65 cflags += [
66     '/Oi', # enable intrinsic functions
67     '/GF', # enable read-only string pooling
68     '/MT',
69 ]
70 env.Append(CFLAGS = cflags)
71 env.Append(CXXFLAGS = cflags)
72
73 env.Prepend(LIBS = [
74     'kernel32',
75     'user32',
76     'gdi32',
77     'comdlg32',
78     'advapi32',
79     'shell32',
80 ])
81
82 env.Append(CPPPATH = [
83     os.path.join(env['dxsdk'], 'Include'),
84 ])
85
86 env.Command(
87     target = 'd3d8.cpp', 
88     source = ['d3d8.py', 'd3d8types.py', 'd3d8caps.py', 'windows.py', 'base.py'],
89     action = 'python $SOURCE > $TARGET',
90 )
91     
92 d3d8 = env.SharedLibrary(
93     target = 'd3d8',
94     source = [
95         'd3d8.def',
96         'd3d8.cpp',
97         'log.cpp',
98     ]
99 )
100
101 env.Default(d3d8)
102
103 env.Command(
104     target = 'd3d9.cpp', 
105     source = ['d3d9.py', 'd3d9types.py', 'd3d9caps.py', 'windows.py', 'base.py'],
106     action = 'python $SOURCE > $TARGET',
107 )
108     
109 d3d9 = env.SharedLibrary(
110     target = 'd3d9',
111     source = [
112         'd3d9.def',
113         'd3d9.cpp',
114         'log.cpp',
115     ]
116 )
117
118 env.Default(d3d9)
119
120 env.Tool('packaging')
121
122 zip = env.Package(
123     NAME           = 'd3dtrace',
124     VERSION        = '0.1',
125     PACKAGEVERSION = 0,
126     PACKAGETYPE    = 'zip',
127     LICENSE        = 'lgpl',
128     SUMMARY        = 'Tool to trace Direct3D API calls from applications.',
129     SOURCE_URL     = 'http://cgit.freedesktop.org/~jrfonseca/d3dtrace/',
130     source = [
131         'README',
132         'COPYING',
133         'COPYING.LESSER',
134         'd3d8.dll',
135         'd3dtrace.xsl',
136         'd3dtrace.css',
137         'd3dtrace-txt.xsl',
138     ],
139 )
140
141 env.Alias('zip', zip)