]> git.saurik.com Git - wxWidgets.git/blob - distrib/msw/tmake/vc6app.t
template for VC++ dsp for building wxUniv static lib
[wxWidgets.git] / distrib / msw / tmake / vc6app.t
1 #!#############################################################################
2 #! File: vc6app.t
3 #! Purpose: tmake template file from which the VC++ 6.0 project file for
4 #! building wxWindows applications are generated by running
5 #! tmake -t vc6lib wxwin.pro -o wxvc.dsp
6 #! you may append CONFIG+= to the end of the line, i.e.
7 #! tmake -t vc6lib wxwin.pro -o wxvc.dsp CONFIG+=unicode
8 #! tmake -t vc6lib wxwin.pro -o wxvc.dsp CONFIG+=dll
9 #! Author: Vadim Zeitlin
10 #! Created: 29.09.01
11 #! Version: $Id$
12 #!#############################################################################
13 #${
14 #! what kind of app are we building - this is used as prefix for the build
15 #! output dir
16 $KIND="";
17
18 if ( Config("wx") ) {
19 Project('CONFIG += windows');
20 }
21 if ( Config("wxbase") || Config("wxuniv") ) {
22 Project('CONFIG += wx');
23 }
24 if ( Config("wx") ) {
25 if ( Config("wxnodir") ) {
26 $WXDIR = "..\\..";
27 }
28 else {
29 #! VC 6.0 supports env vars in include path
30 #! $WXDIR = $ENV{'WX'};
31 if ( $ENV{'wx'} ) {
32 $WXDIR = "\$(wx)";
33 }
34 else {
35 $WXDIR = "\$(WXWIN)";
36 }
37 }
38
39 AddIncludePath($WXDIR . "\\include");
40 }
41
42 if ( Config("unicode") ) {
43 $UNICODE="Unicode";
44 $UNICODE_SUFFIX="u";
45 $UNICODE_FLAGS="/D _UNICODE /D UNICODE ";
46
47 $project{"TARGET"} .= "Unicode";
48 $project{"MAKEFILE"} .= "Unicode";
49 }
50 else {
51 $UNICODE="";
52 $UNICODE_SUFFIX="";
53 $UNICODE_FLAGS=" ";
54 }
55
56 if ( Config("wx") ) {
57 if ( Config("wxbase") ) {
58 $KIND="Base";
59 $DLL_OR_LIB="wxbase";
60 }
61 elsif ( Config("wxuniv") ) {
62 $KIND="Univ";
63 $DLL_OR_LIB="wxuniv";
64 }
65 else {
66 $DLL_OR_LIB="wxmsw"
67 }
68
69 if ( Config("dll") ) {
70 $DLL="Dll";
71
72 $DLL_OR_LIB .= "232";
73 $DLL_FLAGS="/D WXUSINGDLL ";
74 $EXTRA_LIBS="";
75
76 $project{"TARGET"} .= "Dll";
77 $project{"MAKEFILE"} .= "Dll";
78 }
79 else {
80 $DLL="";
81 $DLL_FLAGS=" ";
82 #! actually this should depend on the contents of setup.h!
83 $EXTRA_LIBS="zlib regex";
84 if ( !Config("wxbase") ) {
85 $EXTRA_LIBS.=" png jpeg tiff";
86 }
87 }
88 }
89
90 $DEBUG_SUFFIX="d";
91
92 #! let's be smart: if no extension is given, add .lib (this allows for
93 #! LIBS=libname in project files which map either on -l libname.lib under
94 #! Windows or on -llibname under Unix).
95 @libs = split(/\s+/, Project('LIBS'));
96 foreach $lib (@libs) {
97 if ( $lib !~ "\.lib\$" ) { $lib .= ".lib"; }
98 Project('TMAKE_LIBS *= ' . $lib);
99 }
100
101 if ( Config("windows") ) {
102 $project{"VC_PROJ_TYPE"} = 'Win32 (x86) Application';
103 $project{"VC_PROJ_CODE"} = '0x0101';
104 $vc_base_libs = 'kernel32.lib user32.lib gdi32.lib winspool.lib ' .
105 'comdlg32.lib advapi32.lib shell32.lib ole32.lib ' .
106 'oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ';
107 if ( Config("wx") ) {
108 $vc_base_libs .= "comctl32.lib rpcrt4.lib wsock32.lib ";
109
110 $vc_link_release = "$WXDIR\\lib\\$DLL_OR_LIB$UNICODE_SUFFIX.lib ";
111 $vc_link_debug = "$WXDIR\\lib\\$DLL_OR_LIB$UNICODE_SUFFIX$DEBUG_SUFFIX.lib ";
112 foreach ( split(/ /, $EXTRA_LIBS) ) {
113 $vc_link_release .= "$WXDIR\\lib\\$_.lib ";
114 $vc_link_debug .= "$WXDIR\\lib\\$_" . "d.lib ";
115 }
116 }
117 $vc_link_release .= '/nologo /subsystem:windows /machine:I386';
118 $vc_link_debug .= '/nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept';
119
120 $vc_cpp_def_common = '/D "WIN32" /D "_WINDOWS" ' . $UNICODE_FLAGS . $DLL_FLAGS;
121 $vc_cpp_def_release = '/D "NDEBUG" ' . $vc_cpp_def_common;
122 $vc_cpp_def_debug = '/D "_DEBUG" ' . $vc_cpp_def_common;
123 } else {
124 $project{"VC_PROJ_TYPE"} = 'Win32 (x86) Console Application';
125 $project{"VC_PROJ_CODE"} = '0x0103';
126 $vc_base_libs = 'kernel32.lib user32.lib advapi32.lib ';
127 if ( Config("wx") ) {
128 $vc_base_libs .= 'wsock32.lib ';
129 $vc_link_release = "$WXDIR\\lib\\$DLL_OR_LIB$UNICODE_SUFFIX.lib ";
130 $vc_link_debug = "$WXDIR\\lib\\$DLL_OR_LIB$UNICODE_SUFFIX$DEBUG_SUFFIX.lib ";
131 foreach ( split(/ /, $EXTRA_LIBS) ) {
132 $vc_link_release .= "$WXDIR\\lib\\$_.lib ";
133 $vc_link_debug .= "$WXDIR\\lib\\$_" . "d.lib ";
134 }
135 }
136 $vc_link_release .= '/nologo /subsystem:console /machine:I386';
137 $vc_link_debug .= '/nologo /subsystem:console /debug /machine:I386 /pdbtype:sept';
138
139 $vc_cpp_def_common = '/D "WIN32" /D "_CONSOLE" ' . $UNICODE_FLAGS . $DLL_FLAGS;
140 $vc_cpp_def_release = '/D "NDEBUG" ' . $vc_cpp_def_common;
141 $vc_cpp_def_debug = '/D "_DEBUG" ' . $vc_cpp_def_common;
142 }
143
144 foreach ( split(/ /, Project('LIBPATH')) ) {
145 $vc_link_release .= " /libpath:$_\\Release";
146 $vc_link_debug .= " /libpath:$_\\Debug";
147 }
148
149 #! define wxWin debug flags in debug build
150 if ( Config("wx") ) {
151 $vc_cpp_def_debug .= '/MDd /D "__WXDEBUG__" /D "WXDEBUG=1" ';
152 $vc_cpp_def_release .= '/MD '
153 }
154
155 $project{"VC_BASE_LINK_RELEASE"} = $vc_base_libs . $vc_link_release;
156 $project{"VC_BASE_LINK_DEBUG"} = $vc_base_libs . $vc_link_debug;
157 $tmake_libs = Project('TMAKE_LIBS') ? (Project('TMAKE_LIBS') . " ") : "";
158 $project{"VC_LINK_RELEASE"} = $vc_base_libs . $tmake_libs . $vc_link_release;
159 $project{"VC_LINK_DEBUG"} = $vc_base_libs . $tmake_libs . $vc_link_debug;
160
161 $vc_cpp_opt_common1 = '/nologo /W4 ';
162
163 $vc_cpp_opt_release = $vc_cpp_opt_common1 . '/O2 ';
164 $vc_cpp_opt_debug = $vc_cpp_opt_common1 . '/Zi /Od ';
165 $vc_cpp_opt_common = '/YX /FD /c';
166 $project{"VC_BASE_CPP_RELEASE"} = $vc_cpp_opt_release . $vc_cpp_def_release . $vc_cpp_opt_common;
167 $project{"VC_BASE_CPP_DEBUG"} = $vc_cpp_opt_debug . $vc_cpp_def_debug . $vc_cpp_opt_common;
168 ExpandGlue("INCPATH",'/I "','" /I "','"');
169 if ( $text ne "" ) { $vc_inc = $text . " "; $text = ""; } else { $vc_inc = ""; }
170 ExpandGlue("DEFINES",'/D "','" /D "','"');
171 if ( $text ne "" ) { $vc_def = $text . " "; $text = ""; } else { $vc_def = ""; }
172 if ( Config("wx") ) {
173 #! define wxWindows compilation flags
174 $vc_def .= '/D WIN32 /D WINVER=0x400 /D _MT ';
175
176 if ( Config("wxbase") ) {
177 $vc_def .= '/D wxUSE_GUI=0 ';
178 $vc_inc_debug .= "/I$WXDIR\\lib\\based ";
179 $vc_inc_release .= "/I$WXDIR\\lib\\base ";
180 }
181 else {
182 $vc_def .= '/D wxUSE_GUI=1 ';
183
184 if ( Config("wxuniv") ) {
185 $vc_def .= '/D "__WXUNIVERSAL__" ';
186
187 $vc_inc_debug .= "/I$WXDIR\\lib\\univd ";
188 $vc_inc_release .= "/I$WXDIR\\lib\\univ ";
189 }
190 else {
191 $vc_inc_debug .= "/I$WXDIR\\lib\\mswd ";
192 $vc_inc_release .= "/I$WXDIR\\lib\\msw ";
193 }
194 }
195 }
196 else {
197 $vc_inc_debug =
198 $vc_inc_release = "";
199 }
200
201 $project{"VC_CPP_INCLUDE"} = $vc_inc;
202 $project{"VC_CPP_RELEASE"} = $vc_cpp_opt_release . $vc_inc . $vc_inc_release . $vc_cpp_def_release . $vc_def . $vc_cpp_opt_common;
203 $project{"VC_CPP_DEBUG"} = $vc_cpp_opt_debug . $vc_inc . $vc_inc_debug . $vc_cpp_def_debug . $vc_def . $vc_cpp_opt_common;
204
205 if ( Project('RES_FILE') ) {
206 tmake_error(".res files are not supported, use .rc.");
207 }
208
209 $project{"MAKEFILE"} = $project{"PROJECT"} . ".mak";
210 $project{"TARGETAPP"} = $project{"TARGET"} . ".exe";
211 Project('TMAKE_FILETAGS = HEADERS SOURCES TARGET DESTDIR $$FILETAGS');
212 foreach ( split(/\s/,Project('TMAKE_FILETAGS')) ) {
213 $project{$_} =~ s-/-\\-g;
214 }
215 StdInit();
216 if ( defined($project{"DESTDIR"}) ) {
217 $project{"TARGETAPP"} = $project{"DESTDIR"} . "\\" . $project{"TARGETAPP"};
218 $project{"TARGETAPP"} =~ s/\\+/\\/g;
219 }
220 %all_files = ();
221 @files = split(/\s+/,$project{"HEADERS"});
222 foreach ( @files ) { $all_files{$_} = "h" };
223 @files = split(/\s+/,$project{"SOURCES"});
224 foreach ( @files ) { $all_files{$_} = "s" };
225 @files = split(/\s+/,$project{"RC_FILE"});
226 foreach ( @files ) { $all_files{$_} = "r" };
227
228 %file_names = ();
229 foreach $f ( %all_files ) {
230 $n = $f;
231 $n =~ s/^.*\\//;
232 $file_names{$n} = $f;
233 $file_path{$n} = ".\\" . $f;
234 $file_path2{$n} = (($f =~ /^\./) ? "" : ".\\") . $f;
235 }
236
237 #$}
238 # Microsoft Developer Studio Project File - #$ Substitute('Name="$$TARGET" - Package Owner=<4>');
239 # Microsoft Developer Studio Generated Build File, Format Version 6.00
240 # ** DO NOT EDIT **
241
242 # TARGTYPE #$ Substitute('"$$VC_PROJ_TYPE" $$VC_PROJ_CODE');
243
244 CFG=#$ Substitute('$$TARGET - Win32 Debug');
245 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
246 !MESSAGE use the Export Makefile command and run
247 !MESSAGE
248 !MESSAGE NMAKE /f "#$ ExpandGlue('MAKEFILE','','','".');
249 !MESSAGE
250 !MESSAGE You can specify a configuration when running NMAKE
251 !MESSAGE by defining the macro CFG on the command line. For example:
252 !MESSAGE
253 !MESSAGE NMAKE /f #$ Substitute('"$$MAKEFILE" CFG="$$TARGET - Win32 Debug"');
254 !MESSAGE
255 !MESSAGE Possible choices for configuration are:
256 !MESSAGE
257 !MESSAGE #$ Substitute('"$$TARGET - Win32 Release" (based on "$$VC_PROJ_TYPE")');
258 !MESSAGE #$ Substitute('"$$TARGET - Win32 Debug" (based on "$$VC_PROJ_TYPE")');
259 !MESSAGE
260
261 # Begin Project
262 # PROP Scc_ProjName ""
263 # PROP Scc_LocalPath ""
264 CPP=cl.exe
265 #$ Config("windows") && ($text='MTL=midl.exe');
266 RSC=rc.exe
267
268 !IF "$(CFG)" == #$ Substitute('"$$TARGET - Win32 Release"');
269
270 # PROP BASE Use_MFC 0
271 # PROP BASE Use_Debug_Libraries 0
272 # PROP BASE Output_Dir #$ $text = "\"${KIND}Release$UNICODE$DLL\""
273 # PROP BASE Intermediate_Dir #$ $text = "\"${KIND}Release$UNICODE$DLL\""
274 # PROP BASE Target_Dir ""
275 # PROP Use_MFC 0
276 # PROP Use_Debug_Libraries 0
277 # PROP Output_Dir #$ $text = "\"${KIND}Release$UNICODE$DLL\""
278 # PROP Intermediate_Dir #$ $text = "${KIND}Release$UNICODE$DLL\""
279 #$ Config("windows") && ($text='# PROP Ignore_Export_Lib 0');
280 # PROP Target_Dir ""
281 # ADD BASE CPP #$ Expand("VC_BASE_CPP_RELEASE");
282 # ADD CPP #$ Expand("VC_CPP_RELEASE");
283 #$ Config("windows") || DisableOutput();
284 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
285 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
286 #$ Config("windows") || EnableOutput();
287 # ADD BASE RSC /l 0x409 /d "NDEBUG" #$ Expand("VC_CPP_INCLUDE");
288 # ADD RSC /l 0x409 /d "NDEBUG" #$ Expand("VC_CPP_INCLUDE");
289 BSC32=bscmake.exe
290 # ADD BASE BSC32 /nologo
291 # ADD BSC32 /nologo
292 LINK32=link.exe
293 # ADD BASE LINK32 #$ Expand("VC_BASE_LINK_RELEASE");
294 # ADD LINK32 #$ Expand("VC_LINK_RELEASE");
295
296 !ELSEIF "$(CFG)" == #$ Substitute('"$$TARGET - Win32 Debug"');
297
298 # PROP BASE Use_MFC 0
299 # PROP BASE Use_Debug_Libraries 1
300 # PROP BASE Output_Dir #$ $text = "\"${KIND}Debug$UNICODE$DLL\""
301 # PROP BASE Intermediate_Dir #$ $text = "\"${KIND}Debug$UNICODE$DLL\""
302 # PROP BASE Target_Dir ""
303 # PROP Use_MFC 0
304 # PROP Use_Debug_Libraries 1
305 # PROP Output_Dir #$ $text = "\"${KIND}Debug$UNICODE$DLL\""
306 # PROP Intermediate_Dir #$ $text = "\"${KIND}Debug$UNICODE$DLL\""
307 #$ Config("windows") && ($text='# PROP Ignore_Export_Lib 0');
308 # PROP Target_Dir ""
309 # ADD BASE CPP #$ Expand("VC_BASE_CPP_DEBUG");
310 # ADD CPP #$ Expand("VC_CPP_DEBUG");
311 #$ Config("windows") || DisableOutput();
312 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
313 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
314 #$ Config("windows") || EnableOutput();
315 # ADD BASE RSC /l 0x409 /d "_DEBUG" #$ Expand("VC_CPP_INCLUDE");
316 # ADD RSC /l 0x409 /d "_DEBUG" #$ Expand("VC_CPP_INCLUDE");
317 BSC32=bscmake.exe
318 # ADD BASE BSC32 /nologo
319 # ADD BSC32 /nologo
320 LINK32=link.exe
321 # ADD BASE LINK32 #$ Expand("VC_BASE_LINK_DEBUG");
322 # ADD LINK32 #$ Expand("VC_LINK_DEBUG");
323
324 !ENDIF
325
326 # Begin Target
327
328 # Name #$Substitute('"$$TARGET - Win32 Release"');
329 # Name #$Substitute('"$$TARGET - Win32 Debug"');
330 #${
331 foreach $n ( sort keys %file_names ) {
332 $f = $file_names{$n};
333 $p = $file_path{$n};
334 $t = $all_files{$f};
335 if ( $t eq "s" || $t eq "h" || $t eq "r" ) {
336 $text .= "# Begin Source File\n\nSOURCE=$file_path{$n}\n";
337 $text .= "# End Source File\n";
338 }
339 }
340 chop $text;
341 #$}
342 # End Target
343 # End Project
344 #! vi: set sta ts=8 sw=4 noet nolist tw=0 ft=make: