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