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