2 #pragma warning ( disable : 4786 )
16 MSVCBackend::_generate_dsp ( const Module
& module
)
19 // TODO FIXME wine hack?
20 const bool wine
= false;
22 string dsp_file
= DspFileName(module
);
23 printf ( "Creating MSVC project: '%s'\r\n", dsp_file
.c_str() );
24 FILE* OUT
= fopen ( dsp_file
.c_str(), "wb" );
26 vector
<string
> imports
;
27 for ( i
= 0; i
< module
.non_if_data
.libraries
.size(); i
++ )
29 imports
.push_back ( module
.non_if_data
.libraries
[i
]->name
);
32 string module_type
= Right(module
.GetTargetName(),3);
33 bool lib
= (module_type
== "lib");
34 bool dll
= (module_type
== "dll");
35 bool exe
= (module_type
== "exe");
36 // TODO FIXME - need more checks here for 'sys' and possibly 'drv'?
38 bool console
= exe
; // FIXME: Not always correct
40 // TODO FIXME - not sure if the count here is right...
42 const char* p
= strpbrk ( dsp_file
.c_str(), "/\\" );
46 p
= strpbrk ( p
+1, "/\\" );
48 string msvc_wine_dir
= "..";
50 msvc_wine_dir
+= "\\..";
52 string wine_include_dir
= msvc_wine_dir
+ "\\include";
54 //$progress_current++;
55 //$output->progress("$dsp_file (file $progress_current of $progress_max)");
57 // TODO FIXME - what's diff. betw. 'c_srcs' and 'source_files'?
58 vector
<string
> c_srcs
, source_files
, resource_files
;
59 vector
<const IfableData
*> ifs_list
;
60 ifs_list
.push_back ( &module
.non_if_data
);
61 while ( ifs_list
.size() )
63 const IfableData
& data
= *ifs_list
.back();
65 // TODO FIXME - refactor needed - we're discarding if conditions
66 for ( i
= 0; i
< data
.ifs
.size(); i
++ )
67 ifs_list
.push_back ( &data
.ifs
[i
]->data
);
68 const vector
<File
*>& files
= data
.files
;
69 for ( i
= 0; i
< files
.size(); i
++ )
71 // TODO FIXME - do we want the full path of the file here?
72 const string
& file
= files
[i
]->name
;
73 source_files
.push_back ( file
);
74 if ( !stricmp ( Right(file
,2).c_str(), ".c" ) )
75 c_srcs
.push_back ( file
);
76 if ( !stricmp ( Right(file
,3).c_str(), ".rc" ) )
77 resource_files
.push_back ( file
);
80 // TODO FIXME - we don't include header files in our build system
81 //my @header_files = @{module->{header_files}};
82 vector
<string
> header_files
;
84 // TODO FIXME - wine hack?
85 /*if (module.name !~ /^wine(?:_unicode|build|runtests|test)?$/ &&
86 module.name !~ /^(?:gdi32)_.+?$/ &&
87 Right ( module.name, 5 ) == "_test" )
89 source_files.push_back ( module.name + ".spec" );
90 @source_files = sort(@source_files);
94 bool no_msvc_headers
= true;
95 // TODO FIXME - wine hack?
96 /*if (module.name =~ /^wine(?:runtests|test)$/
97 || Right ( module.name, 5 ) == "_test" )
99 no_msvc_headers = false;
102 std::vector
<std::string
> cfgs
;
104 cfgs
.push_back ( module
.name
+ " - Win32" );
108 std::vector
<std::string
> _cfgs
;
109 for ( i
= 0; i
< cfgs
.size(); i
++ )
111 _cfgs
.push_back ( cfgs
[i
] + " C" );
112 _cfgs
.push_back ( cfgs
[i
] + " C++" );
118 // TODO FIXME - wine hack?
121 std::vector<std::string> _cfgs;
122 for ( i = 0; i < cfgs.size(); i++ )
124 _cfgs.push_back ( cfgs[i] + " Debug" );
125 _cfgs.push_back ( cfgs[i] + " Release" );
131 if (!no_msvc_headers
)
133 std::vector
<std::string
> _cfgs
;
134 for ( i
= 0; i
< cfgs
.size(); i
++ )
136 _cfgs
.push_back ( cfgs
[i
] + " MSVC Headers" );
137 _cfgs
.push_back ( cfgs
[i
] + " Wine Headers" );
143 string default_cfg
= cfgs
.back();
145 fprintf ( OUT
, "# Microsoft Developer Studio Project File - Name=\"%s\" - Package Owner=<4>\r\n", module
.name
.c_str() );
146 fprintf ( OUT
, "# Microsoft Developer Studio Generated Build File, Format Version 6.00\r\n" );
147 fprintf ( OUT
, "# ** DO NOT EDIT **\r\n" );
148 fprintf ( OUT
, "\r\n" );
152 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\r\n" );
156 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\r\n" );
160 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\r\n" );
162 fprintf ( OUT
, "\r\n" );
164 fprintf ( OUT
, "CFG=%s\r\n", default_cfg
.c_str() );
165 fprintf ( OUT
, "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r\n" );
166 fprintf ( OUT
, "!MESSAGE use the Export Makefile command and run\r\n" );
167 fprintf ( OUT
, "!MESSAGE \r\n" );
168 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\".\r\n", module
.name
.c_str() );
169 fprintf ( OUT
, "!MESSAGE \r\n" );
170 fprintf ( OUT
, "!MESSAGE You can specify a configuration when running NMAKE\r\n" );
171 fprintf ( OUT
, "!MESSAGE by defining the macro CFG on the command line. For example:\r\n" );
172 fprintf ( OUT
, "!MESSAGE \r\n" );
173 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\" CFG=\"%s\"\r\n", module
.name
.c_str(), default_cfg
.c_str() );
174 fprintf ( OUT
, "!MESSAGE \r\n" );
175 fprintf ( OUT
, "!MESSAGE Possible choices for configuration are:\r\n" );
176 fprintf ( OUT
, "!MESSAGE \r\n" );
177 for ( i
= 0; i
< cfgs
.size(); i
++ )
179 const string
& cfg
= cfgs
[i
];
182 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Static Library\")\r\n", cfg
.c_str() );
186 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Dynamic-Link Library\")\r\n", cfg
.c_str() );
190 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Console Application\")\r\n", cfg
.c_str() );
193 fprintf ( OUT
, "!MESSAGE \r\n" );
194 fprintf ( OUT
, "\r\n" );
196 fprintf ( OUT
, "# Begin Project\r\n" );
197 fprintf ( OUT
, "# PROP AllowPerConfigDependencies 0\r\n" );
198 fprintf ( OUT
, "# PROP Scc_ProjName \"\"\r\n" );
199 fprintf ( OUT
, "# PROP Scc_LocalPath \"\"\r\n" );
200 fprintf ( OUT
, "CPP=cl.exe\r\n" );
201 if ( !lib
&& !exe
) fprintf ( OUT
, "MTL=midl.exe\r\n" );
202 fprintf ( OUT
, "RSC=rc.exe\r\n" );
206 std::string output_dir
;
207 for ( size_t icfg
= 0; icfg
< cfgs
.size(); icfg
++ )
209 std::string
& cfg
= cfgs
[icfg
];
214 fprintf ( OUT
, "!IF \"$(CFG)\" == \"%s\"\r\n", cfg
.c_str() );
215 fprintf ( OUT
, "\r\n" );
219 fprintf ( OUT
, "\r\n" );
220 fprintf ( OUT
, "!ELSEIF \"$(CFG)\" == \"%s\"\r\n", cfg
.c_str() );
221 fprintf ( OUT
, "\r\n" );
225 bool debug
= !strstr ( cfg
.c_str(), "Release" );
226 bool msvc_headers
= ( 0 != strstr ( cfg
.c_str(), "MSVC Headers" ) );
228 fprintf ( OUT
, "# PROP BASE Use_MFC 0\r\n" );
232 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 1\r\n" );
236 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 0\r\n" );
239 output_dir
= Replace(cfg
,module
.name
+ " - ","");
240 output_dir
= Replace(output_dir
," ","_");
241 output_dir
= Replace(output_dir
,"C++","Cxx");
242 // TODO FIXME - wine hack?
243 //if ( output_prefix_dir.size() )
244 // output_dir = output_prefix_dir + "\\" + output_dir;
246 fprintf ( OUT
, "# PROP BASE Output_Dir \"%s\"\r\n", output_dir
.c_str() );
247 fprintf ( OUT
, "# PROP BASE Intermediate_Dir \"%s\"\r\n", output_dir
.c_str() );
249 fprintf ( OUT
, "# PROP BASE Target_Dir \"\"\r\n" );
251 fprintf ( OUT
, "# PROP Use_MFC 0\r\n" );
254 fprintf ( OUT
, "# PROP Use_Debug_Libraries 1\r\n" );
258 fprintf ( OUT
, "# PROP Use_Debug_Libraries 0\r\n" );
260 fprintf ( OUT
, "# PROP Output_Dir \"%s\"\r\n", output_dir
.c_str() );
261 fprintf ( OUT
, "# PROP Intermediate_Dir \"%s\"\r\n", output_dir
.c_str() );
263 if ( dll
) fprintf ( OUT
, "# PROP Ignore_Export_Lib 0\r\n" );
264 fprintf ( OUT
, "# PROP Target_Dir \"\"\r\n" );
266 vector
<string
> defines
;
267 defines
.push_back ( "WINVER=0x0501" );
268 defines
.push_back ( "_WIN32_WINNT=0x0501" );
269 defines
.push_back ( "_WIN32_IE=0x0600" );
270 defines
.push_back ( "WIN32" );
271 defines
.push_back ( "_WINDOWS" );
272 defines
.push_back ( "WIN32" );
273 defines
.push_back ( "_MBCS" );
276 defines
.push_back ( "_DEBUG" );
279 fprintf ( OUT
, "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od" );
280 defines
.push_back ( "_LIB" );
284 fprintf ( OUT
, "# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
285 defines
.push_back ( "_WINDOWS" );
286 defines
.push_back ( "_USRDLL" );
287 // TODO FIXME - wine hack?
288 //defines.push_back ( string("\U") + module.name + "\E_EXPORTS" );
293 defines
.push_back ( "NDEBUG" );
296 fprintf ( OUT
, "# ADD BASE CPP /nologo /W3 /GX /O2" );
297 defines
.push_back ( "_LIB" );
301 fprintf ( OUT
, "# ADD BASE CPP /nologo /MT /W3 /GX /O2" );
302 defines
.push_back ( "_WINDOWS" );
303 defines
.push_back ( "_USRDLL" );
304 // TODO FIXME - wine hack?
305 //defines.push_back ( string("\U") + module.name + "\E_EXPORTS" );
309 for ( i
= 0; i
< defines
.size(); i
++ )
311 fprintf ( OUT
, " /D \"%s\"", defines
[i
].c_str() );
313 if ( lib
|| exe
) fprintf ( OUT
, " /YX" );
314 fprintf ( OUT
, " /FD" );
317 fprintf ( OUT
, " /GZ" );
318 if ( lib
|| exe
) fprintf ( OUT
, " " );
320 fprintf ( OUT
, " /c" );
321 fprintf ( OUT
, "\r\n" );
323 vector
<string
> defines2
;
324 defines2
.push_back ( "WINVER=0x0501" );
325 defines2
.push_back ( "_WIN32_WINNT=0x0501" );
326 defines2
.push_back ( "_WIN32_IE=0x0600" );
327 defines2
.push_back ( "WIN32" );
328 defines2
.push_back ( "_WINDOWS" );
329 defines2
.push_back ( "_MBCS" );
332 defines2
.push_back ( "_DEBUG" );
335 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
336 defines2
.push_back ( "_LIB" );
340 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
341 defines2
.push_back ( "_USRDLL" );
346 defines2
.push_back ( "NDEBUG" );
349 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
350 defines2
.push_back ( "_LIB" );
354 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
355 defines2
.push_back ( "_USRDLL" );
359 std::vector
<std::string
> includes
;
360 // TODO FIXME - wine hack?
363 // TODO FIXME - wine hack?
364 //defines2.push_back ( string("_\U") + module.name + "\E_" );
365 // TODO FIXME - wine hack?
366 /*if ( module.name !~ /^(?:wine(?:build|test)|.*?_test)$/ )
367 defines2.push_back ( "__WINESRC__" );*/
369 defines2
.push_back ( "__WINE_USE_NATIVE_HEADERS" );
370 string output_dir2
= Replace(output_dir
,"\\","\\\\");
371 defines2
.push_back ( ssprintf("__WINETEST_OUTPUT_DIR=\\\"%s\\\"",output_dir
.c_str()) );
372 defines2
.push_back ( "__i386__" );
373 defines2
.push_back ( "_X86_" );
375 // TODO FIXME - wine hacks?
376 /*if(module.name =~ /^gdi32_(?:enhmfdrv|mfdrv)$/) {
377 push @includes, ".." );
380 if ( strstr ( module.name.c_str(), "_test" )
382 include.push_back ( msvc_wine_dir + "\\" + output_dir );
385 if (!msvc_headers || module.name == "winetest")
387 includes.push_back ( wine_include_dir );
393 for ( i
= 0; i
< includes
.size(); i
++ );
395 const string
& include
= includes
[i
];
396 if ( strpbrk ( include
.c_str(), "[\\\"]" ) )
398 fprintf ( OUT
, " /I \"%s\"", include
.c_str() );
402 fprintf ( OUT
, " /I %s", include
.c_str() );
407 for ( i
= 0; i
< defines2
.size(); i
++ )
409 const string
& define
= defines2
[i
];
410 if ( strpbrk ( define
.c_str(), "[\\\"]" ) )
412 fprintf ( OUT
, " /D \"%s\"", define
.c_str() );
416 fprintf ( OUT
, " /D %s", define
.c_str() );
419 if ( wine
) fprintf ( OUT
, " /D inline=__inline" );
420 if ( 0 && wine
) fprintf ( OUT
, " /D \"__STDC__\"" );
422 fprintf ( OUT
, lib
? " /YX" : " /FR" );
423 fprintf ( OUT
, " /FD" );
424 if ( debug
) fprintf ( OUT
, " /GZ" );
425 if ( debug
&& lib
) fprintf ( OUT
, " " );
426 fprintf ( OUT
, " /c" );
427 if ( !no_cpp
) fprintf ( OUT
, " /TP" );
428 fprintf ( OUT
, "\r\n" );
434 fprintf ( OUT
, "# SUBTRACT CPP /X /YX\r\n" );
435 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n" );
436 fprintf ( OUT
, "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n" );
438 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"_DEBUG\"\r\n" );
439 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
442 for ( i
= 0; i
< includes
.size(); i
++ )
444 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
447 fprintf ( OUT
, " /d \"_DEBUG\"\r\n" );
453 fprintf ( OUT
, "# SUBTRACT CPP /YX\r\n" );
454 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n" );
455 fprintf ( OUT
, "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n" );
457 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"NDEBUG\"\r\n" );
458 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
461 for ( i
= 0; i
< includes
.size(); i
++ )
462 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
464 fprintf ( OUT
, "/d \"NDEBUG\"\r\n" );
466 fprintf ( OUT
, "BSC32=bscmake.exe\r\n" );
467 fprintf ( OUT
, "# ADD BASE BSC32 /nologo\r\n" );
468 fprintf ( OUT
, "# ADD BSC32 /nologo\r\n" );
472 fprintf ( OUT
, "LINK32=link.exe\r\n" );
473 fprintf ( OUT
, "# ADD BASE LINK32 " );
474 vector
<string
> libraries
;
475 libraries
.push_back ( "kernel32.lib" );
476 libraries
.push_back ( "user32.lib" );
477 libraries
.push_back ( "gdi32.lib" );
478 libraries
.push_back ( "winspool.lib" );
479 libraries
.push_back ( "comdlg32.lib" );
480 libraries
.push_back ( "advapi32.lib" );
481 libraries
.push_back ( "shell32.lib" );
482 libraries
.push_back ( "ole32.lib" );
483 libraries
.push_back ( "oleaut32.lib" );
484 libraries
.push_back ( "uuid.lib" );
485 libraries
.push_back ( "odbc32.lib" );
486 libraries
.push_back ( "odbccp32.lib" );
487 for ( i
= 0; i
< libraries
.size(); i
++ )
489 fprintf ( OUT
, "%s ", libraries
[i
].c_str() );
491 fprintf ( OUT
, " /nologo" );
492 if ( dll
) fprintf ( OUT
, " /dll" );
493 if ( console
) fprintf ( OUT
, " /subsystem:console" );
494 if ( debug
) fprintf ( OUT
, " /debug" );
495 fprintf ( OUT
, " /machine:I386" );
496 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
497 fprintf ( OUT
, "\r\n" );
499 fprintf ( OUT
, "# ADD LINK32" );
500 fprintf ( OUT
, " /nologo" );
501 // TODO FIXME - do we need their kludge?
502 //if ( module.name == "ntdll" ) fprintf ( OUT, " libcmt.lib" ); // FIXME: Kludge
503 for ( i
= 0; i
< imports
.size(); i
++ )
505 const string
& import
= imports
[i
];
506 if ( import
!= "msvcrt" )
507 fprintf ( OUT
, " %s.lib", import
.c_str() );
509 if ( dll
) fprintf ( OUT
, " /dll" );
510 if ( console
) fprintf ( OUT
, " /subsystem:console" );
511 if ( debug
) fprintf ( OUT
, " /debug" );
512 fprintf ( OUT
, " /machine:I386" );
513 // TODO FIXME - do we need their kludge?
514 //if ( module.name == "ntdll" ) fprintf ( OUT, " /nodefaultlib" ); // FIXME: Kludge
515 if ( dll
) fprintf ( OUT
, " /def:\"%s.def\"", module
.name
.c_str() );
516 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
517 fprintf ( OUT
, "\r\n" );
521 fprintf ( OUT
, "LIB32=link.exe -lib\r\n" );
522 fprintf ( OUT
, "# ADD BASE LIB32 /nologo\r\n" );
523 fprintf ( OUT
, "# ADD LIB32 /nologo\r\n" );
529 if ( cfgs
.size() != 0 )
531 fprintf ( OUT
, "\r\n" );
532 fprintf ( OUT
, "!ENDIF \r\n" );
533 fprintf ( OUT
, "\r\n" );
536 if ( module
.name
== "winebuild" )
538 fprintf ( OUT
, "# Begin Special Build Tool\r\n" );
539 fprintf ( OUT
, "SOURCE=\"$(InputPath)\"\r\n" );
540 fprintf ( OUT
, "PostBuild_Desc=Copying wine.dll and wine_unicode.dll ...\r\n" );
541 fprintf ( OUT
, "PostBuild_Cmds=" );
542 fprintf ( OUT
, "copy ..\\..\\library\\%s\\wine.dll $(OutDir)\t",
543 output_dir
.c_str() );
544 fprintf ( OUT
, "copy ..\\..\\unicode\\%s\\wine_unicode.dll $(OutDir)\r\n",
545 output_dir
.c_str() );
546 fprintf ( OUT
, "# End Special Build Tool\r\n" );
548 fprintf ( OUT
, "# Begin Target\r\n" );
549 fprintf ( OUT
, "\r\n" );
550 for ( i
= 0; i
< cfgs
.size(); i
++ )
552 fprintf ( OUT
, "# Name \"%s\"\r\n", cfgs
[i
].c_str() );
555 fprintf ( OUT
, "# Begin Group \"Source Files\"\r\n" );
556 fprintf ( OUT
, "\r\n" );
557 fprintf ( OUT
, "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\r\n" );
559 for ( size_t isrcfile
= 0; isrcfile
< source_files
.size(); isrcfile
++ )
561 string source_file
= DosSeparator(source_files
[isrcfile
]);
563 if ( strncmp ( source_file
.c_str(), ".\\", 2 ) )
565 source_file
= string(".\\") + source_file
;
568 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
570 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
572 // TODO FIXME - not sure what this is doing? wine hack maybe?
573 //if ( basename !~ /\..{1,3}$/; ) basename += string(".dll");
574 string dbg_c_file
= basename
+ ".dbg.c";
576 fprintf ( OUT
, "# Begin Source File\r\n" );
577 fprintf ( OUT
, "\r\n" );
578 fprintf ( OUT
, "SOURCE=%s\r\n", dbg_c_file
.c_str() );
579 fprintf ( OUT
, "# End Source File\r\n" );
582 fprintf ( OUT
, "# Begin Source File\r\n" );
583 fprintf ( OUT
, "\r\n" );
585 fprintf ( OUT
, "SOURCE=%s\r\n", source_file
.c_str() );
587 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
589 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
591 string spec_file
= source_file
;
592 string def_file
= basename
+ ".def";
594 // TODO FIXME - not sure what this is doing? wine hack maybe?
595 //if ( basename !~ /\..{1,3}$/; ) basename += ".dll";
596 string dbg_file
= basename
+ ".dbg";
597 string dbg_c_file
= basename
+ ".dbg.c";
599 string srcdir
= "."; // FIXME: Is this really always correct?
601 fprintf ( OUT
, "# Begin Custom Build\r\n" );
602 fprintf ( OUT
, "InputPath=%s\r\n", spec_file
.c_str() );
603 fprintf ( OUT
, "\r\n" );
604 fprintf ( OUT
, "BuildCmds= \\\r\n" );
605 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe --def %s > %s \\\r\n",
610 if ( module
.name
== "ntdll" )
613 for ( i
= 0; i
< c_srcs
.size(); i
++ )
615 const string
& c_src
= c_srcs
[i
];
618 fprintf ( OUT
, "\techo %s >> %s \\\r\n", c_src
.c_str(), dbg_file
.c_str() );
622 fprintf ( OUT
, "\techo %s > %s \\\r\n", c_src
.c_str(), dbg_file
.c_str() );
625 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
626 output_dir
.c_str() );
627 fprintf ( OUT
, " -o %s --debug -C%s %s \\\r\n",
635 for ( i
= 0; i
< c_srcs
.size(); i
++ )
637 const string
& c_src
= c_srcs
[i
];
638 if ( !strcmp ( &c_src
[c_src
.size()-2], ".c" ) )
640 if ( sc_srcs
.size() )
646 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
647 output_dir
.c_str() );
648 fprintf ( OUT
, " -o %s --debug -C%s %s \\\r\n",
654 fprintf ( OUT
, "\t\r\n" );
655 fprintf ( OUT
, "\r\n" );
656 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", def_file
.c_str() );
657 fprintf ( OUT
, " $(BuildCmds)\r\n" );
658 fprintf ( OUT
, "\r\n" );
659 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", dbg_c_file
.c_str() );
660 fprintf ( OUT
, " $(BuildCmds)\r\n" );
661 fprintf ( OUT
, "# End Custom Build\r\n" );
663 /*else if ( source_file =~ /([^\\]*?\.h)$/ )
667 foreach my $cfg (@cfgs) {
671 fprintf ( OUT, "!IF \"$(CFG)\" == \"$cfg\"\r\n" );
672 fprintf ( OUT, "\r\n" );
674 fprintf ( OUT, "\r\n" );
675 fprintf ( OUT, "!ELSEIF \"$(CFG)\" == \"$cfg\"\r\n" );
676 fprintf ( OUT, "\r\n" );
680 $output_dir =~ s/^$project - //;
681 $output_dir =~ s/ /_/g;
682 $output_dir =~ s/C\+\+/Cxx/g;
683 if($output_prefix_dir) {
684 $output_dir = "$output_prefix_dir\\$output_dir" );
687 fprintf ( OUT, "# Begin Custom Build\r\n" );
688 fprintf ( OUT, "OutDir=%s\r\n", output_dir.c_str() );
689 fprintf ( OUT, "InputPath=%s\r\n", source_file.c_str() );
690 fprintf ( OUT, "\r\n" );
691 fprintf ( OUT, "\"$(OutDir)\\wine\\%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", h_file.c_str() );
692 fprintf ( OUT, "\tcopy \"$(InputPath)\" \"$(OutDir)\\wine\"\r\n" );
693 fprintf ( OUT, "\r\n" );
694 fprintf ( OUT, "# End Custom Build\r\n" );
697 if ( cfgs.size() != 0)
699 fprintf ( OUT, "\r\n" );
700 fprintf ( OUT, "!ENDIF \r\n" );
701 fprintf ( OUT, "\r\n" );
705 fprintf ( OUT
, "# End Source File\r\n" );
707 fprintf ( OUT
, "# End Group\r\n" );
709 fprintf ( OUT
, "# Begin Group \"Header Files\"\r\n" );
710 fprintf ( OUT
, "\r\n" );
711 fprintf ( OUT
, "# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\r\n" );
712 for ( i
= 0; i
< header_files
.size(); i
++ )
714 const string
& header_file
= header_files
[i
];
715 fprintf ( OUT
, "# Begin Source File\r\n" );
716 fprintf ( OUT
, "\r\n" );
717 fprintf ( OUT
, "SOURCE=.\\%s\r\n", header_file
.c_str() );
718 fprintf ( OUT
, "# End Source File\r\n" );
720 fprintf ( OUT
, "# End Group\r\n" );
724 fprintf ( OUT
, "# Begin Group \"Resource Files\"\r\n" );
725 fprintf ( OUT
, "\r\n" );
726 fprintf ( OUT
, "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\r\n" );
727 for ( i
= 0; i
< resource_files
.size(); i
++ )
729 const string
& resource_file
= resource_files
[i
];
730 fprintf ( OUT
, "# Begin Source File\r\n" );
731 fprintf ( OUT
, "\r\n" );
732 fprintf ( OUT
, "SOURCE=.\\%s\r\n", resource_file
.c_str() );
733 fprintf ( OUT
, "# End Source File\r\n" );
735 fprintf ( OUT
, "# End Group\r\n" );
737 fprintf ( OUT
, "# End Target\r\n" );
738 fprintf ( OUT
, "# End Project\r\n" );
744 MSVCBackend::_generate_dsw_header ( FILE* OUT
)
746 fprintf ( OUT
, "Microsoft Developer Studio Workspace File, Format Version 6.00\r\n" );
747 fprintf ( OUT
, "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r\n" );
748 fprintf ( OUT
, "\r\n" );
752 MSVCBackend::_generate_dsw_project (
754 const Module
& module
,
755 std::string dsp_file
,
756 const std::vector
<Dependency
*>& dependencies
)
758 dsp_file
= DosSeparator ( std::string(".\\") + dsp_file
);
760 // TODO FIXME - must they be sorted?
761 //@dependencies = sort(@dependencies);
763 fprintf ( OUT
, "###############################################################################\r\n" );
764 fprintf ( OUT
, "\r\n" );
765 fprintf ( OUT
, "Project: \"%s\"=%s - Package Owner=<4>\r\n", module
.name
.c_str(), dsp_file
.c_str() );
766 fprintf ( OUT
, "\r\n" );
767 fprintf ( OUT
, "Package=<5>\r\n" );
768 fprintf ( OUT
, "{{{\r\n" );
769 fprintf ( OUT
, "}}}\r\n" );
770 fprintf ( OUT
, "\r\n" );
771 fprintf ( OUT
, "Package=<4>\r\n" );
772 fprintf ( OUT
, "{{{\r\n" );
773 for ( size_t i
= 0; i
< dependencies
.size(); i
++ )
775 Dependency
& dependency
= *dependencies
[i
];
776 fprintf ( OUT
, " Begin Project Dependency\r\n" );
777 fprintf ( OUT
, " Project_Dep_Name %s\r\n", dependency
.module
.name
.c_str() );
778 fprintf ( OUT
, " End Project Dependency\r\n" );
780 fprintf ( OUT
, "}}}\r\n" );
781 fprintf ( OUT
, "\r\n" );
785 MSVCBackend::_generate_dsw_footer ( FILE* OUT
)
787 fprintf ( OUT
, "###############################################################################\r\n" );
788 fprintf ( OUT
, "\r\n" );
789 fprintf ( OUT
, "Global:\r\n" );
790 fprintf ( OUT
, "\r\n" );
791 fprintf ( OUT
, "Package=<5>\r\n" );
792 fprintf ( OUT
, "{{{\r\n" );
793 fprintf ( OUT
, "}}}\r\n" );
794 fprintf ( OUT
, "\r\n" );
795 fprintf ( OUT
, "Package=<3>\r\n" );
796 fprintf ( OUT
, "{{{\r\n" );
797 fprintf ( OUT
, "}}}\r\n" );
798 fprintf ( OUT
, "\r\n" );
799 fprintf ( OUT
, "###############################################################################\r\n" );
800 fprintf ( OUT
, "\r\n" );
804 MSVCBackend::_generate_wine_dsw ( FILE* OUT
)
806 _generate_dsw_header(OUT
);
807 // TODO FIXME - is it necessary to sort them?
808 for ( size_t i
= 0; i
< ProjectNode
.modules
.size(); i
++ )
810 Module
& module
= *ProjectNode
.modules
[i
];
812 std::string dsp_file
= DspFileName ( module
);
814 // TODO FIXME - more wine hacks?
815 /*if ( module.name == "gdi32" )
817 for ( size_t idir = 0; idir < gdi32_dirs.size(); idir++ )
819 string dir2 = gdi32_dirs[idir];
820 $dir2 =~ s%^.*?/([^/]+)$%$1%;
822 dependencies.push_back ( Replace ( "gdi32_" + dir2, "/", "_" ) );
826 _generate_dsw_project ( OUT
, module
, dsp_file
, module
.dependencies
);
828 _generate_dsw_footer ( OUT
);