]> git.cworth.org Git - apitrace/blob - SConstruct
Trace opengl32.dll.
[apitrace] / SConstruct
1 #############################################################################
2 #
3 # Copyright 2008 Tungsten Graphics, Inc.
4 #
5 # This program is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published
7 # by the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 #
18 #############################################################################
19
20 import os
21 import os.path
22 import sys
23
24 opts = Options('config.py')
25 opts.Add(BoolOption('debug', 'build debug version', 'no'))
26 opts.Add(PathOption('dxsdk', 'DirectX SDK installation dir', os.environ.get('DXSDK_DIR', 'C:\\DXSDK')))
27 opts.Add(EnumOption('MSVS_VERSION', 'Microsoft Visual Studio version', None, allowed_values=('7.1', '8.0', '9.0')))
28
29 env = Environment(
30     options = opts, 
31     ENV = os.environ)
32 Help(opts.GenerateHelpText(env))
33
34 env.Append(CPPDEFINES = [
35     'WIN32', 
36     '_WINDOWS', 
37     '_UNICODE',
38     'UNICODE',
39     '_CRT_SECURE_NO_DEPRECATE',
40     '_CRT_NON_CONFORMING_SWPRINTFS',
41     'WIN32_LEAN_AND_MEAN',
42     '_USRDLL',
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     '/W4', # warning level
53 ]
54 if env['debug']:
55     cflags += [
56       '/Od', # disable optimizations
57       '/Oy-', # disable frame pointer omission
58     ]
59 else:
60     cflags += [
61       '/Ox', # maximum optimizations
62       '/Os', # favor code space
63     ]
64 cflags += [
65     '/Oi', # enable intrinsic functions
66     '/GF', # enable read-only string pooling
67     '/MT',
68 ]
69 env.Append(CFLAGS = cflags)
70 env.Append(CXXFLAGS = cflags)
71
72 env.Prepend(LIBS = [
73     'kernel32',
74     'user32',
75     'gdi32',
76 ])
77
78 Export('env')
79 SConscript('zlib/SConscript')
80
81 env.Append(CPPPATH = [
82     os.path.join(env['dxsdk'], 'Include'),
83 ])
84
85 conf = Configure(env)
86 has_d3d9 = conf.CheckCHeader('d3d9.h')
87 has_d3d8 = conf.CheckCHeader('d3d8.h')
88 env = conf.Finish()
89
90 if has_d3d8:
91     env.Command(
92         target = 'd3d8.cpp', 
93         source = ['d3d8.py', 'd3d8types.py', 'd3d8caps.py', 'windows.py', 'base.py'],
94         action = 'python $SOURCE > $TARGET',
95     )
96         
97     d3d8 = env.SharedLibrary(
98         target = 'd3d8',
99         source = [
100             'd3d8.def',
101             'd3d8.cpp',
102             'log.cpp',
103         ]
104     )
105
106     env.Default(d3d8)
107
108 if has_d3d9:
109     env.Command(
110         target = 'd3d9.cpp', 
111         source = ['d3d9.py', 'd3d9types.py', 'd3d9caps.py', 'windows.py', 'base.py'],
112         action = 'python $SOURCE > $TARGET',
113     )
114         
115     d3d9 = env.SharedLibrary(
116         target = 'd3d9',
117         source = [
118             'd3d9.def',
119             'd3d9.cpp',
120             'log.cpp',
121         ]
122     )
123
124     env.Default(d3d9)
125
126 env.Command(
127     target = 'opengl32.cpp', 
128     source = ['opengl32.py', 'gl.py', 'windows.py', 'base.py'],
129     action = 'python $SOURCE > $TARGET',
130 )
131     
132 opengl32 = env.SharedLibrary(
133     target = 'opengl32',
134     source = [
135         'opengl32.def',
136         'opengl32.cpp',
137         'log.cpp',
138     ]
139 )
140
141 env.Default(opengl32)
142
143 env.Tool('packaging')
144
145 zip = env.Package(
146     NAME           = 'd3dtrace',
147     VERSION        = '0.2',
148     PACKAGEVERSION = 0,
149     PACKAGETYPE    = 'zip',
150     LICENSE        = 'lgpl',
151     SUMMARY        = 'Tool to trace Direct3D API calls from applications.',
152     SOURCE_URL     = 'http://cgit.freedesktop.org/~jrfonseca/d3dtrace/',
153     source = [
154         'README',
155         'COPYING',
156         'COPYING.LESSER',
157         'd3d8.dll',
158         'd3d9.dll',
159         'd3dtrace.xsl',
160         'd3dtrace.css',
161         'xml2txt.py',
162     ],
163 )
164
165 env.Alias('zip', zip)