a04bd49bfb34507b129894b1f78f8e1c92066cdf
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'\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 string dsp_path
= module
.GetBasePath();
59 vector
<string
> c_srcs
, source_files
, resource_files
, includes
;
60 vector
<const IfableData
*> ifs_list
;
61 ifs_list
.push_back ( &module
.non_if_data
);
62 while ( ifs_list
.size() )
64 const IfableData
& data
= *ifs_list
.back();
66 // TODO FIXME - refactor needed - we're discarding if conditions
67 for ( i
= 0; i
< data
.ifs
.size(); i
++ )
68 ifs_list
.push_back ( &data
.ifs
[i
]->data
);
69 const vector
<File
*>& files
= data
.files
;
70 for ( i
= 0; i
< files
.size(); i
++ )
72 // TODO FIXME - do we want the full path of the file here?
73 string file
= string(".") + &files
[i
]->name
[dsp_path
.size()];
75 source_files
.push_back ( file
);
76 if ( !stricmp ( Right(file
,2).c_str(), ".c" ) )
77 c_srcs
.push_back ( file
);
78 if ( !stricmp ( Right(file
,3).c_str(), ".rc" ) )
79 resource_files
.push_back ( file
);
81 const vector
<Include
*>& incs
= data
.includes
;
82 for ( i
= 0; i
< incs
.size(); i
++ )
84 string path
= Path::RelativeFromDirectory (
86 module
.GetBasePath() );
87 includes
.push_back ( path
);
90 // TODO FIXME - we don't include header files in our build system
91 //my @header_files = @{module->{header_files}};
92 vector
<string
> header_files
;
94 // TODO FIXME - wine hack?
95 /*if (module.name !~ /^wine(?:_unicode|build|runtests|test)?$/ &&
96 module.name !~ /^(?:gdi32)_.+?$/ &&
97 Right ( module.name, 5 ) == "_test" )
99 source_files.push_back ( module.name + ".spec" );
100 @source_files = sort(@source_files);
104 bool no_msvc_headers
= true;
105 // TODO FIXME - wine hack?
106 /*if (module.name =~ /^wine(?:runtests|test)$/
107 || Right ( module.name, 5 ) == "_test" )
109 no_msvc_headers = false;
112 std::vector
<std::string
> cfgs
;
114 cfgs
.push_back ( module
.name
+ " - Win32" );
118 std::vector
<std::string
> _cfgs
;
119 for ( i
= 0; i
< cfgs
.size(); i
++ )
121 _cfgs
.push_back ( cfgs
[i
] + " C" );
122 _cfgs
.push_back ( cfgs
[i
] + " C++" );
128 // TODO FIXME - wine hack?
131 std::vector<std::string> _cfgs;
132 for ( i = 0; i < cfgs.size(); i++ )
134 _cfgs.push_back ( cfgs[i] + " Debug" );
135 _cfgs.push_back ( cfgs[i] + " Release" );
141 if (!no_msvc_headers
)
143 std::vector
<std::string
> _cfgs
;
144 for ( i
= 0; i
< cfgs
.size(); i
++ )
146 _cfgs
.push_back ( cfgs
[i
] + " MSVC Headers" );
147 _cfgs
.push_back ( cfgs
[i
] + " Wine Headers" );
153 string default_cfg
= cfgs
.back();
155 fprintf ( OUT
, "# Microsoft Developer Studio Project File - Name=\"%s\" - Package Owner=<4>\r\n", module
.name
.c_str() );
156 fprintf ( OUT
, "# Microsoft Developer Studio Generated Build File, Format Version 6.00\r\n" );
157 fprintf ( OUT
, "# ** DO NOT EDIT **\r\n" );
158 fprintf ( OUT
, "\r\n" );
162 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\r\n" );
166 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\r\n" );
170 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\r\n" );
172 fprintf ( OUT
, "\r\n" );
174 fprintf ( OUT
, "CFG=%s\r\n", default_cfg
.c_str() );
175 fprintf ( OUT
, "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r\n" );
176 fprintf ( OUT
, "!MESSAGE use the Export Makefile command and run\r\n" );
177 fprintf ( OUT
, "!MESSAGE \r\n" );
178 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\".\r\n", module
.name
.c_str() );
179 fprintf ( OUT
, "!MESSAGE \r\n" );
180 fprintf ( OUT
, "!MESSAGE You can specify a configuration when running NMAKE\r\n" );
181 fprintf ( OUT
, "!MESSAGE by defining the macro CFG on the command line. For example:\r\n" );
182 fprintf ( OUT
, "!MESSAGE \r\n" );
183 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\" CFG=\"%s\"\r\n", module
.name
.c_str(), default_cfg
.c_str() );
184 fprintf ( OUT
, "!MESSAGE \r\n" );
185 fprintf ( OUT
, "!MESSAGE Possible choices for configuration are:\r\n" );
186 fprintf ( OUT
, "!MESSAGE \r\n" );
187 for ( i
= 0; i
< cfgs
.size(); i
++ )
189 const string
& cfg
= cfgs
[i
];
192 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Static Library\")\r\n", cfg
.c_str() );
196 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Dynamic-Link Library\")\r\n", cfg
.c_str() );
200 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Console Application\")\r\n", cfg
.c_str() );
203 fprintf ( OUT
, "!MESSAGE \r\n" );
204 fprintf ( OUT
, "\r\n" );
206 fprintf ( OUT
, "# Begin Project\r\n" );
207 fprintf ( OUT
, "# PROP AllowPerConfigDependencies 0\r\n" );
208 fprintf ( OUT
, "# PROP Scc_ProjName \"\"\r\n" );
209 fprintf ( OUT
, "# PROP Scc_LocalPath \"\"\r\n" );
210 fprintf ( OUT
, "CPP=cl.exe\r\n" );
211 if ( !lib
&& !exe
) fprintf ( OUT
, "MTL=midl.exe\r\n" );
212 fprintf ( OUT
, "RSC=rc.exe\r\n" );
216 std::string output_dir
;
217 for ( size_t icfg
= 0; icfg
< cfgs
.size(); icfg
++ )
219 std::string
& cfg
= cfgs
[icfg
];
224 fprintf ( OUT
, "!IF \"$(CFG)\" == \"%s\"\r\n", cfg
.c_str() );
225 fprintf ( OUT
, "\r\n" );
229 fprintf ( OUT
, "\r\n" );
230 fprintf ( OUT
, "!ELSEIF \"$(CFG)\" == \"%s\"\r\n", cfg
.c_str() );
231 fprintf ( OUT
, "\r\n" );
235 bool debug
= !strstr ( cfg
.c_str(), "Release" );
236 bool msvc_headers
= ( 0 != strstr ( cfg
.c_str(), "MSVC Headers" ) );
238 fprintf ( OUT
, "# PROP BASE Use_MFC 0\r\n" );
242 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 1\r\n" );
246 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 0\r\n" );
249 output_dir
= Replace(cfg
,module
.name
+ " - ","");
250 output_dir
= Replace(output_dir
," ","_");
251 output_dir
= Replace(output_dir
,"C++","Cxx");
252 // TODO FIXME - wine hack?
253 //if ( output_prefix_dir.size() )
254 // output_dir = output_prefix_dir + "\\" + output_dir;
256 fprintf ( OUT
, "# PROP BASE Output_Dir \"%s\"\r\n", output_dir
.c_str() );
257 fprintf ( OUT
, "# PROP BASE Intermediate_Dir \"%s\"\r\n", output_dir
.c_str() );
259 fprintf ( OUT
, "# PROP BASE Target_Dir \"\"\r\n" );
261 fprintf ( OUT
, "# PROP Use_MFC 0\r\n" );
264 fprintf ( OUT
, "# PROP Use_Debug_Libraries 1\r\n" );
268 fprintf ( OUT
, "# PROP Use_Debug_Libraries 0\r\n" );
270 fprintf ( OUT
, "# PROP Output_Dir \"%s\"\r\n", output_dir
.c_str() );
271 fprintf ( OUT
, "# PROP Intermediate_Dir \"%s\"\r\n", output_dir
.c_str() );
273 if ( dll
) fprintf ( OUT
, "# PROP Ignore_Export_Lib 0\r\n" );
274 fprintf ( OUT
, "# PROP Target_Dir \"\"\r\n" );
276 vector
<string
> defines
;
277 defines
.push_back ( "WINVER=0x0501" );
278 defines
.push_back ( "_WIN32_WINNT=0x0501" );
279 defines
.push_back ( "_WIN32_IE=0x0600" );
280 defines
.push_back ( "WIN32" );
281 defines
.push_back ( "_WINDOWS" );
282 defines
.push_back ( "WIN32" );
283 defines
.push_back ( "_MBCS" );
286 defines
.push_back ( "_DEBUG" );
289 fprintf ( OUT
, "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od" );
290 defines
.push_back ( "_LIB" );
294 fprintf ( OUT
, "# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
295 defines
.push_back ( "_WINDOWS" );
296 defines
.push_back ( "_USRDLL" );
297 // TODO FIXME - wine hack?
298 //defines.push_back ( string("\U") + module.name + "\E_EXPORTS" );
303 defines
.push_back ( "NDEBUG" );
306 fprintf ( OUT
, "# ADD BASE CPP /nologo /W3 /GX /O2" );
307 defines
.push_back ( "_LIB" );
311 fprintf ( OUT
, "# ADD BASE CPP /nologo /MT /W3 /GX /O2" );
312 defines
.push_back ( "_WINDOWS" );
313 defines
.push_back ( "_USRDLL" );
314 // TODO FIXME - wine hack?
315 //defines.push_back ( string("\U") + module.name + "\E_EXPORTS" );
319 for ( i
= 0; i
< defines
.size(); i
++ )
321 fprintf ( OUT
, " /D \"%s\"", defines
[i
].c_str() );
323 if ( lib
|| exe
) fprintf ( OUT
, " /YX" );
324 fprintf ( OUT
, " /FD" );
327 fprintf ( OUT
, " /GZ" );
328 if ( lib
|| exe
) fprintf ( OUT
, " " );
330 fprintf ( OUT
, " /c" );
331 fprintf ( OUT
, "\r\n" );
333 vector
<string
> defines2
;
334 defines2
.push_back ( "WINVER=0x0501" );
335 defines2
.push_back ( "_WIN32_WINNT=0x0501" );
336 defines2
.push_back ( "_WIN32_IE=0x0600" );
337 defines2
.push_back ( "WIN32" );
338 defines2
.push_back ( "_WINDOWS" );
339 defines2
.push_back ( "_MBCS" );
342 defines2
.push_back ( "_DEBUG" );
345 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
346 defines2
.push_back ( "_LIB" );
350 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
351 defines2
.push_back ( "_USRDLL" );
356 defines2
.push_back ( "NDEBUG" );
359 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
360 defines2
.push_back ( "_LIB" );
364 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
365 defines2
.push_back ( "_USRDLL" );
369 // TODO FIXME - wine hack?
372 // TODO FIXME - wine hack?
373 //defines2.push_back ( string("_\U") + module.name + "\E_" );
374 // TODO FIXME - wine hack?
375 /*if ( module.name !~ /^(?:wine(?:build|test)|.*?_test)$/ )
376 defines2.push_back ( "__WINESRC__" );*/
378 defines2
.push_back ( "__WINE_USE_NATIVE_HEADERS" );
379 string output_dir2
= Replace(output_dir
,"\\","\\\\");
380 defines2
.push_back ( ssprintf("__WINETEST_OUTPUT_DIR=\\\"%s\\\"",output_dir
.c_str()) );
381 defines2
.push_back ( "__i386__" );
382 defines2
.push_back ( "_X86_" );
384 // TODO FIXME - wine hacks?
385 /*if(module.name =~ /^gdi32_(?:enhmfdrv|mfdrv)$/) {
386 push @includes, ".." );
389 if ( strstr ( module.name.c_str(), "_test" )
391 include.push_back ( msvc_wine_dir + "\\" + output_dir );
394 if (!msvc_headers || module.name == "winetest")
396 includes.push_back ( wine_include_dir );
402 for ( i
= 0; i
< includes
.size(); i
++ )
404 const string
& include
= includes
[i
];
405 if ( strpbrk ( include
.c_str(), "[\\\"]" ) )
407 fprintf ( OUT
, " /I \"%s\"", include
.c_str() );
411 fprintf ( OUT
, " /I %s", include
.c_str() );
416 fprintf ( OUT
, " /I \".\"" );
417 for ( i
= 0; i
< defines2
.size(); i
++ )
419 const string
& define
= defines2
[i
];
420 if ( strpbrk ( define
.c_str(), "[\\\"]" ) )
422 fprintf ( OUT
, " /D \"%s\"", define
.c_str() );
426 fprintf ( OUT
, " /D %s", define
.c_str() );
429 if ( wine
) fprintf ( OUT
, " /D inline=__inline" );
430 if ( 0 && wine
) fprintf ( OUT
, " /D \"__STDC__\"" );
432 fprintf ( OUT
, lib
? " /YX" : " /FR" );
433 fprintf ( OUT
, " /FD" );
434 if ( debug
) fprintf ( OUT
, " /GZ" );
435 if ( debug
&& lib
) fprintf ( OUT
, " " );
436 fprintf ( OUT
, " /c" );
437 if ( !no_cpp
) fprintf ( OUT
, " /TP" );
438 fprintf ( OUT
, "\r\n" );
444 fprintf ( OUT
, "# SUBTRACT CPP /X /YX\r\n" );
445 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n" );
446 fprintf ( OUT
, "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n" );
448 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"_DEBUG\"\r\n" );
449 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
452 for ( i
= 0; i
< includes
.size(); i
++ )
454 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
457 fprintf ( OUT
, " /d \"_DEBUG\"\r\n" );
463 fprintf ( OUT
, "# SUBTRACT CPP /YX\r\n" );
464 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n" );
465 fprintf ( OUT
, "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n" );
467 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"NDEBUG\"\r\n" );
468 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
471 for ( i
= 0; i
< includes
.size(); i
++ )
472 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
474 fprintf ( OUT
, "/d \"NDEBUG\"\r\n" );
476 fprintf ( OUT
, "BSC32=bscmake.exe\r\n" );
477 fprintf ( OUT
, "# ADD BASE BSC32 /nologo\r\n" );
478 fprintf ( OUT
, "# ADD BSC32 /nologo\r\n" );
482 fprintf ( OUT
, "LINK32=link.exe\r\n" );
483 fprintf ( OUT
, "# ADD BASE LINK32 " );
484 vector
<string
> libraries
;
485 libraries
.push_back ( "kernel32.lib" );
486 libraries
.push_back ( "user32.lib" );
487 libraries
.push_back ( "gdi32.lib" );
488 libraries
.push_back ( "winspool.lib" );
489 libraries
.push_back ( "comdlg32.lib" );
490 libraries
.push_back ( "advapi32.lib" );
491 libraries
.push_back ( "shell32.lib" );
492 libraries
.push_back ( "ole32.lib" );
493 libraries
.push_back ( "oleaut32.lib" );
494 libraries
.push_back ( "uuid.lib" );
495 libraries
.push_back ( "odbc32.lib" );
496 libraries
.push_back ( "odbccp32.lib" );
497 for ( i
= 0; i
< libraries
.size(); i
++ )
499 fprintf ( OUT
, "%s ", libraries
[i
].c_str() );
501 fprintf ( OUT
, " /nologo" );
502 if ( dll
) fprintf ( OUT
, " /dll" );
503 if ( console
) fprintf ( OUT
, " /subsystem:console" );
504 if ( debug
) fprintf ( OUT
, " /debug" );
505 fprintf ( OUT
, " /machine:I386" );
506 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
507 fprintf ( OUT
, "\r\n" );
509 fprintf ( OUT
, "# ADD LINK32" );
510 fprintf ( OUT
, " /nologo" );
511 // TODO FIXME - do we need their kludge?
512 //if ( module.name == "ntdll" ) fprintf ( OUT, " libcmt.lib" ); // FIXME: Kludge
513 for ( i
= 0; i
< imports
.size(); i
++ )
515 const string
& import
= imports
[i
];
516 if ( import
!= "msvcrt" )
517 fprintf ( OUT
, " %s.lib", import
.c_str() );
519 if ( dll
) fprintf ( OUT
, " /dll" );
520 if ( console
) fprintf ( OUT
, " /subsystem:console" );
521 if ( debug
) fprintf ( OUT
, " /debug" );
522 fprintf ( OUT
, " /machine:I386" );
523 // TODO FIXME - do we need their kludge?
524 //if ( module.name == "ntdll" ) fprintf ( OUT, " /nodefaultlib" ); // FIXME: Kludge
525 if ( dll
) fprintf ( OUT
, " /def:\"%s.def\"", module
.name
.c_str() );
526 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
527 fprintf ( OUT
, "\r\n" );
531 fprintf ( OUT
, "LIB32=link.exe -lib\r\n" );
532 fprintf ( OUT
, "# ADD BASE LIB32 /nologo\r\n" );
533 fprintf ( OUT
, "# ADD LIB32 /nologo\r\n" );
539 if ( cfgs
.size() != 0 )
541 fprintf ( OUT
, "\r\n" );
542 fprintf ( OUT
, "!ENDIF \r\n" );
543 fprintf ( OUT
, "\r\n" );
546 if ( module
.name
== "winebuild" )
548 fprintf ( OUT
, "# Begin Special Build Tool\r\n" );
549 fprintf ( OUT
, "SOURCE=\"$(InputPath)\"\r\n" );
550 fprintf ( OUT
, "PostBuild_Desc=Copying wine.dll and wine_unicode.dll ...\r\n" );
551 fprintf ( OUT
, "PostBuild_Cmds=" );
552 fprintf ( OUT
, "copy ..\\..\\library\\%s\\wine.dll $(OutDir)\t",
553 output_dir
.c_str() );
554 fprintf ( OUT
, "copy ..\\..\\unicode\\%s\\wine_unicode.dll $(OutDir)\r\n",
555 output_dir
.c_str() );
556 fprintf ( OUT
, "# End Special Build Tool\r\n" );
559 fprintf ( OUT
, "# Begin Target\r\n" );
560 fprintf ( OUT
, "\r\n" );
561 for ( i
= 0; i
< cfgs
.size(); i
++ )
563 fprintf ( OUT
, "# Name \"%s\"\r\n", cfgs
[i
].c_str() );
566 fprintf ( OUT
, "# Begin Group \"Source Files\"\r\n" );
567 fprintf ( OUT
, "\r\n" );
568 fprintf ( OUT
, "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\r\n" );
570 for ( size_t isrcfile
= 0; isrcfile
< source_files
.size(); isrcfile
++ )
572 string source_file
= DosSeparator(source_files
[isrcfile
]);
574 if ( strncmp ( source_file
.c_str(), ".\\", 2 ) )
576 source_file
= string(".\\") + source_file
;
579 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
581 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
583 // TODO FIXME - not sure what this is doing? wine hack maybe?
584 //if ( basename !~ /\..{1,3}$/; ) basename += string(".dll");
585 string dbg_c_file
= basename
+ ".dbg.c";
587 fprintf ( OUT
, "# Begin Source File\r\n" );
588 fprintf ( OUT
, "\r\n" );
589 fprintf ( OUT
, "SOURCE=%s\r\n", dbg_c_file
.c_str() );
590 fprintf ( OUT
, "# End Source File\r\n" );
593 fprintf ( OUT
, "# Begin Source File\r\n" );
594 fprintf ( OUT
, "\r\n" );
596 fprintf ( OUT
, "SOURCE=%s\r\n", source_file
.c_str() );
598 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
601 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
603 string spec_file
= source_file
;
604 string def_file
= basename
+ ".def";
606 // TODO FIXME - not sure what this is doing? wine hack maybe?
607 //if ( basename !~ /\..{1,3}$/; ) basename += ".dll";
608 string dbg_file
= basename
+ ".dbg";
609 string dbg_c_file
= basename
+ ".dbg.c";
611 string srcdir
= "."; // FIXME: Is this really always correct?
613 fprintf ( OUT
, "# Begin Custom Build\r\n" );
614 fprintf ( OUT
, "InputPath=%s\r\n", spec_file
.c_str() );
615 fprintf ( OUT
, "\r\n" );
616 fprintf ( OUT
, "BuildCmds= \\\r\n" );
617 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe --def %s > %s \\\r\n",
622 if ( module
.name
== "ntdll" )
625 for ( i
= 0; i
< c_srcs
.size(); i
++ )
627 const string
& c_src
= c_srcs
[i
];
630 fprintf ( OUT
, "\techo %s >> %s \\\r\n", c_src
.c_str(), dbg_file
.c_str() );
634 fprintf ( OUT
, "\techo %s > %s \\\r\n", c_src
.c_str(), dbg_file
.c_str() );
637 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
638 output_dir
.c_str() );
639 fprintf ( OUT
, " -o %s --debug -C%s %s \\\r\n",
647 for ( i
= 0; i
< c_srcs
.size(); i
++ )
649 const string
& c_src
= c_srcs
[i
];
650 if ( !strcmp ( &c_src
[c_src
.size()-2], ".c" ) )
652 if ( sc_srcs
.size() )
658 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
659 output_dir
.c_str() );
660 fprintf ( OUT
, " -o %s --debug -C%s %s \\\r\n",
666 fprintf ( OUT
, "\t\r\n" );
667 fprintf ( OUT
, "\r\n" );
668 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", def_file
.c_str() );
669 fprintf ( OUT
, " $(BuildCmds)\r\n" );
670 fprintf ( OUT
, "\r\n" );
671 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", dbg_c_file
.c_str() );
672 fprintf ( OUT
, " $(BuildCmds)\r\n" );
673 fprintf ( OUT
, "# End Custom Build\r\n" );
676 /*else if ( source_file =~ /([^\\]*?\.h)$/ )
680 foreach my $cfg (@cfgs) {
684 fprintf ( OUT, "!IF \"$(CFG)\" == \"$cfg\"\r\n" );
685 fprintf ( OUT, "\r\n" );
687 fprintf ( OUT, "\r\n" );
688 fprintf ( OUT, "!ELSEIF \"$(CFG)\" == \"$cfg\"\r\n" );
689 fprintf ( OUT, "\r\n" );
693 $output_dir =~ s/^$project - //;
694 $output_dir =~ s/ /_/g;
695 $output_dir =~ s/C\+\+/Cxx/g;
696 if($output_prefix_dir) {
697 $output_dir = "$output_prefix_dir\\$output_dir" );
700 fprintf ( OUT, "# Begin Custom Build\r\n" );
701 fprintf ( OUT, "OutDir=%s\r\n", output_dir.c_str() );
702 fprintf ( OUT, "InputPath=%s\r\n", source_file.c_str() );
703 fprintf ( OUT, "\r\n" );
704 fprintf ( OUT, "\"$(OutDir)\\wine\\%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", h_file.c_str() );
705 fprintf ( OUT, "\tcopy \"$(InputPath)\" \"$(OutDir)\\wine\"\r\n" );
706 fprintf ( OUT, "\r\n" );
707 fprintf ( OUT, "# End Custom Build\r\n" );
710 if ( cfgs.size() != 0)
712 fprintf ( OUT, "\r\n" );
713 fprintf ( OUT, "!ENDIF \r\n" );
714 fprintf ( OUT, "\r\n" );
718 fprintf ( OUT
, "# End Source File\r\n" );
720 fprintf ( OUT
, "# End Group\r\n" );
721 fprintf ( OUT
, "# Begin Group \"Header Files\"\r\n" );
722 fprintf ( OUT
, "\r\n" );
723 fprintf ( OUT
, "# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\r\n" );
724 for ( i
= 0; i
< header_files
.size(); i
++ )
726 const string
& header_file
= header_files
[i
];
727 fprintf ( OUT
, "# Begin Source File\r\n" );
728 fprintf ( OUT
, "\r\n" );
729 fprintf ( OUT
, "SOURCE=.\\%s\r\n", header_file
.c_str() );
730 fprintf ( OUT
, "# End Source File\r\n" );
732 fprintf ( OUT
, "# End Group\r\n" );
736 fprintf ( OUT
, "# Begin Group \"Resource Files\"\r\n" );
737 fprintf ( OUT
, "\r\n" );
738 fprintf ( OUT
, "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\r\n" );
739 for ( i
= 0; i
< resource_files
.size(); i
++ )
741 const string
& resource_file
= resource_files
[i
];
742 fprintf ( OUT
, "# Begin Source File\r\n" );
743 fprintf ( OUT
, "\r\n" );
744 fprintf ( OUT
, "SOURCE=.\\%s\r\n", resource_file
.c_str() );
745 fprintf ( OUT
, "# End Source File\r\n" );
747 fprintf ( OUT
, "# End Group\r\n" );
749 fprintf ( OUT
, "# End Target\r\n" );
750 fprintf ( OUT
, "# End Project\r\n" );
756 MSVCBackend::_generate_dsw_header ( FILE* OUT
)
758 fprintf ( OUT
, "Microsoft Developer Studio Workspace File, Format Version 6.00\r\n" );
759 fprintf ( OUT
, "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r\n" );
760 fprintf ( OUT
, "\r\n" );
764 MSVCBackend::_generate_dsw_project (
766 const Module
& module
,
767 std::string dsp_file
,
768 const std::vector
<Dependency
*>& dependencies
)
770 dsp_file
= DosSeparator ( std::string(".\\") + dsp_file
);
772 // TODO FIXME - must they be sorted?
773 //@dependencies = sort(@dependencies);
775 fprintf ( OUT
, "###############################################################################\r\n" );
776 fprintf ( OUT
, "\r\n" );
777 fprintf ( OUT
, "Project: \"%s\"=%s - Package Owner=<4>\r\n", module
.name
.c_str(), dsp_file
.c_str() );
778 fprintf ( OUT
, "\r\n" );
779 fprintf ( OUT
, "Package=<5>\r\n" );
780 fprintf ( OUT
, "{{{\r\n" );
781 fprintf ( OUT
, "}}}\r\n" );
782 fprintf ( OUT
, "\r\n" );
783 fprintf ( OUT
, "Package=<4>\r\n" );
784 fprintf ( OUT
, "{{{\r\n" );
785 for ( size_t i
= 0; i
< dependencies
.size(); i
++ )
787 Dependency
& dependency
= *dependencies
[i
];
788 fprintf ( OUT
, " Begin Project Dependency\r\n" );
789 fprintf ( OUT
, " Project_Dep_Name %s\r\n", dependency
.module
.name
.c_str() );
790 fprintf ( OUT
, " End Project Dependency\r\n" );
792 fprintf ( OUT
, "}}}\r\n" );
793 fprintf ( OUT
, "\r\n" );
797 MSVCBackend::_generate_dsw_footer ( FILE* OUT
)
799 fprintf ( OUT
, "###############################################################################\r\n" );
800 fprintf ( OUT
, "\r\n" );
801 fprintf ( OUT
, "Global:\r\n" );
802 fprintf ( OUT
, "\r\n" );
803 fprintf ( OUT
, "Package=<5>\r\n" );
804 fprintf ( OUT
, "{{{\r\n" );
805 fprintf ( OUT
, "}}}\r\n" );
806 fprintf ( OUT
, "\r\n" );
807 fprintf ( OUT
, "Package=<3>\r\n" );
808 fprintf ( OUT
, "{{{\r\n" );
809 fprintf ( OUT
, "}}}\r\n" );
810 fprintf ( OUT
, "\r\n" );
811 fprintf ( OUT
, "###############################################################################\r\n" );
812 fprintf ( OUT
, "\r\n" );
816 MSVCBackend::_generate_wine_dsw ( FILE* OUT
)
818 _generate_dsw_header(OUT
);
819 // TODO FIXME - is it necessary to sort them?
820 for ( size_t i
= 0; i
< ProjectNode
.modules
.size(); i
++ )
822 Module
& module
= *ProjectNode
.modules
[i
];
824 std::string dsp_file
= DspFileName ( module
);
826 // TODO FIXME - more wine hacks?
827 /*if ( module.name == "gdi32" )
829 for ( size_t idir = 0; idir < gdi32_dirs.size(); idir++ )
831 string dir2 = gdi32_dirs[idir];
832 $dir2 =~ s%^.*?/([^/]+)$%$1%;
834 dependencies.push_back ( Replace ( "gdi32_" + dir2, "/", "_" ) );
838 _generate_dsw_project ( OUT
, module
, dsp_file
, module
.dependencies
);
840 _generate_dsw_footer ( OUT
);