2 # gen_dsp.py -- generate Microsoft Visual C++ 6 projects
14 class Generator(gen_win
.WinGeneratorBase
):
15 "Generate a Microsoft Visual C++ 6 project"
17 def __init__(self
, fname
, verfname
, options
):
18 gen_win
.WinGeneratorBase
.__init
__(self
, fname
, verfname
, options
,
24 def write_project(self
, target
, fname
):
25 "Write a Project (.dsp)"
27 if isinstance(target
, gen_base
.TargetExe
):
28 targtype
= "Win32 (x86) Console Application"
30 elif isinstance(target
, gen_base
.TargetJava
):
31 targtype
= "Win32 (x86) Generic Project"
33 elif isinstance(target
, gen_base
.TargetLib
):
34 if target
.msvc_static
:
35 targtype
= "Win32 (x86) Static Library"
38 targtype
= "Win32 (x86) Dynamic-Link Library"
40 elif isinstance(target
, gen_base
.TargetProject
):
42 targtype
= "Win32 (x86) External Target"
45 targtype
= "Win32 (x86) Generic Project"
48 raise gen_base
.GenError("Cannot create project for %s" % target
.name
)
50 target
.output_name
= self
.get_output_name(target
)
51 target
.output_dir
= self
.get_output_dir(target
)
52 target
.intermediate_dir
= self
.get_intermediate_dir(target
)
53 target
.output_pdb
= self
.get_output_pdb(target
)
55 configs
= self
.get_configs(target
)
57 sources
= self
.get_proj_sources(True, target
)
61 'target_type' : targtype
,
62 'target_number' : targval
,
63 'rootpath' : self
.rootpath
,
64 'platforms' : self
.platforms
,
66 'includes' : self
.get_win_includes(target
),
68 'default_platform' : self
.platforms
[0],
69 'default_config' : configs
[0].name
,
70 'is_exe' : ezt
.boolean(isinstance(target
, gen_base
.TargetExe
)),
71 'is_external' : ezt
.boolean((isinstance(target
, gen_base
.TargetProject
)
72 or isinstance(target
, gen_base
.TargetI18N
))
74 'is_utility' : ezt
.boolean(isinstance(target
,
75 gen_base
.TargetProject
)),
76 'is_dll' : ezt
.boolean(isinstance(target
, gen_base
.TargetLib
)
77 and not target
.msvc_static
),
78 'instrument_apr_pools' : self
.instrument_apr_pools
,
79 'instrument_purify_quantify' : self
.instrument_purify_quantify
,
82 self
.write_with_template(fname
, 'msvc_dsp.ezt', data
)
85 "Write a Workspace (.dsw)"
87 self
.write_zlib_project_file('zlib.dsp')
88 self
.write_neon_project_file('neon.dsp')
89 self
.write_serf_project_file('serf.dsp')
90 install_targets
= self
.get_install_targets()
94 self
.gen_proj_names(install_targets
)
96 # Traverse the targets and generate the project files
97 for target
in install_targets
:
99 fname
= self
.get_external_project(target
, 'dsp')
101 fname
= os
.path
.join(self
.projfilesdir
,
102 "%s_msvc.dsp" % target
.proj_name
)
103 self
.write_project(target
, fname
)
106 fname
= '"%s"' % fname
109 if not isinstance(target
, gen_base
.TargetI18N
):
110 depends
= self
.adjust_win_depends(target
, name
)
117 dep_names
.append(dep
.proj_name
)
120 gen_win
.ProjectItem(name
=target
.proj_name
,
121 dsp
=string
.replace(fname
, os
.sep
, '\\'),
124 targets
.sort(lambda x
, y
: cmp(x
.name
, y
.name
))
129 self
.write_with_template('subversion_msvc.dsw', 'msvc_dsw.ezt', data
)
132 # compatibility with older Pythons: