]> git.cworth.org Git - apitrace/blob - SConstruct
Allow to choose the MSVS version.
[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 env.Command(
86     target = 'd3d8.cpp', 
87     source = ['d3d8.py', 'd3d8types.py', 'd3d8caps.py', 'windows.py', 'base.py'],
88     action = 'python $SOURCE > $TARGET',
89 )
90     
91 d3d8 = env.SharedLibrary(
92     target = 'd3d8',
93     source = [
94         'd3d8.def',
95         'd3d8.cpp',
96         'log.cpp',
97     ]
98 )
99
100 env.Default(d3d8)
101
102 env.Command(
103     target = 'd3d9.cpp', 
104     source = ['d3d9.py', 'd3d9types.py', 'd3d9caps.py', 'windows.py', 'base.py'],
105     action = 'python $SOURCE > $TARGET',
106 )
107     
108 d3d9 = env.SharedLibrary(
109     target = 'd3d9',
110     source = [
111         'd3d9.def',
112         'd3d9.cpp',
113         'log.cpp',
114     ]
115 )
116
117 env.Default(d3d9)
118
119 env.Tool('packaging')
120
121 zip = env.Package(
122     NAME           = 'd3dtrace',
123     VERSION        = '0.2',
124     PACKAGEVERSION = 0,
125     PACKAGETYPE    = 'zip',
126     LICENSE        = 'lgpl',
127     SUMMARY        = 'Tool to trace Direct3D API calls from applications.',
128     SOURCE_URL     = 'http://cgit.freedesktop.org/~jrfonseca/d3dtrace/',
129     source = [
130         'README',
131         'COPYING',
132         'COPYING.LESSER',
133         'd3d8.dll',
134         'd3d9.dll',
135         'd3dtrace.xsl',
136         'd3dtrace.css',
137         'xml2txt.py',
138     ],
139 )
140
141 env.Alias('zip', zip)