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