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
;
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
);
82 // TODO FIXME - we don't include header files in our build system
83 //my @header_files = @{module->{header_files}};
84 vector
<string
> header_files
;
86 // TODO FIXME - wine hack?
87 /*if (module.name !~ /^wine(?:_unicode|build|runtests|test)?$/ &&
88 module.name !~ /^(?:gdi32)_.+?$/ &&
89 Right ( module.name, 5 ) == "_test" )
91 source_files.push_back ( module.name + ".spec" );
92 @source_files = sort(@source_files);
96 bool no_msvc_headers
= true;
97 // TODO FIXME - wine hack?
98 /*if (module.name =~ /^wine(?:runtests|test)$/
99 || Right ( module.name, 5 ) == "_test" )
101 no_msvc_headers = false;
104 std::vector
<std::string
> cfgs
;
106 cfgs
.push_back ( module
.name
+ " - Win32" );
110 std::vector
<std::string
> _cfgs
;
111 for ( i
= 0; i
< cfgs
.size(); i
++ )
113 _cfgs
.push_back ( cfgs
[i
] + " C" );
114 _cfgs
.push_back ( cfgs
[i
] + " C++" );
120 // TODO FIXME - wine hack?
123 std::vector<std::string> _cfgs;
124 for ( i = 0; i < cfgs.size(); i++ )
126 _cfgs.push_back ( cfgs[i] + " Debug" );
127 _cfgs.push_back ( cfgs[i] + " Release" );
133 if (!no_msvc_headers
)
135 std::vector
<std::string
> _cfgs
;
136 for ( i
= 0; i
< cfgs
.size(); i
++ )
138 _cfgs
.push_back ( cfgs
[i
] + " MSVC Headers" );
139 _cfgs
.push_back ( cfgs
[i
] + " Wine Headers" );
145 string default_cfg
= cfgs
.back();
147 fprintf ( OUT
, "# Microsoft Developer Studio Project File - Name=\"%s\" - Package Owner=<4>\r\n", module
.name
.c_str() );
148 fprintf ( OUT
, "# Microsoft Developer Studio Generated Build File, Format Version 6.00\r\n" );
149 fprintf ( OUT
, "# ** DO NOT EDIT **\r\n" );
150 fprintf ( OUT
, "\r\n" );
154 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\r\n" );
158 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\r\n" );
162 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\r\n" );
164 fprintf ( OUT
, "\r\n" );
166 fprintf ( OUT
, "CFG=%s\r\n", default_cfg
.c_str() );
167 fprintf ( OUT
, "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r\n" );
168 fprintf ( OUT
, "!MESSAGE use the Export Makefile command and run\r\n" );
169 fprintf ( OUT
, "!MESSAGE \r\n" );
170 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\".\r\n", module
.name
.c_str() );
171 fprintf ( OUT
, "!MESSAGE \r\n" );
172 fprintf ( OUT
, "!MESSAGE You can specify a configuration when running NMAKE\r\n" );
173 fprintf ( OUT
, "!MESSAGE by defining the macro CFG on the command line. For example:\r\n" );
174 fprintf ( OUT
, "!MESSAGE \r\n" );
175 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\" CFG=\"%s\"\r\n", module
.name
.c_str(), default_cfg
.c_str() );
176 fprintf ( OUT
, "!MESSAGE \r\n" );
177 fprintf ( OUT
, "!MESSAGE Possible choices for configuration are:\r\n" );
178 fprintf ( OUT
, "!MESSAGE \r\n" );
179 for ( i
= 0; i
< cfgs
.size(); i
++ )
181 const string
& cfg
= cfgs
[i
];
184 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Static Library\")\r\n", cfg
.c_str() );
188 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Dynamic-Link Library\")\r\n", cfg
.c_str() );
192 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Console Application\")\r\n", cfg
.c_str() );
195 fprintf ( OUT
, "!MESSAGE \r\n" );
196 fprintf ( OUT
, "\r\n" );
198 fprintf ( OUT
, "# Begin Project\r\n" );
199 fprintf ( OUT
, "# PROP AllowPerConfigDependencies 0\r\n" );
200 fprintf ( OUT
, "# PROP Scc_ProjName \"\"\r\n" );
201 fprintf ( OUT
, "# PROP Scc_LocalPath \"\"\r\n" );
202 fprintf ( OUT
, "CPP=cl.exe\r\n" );
203 if ( !lib
&& !exe
) fprintf ( OUT
, "MTL=midl.exe\r\n" );
204 fprintf ( OUT
, "RSC=rc.exe\r\n" );
208 std::string output_dir
;
209 for ( size_t icfg
= 0; icfg
< cfgs
.size(); icfg
++ )
211 std::string
& cfg
= cfgs
[icfg
];
216 fprintf ( OUT
, "!IF \"$(CFG)\" == \"%s\"\r\n", cfg
.c_str() );
217 fprintf ( OUT
, "\r\n" );
221 fprintf ( OUT
, "\r\n" );
222 fprintf ( OUT
, "!ELSEIF \"$(CFG)\" == \"%s\"\r\n", cfg
.c_str() );
223 fprintf ( OUT
, "\r\n" );
227 bool debug
= !strstr ( cfg
.c_str(), "Release" );
228 bool msvc_headers
= ( 0 != strstr ( cfg
.c_str(), "MSVC Headers" ) );
230 fprintf ( OUT
, "# PROP BASE Use_MFC 0\r\n" );
234 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 1\r\n" );
238 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 0\r\n" );
241 output_dir
= Replace(cfg
,module
.name
+ " - ","");
242 output_dir
= Replace(output_dir
," ","_");
243 output_dir
= Replace(output_dir
,"C++","Cxx");
244 // TODO FIXME - wine hack?
245 //if ( output_prefix_dir.size() )
246 // output_dir = output_prefix_dir + "\\" + output_dir;
248 fprintf ( OUT
, "# PROP BASE Output_Dir \"%s\"\r\n", output_dir
.c_str() );
249 fprintf ( OUT
, "# PROP BASE Intermediate_Dir \"%s\"\r\n", output_dir
.c_str() );
251 fprintf ( OUT
, "# PROP BASE Target_Dir \"\"\r\n" );
253 fprintf ( OUT
, "# PROP Use_MFC 0\r\n" );
256 fprintf ( OUT
, "# PROP Use_Debug_Libraries 1\r\n" );
260 fprintf ( OUT
, "# PROP Use_Debug_Libraries 0\r\n" );
262 fprintf ( OUT
, "# PROP Output_Dir \"%s\"\r\n", output_dir
.c_str() );
263 fprintf ( OUT
, "# PROP Intermediate_Dir \"%s\"\r\n", output_dir
.c_str() );
265 if ( dll
) fprintf ( OUT
, "# PROP Ignore_Export_Lib 0\r\n" );
266 fprintf ( OUT
, "# PROP Target_Dir \"\"\r\n" );
268 vector
<string
> defines
;
269 defines
.push_back ( "WINVER=0x0501" );
270 defines
.push_back ( "_WIN32_WINNT=0x0501" );
271 defines
.push_back ( "_WIN32_IE=0x0600" );
272 defines
.push_back ( "WIN32" );
273 defines
.push_back ( "_WINDOWS" );
274 defines
.push_back ( "WIN32" );
275 defines
.push_back ( "_MBCS" );
278 defines
.push_back ( "_DEBUG" );
281 fprintf ( OUT
, "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od" );
282 defines
.push_back ( "_LIB" );
286 fprintf ( OUT
, "# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
287 defines
.push_back ( "_WINDOWS" );
288 defines
.push_back ( "_USRDLL" );
289 // TODO FIXME - wine hack?
290 //defines.push_back ( string("\U") + module.name + "\E_EXPORTS" );
295 defines
.push_back ( "NDEBUG" );
298 fprintf ( OUT
, "# ADD BASE CPP /nologo /W3 /GX /O2" );
299 defines
.push_back ( "_LIB" );
303 fprintf ( OUT
, "# ADD BASE CPP /nologo /MT /W3 /GX /O2" );
304 defines
.push_back ( "_WINDOWS" );
305 defines
.push_back ( "_USRDLL" );
306 // TODO FIXME - wine hack?
307 //defines.push_back ( string("\U") + module.name + "\E_EXPORTS" );
311 fprintf ( OUT
, " /I \".\"" );
312 for ( i
= 0; i
< defines
.size(); i
++ )
314 fprintf ( OUT
, " /D \"%s\"", defines
[i
].c_str() );
316 if ( lib
|| exe
) fprintf ( OUT
, " /YX" );
317 fprintf ( OUT
, " /FD" );
320 fprintf ( OUT
, " /GZ" );
321 if ( lib
|| exe
) fprintf ( OUT
, " " );
323 fprintf ( OUT
, " /c" );
324 fprintf ( OUT
, "\r\n" );
326 vector
<string
> defines2
;
327 defines2
.push_back ( "WINVER=0x0501" );
328 defines2
.push_back ( "_WIN32_WINNT=0x0501" );
329 defines2
.push_back ( "_WIN32_IE=0x0600" );
330 defines2
.push_back ( "WIN32" );
331 defines2
.push_back ( "_WINDOWS" );
332 defines2
.push_back ( "_MBCS" );
335 defines2
.push_back ( "_DEBUG" );
338 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
339 defines2
.push_back ( "_LIB" );
343 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
344 defines2
.push_back ( "_USRDLL" );
349 defines2
.push_back ( "NDEBUG" );
352 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
353 defines2
.push_back ( "_LIB" );
357 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
358 defines2
.push_back ( "_USRDLL" );
362 std::vector
<std::string
> includes
;
363 // TODO FIXME - wine hack?
366 // TODO FIXME - wine hack?
367 //defines2.push_back ( string("_\U") + module.name + "\E_" );
368 // TODO FIXME - wine hack?
369 /*if ( module.name !~ /^(?:wine(?:build|test)|.*?_test)$/ )
370 defines2.push_back ( "__WINESRC__" );*/
372 defines2
.push_back ( "__WINE_USE_NATIVE_HEADERS" );
373 string output_dir2
= Replace(output_dir
,"\\","\\\\");
374 defines2
.push_back ( ssprintf("__WINETEST_OUTPUT_DIR=\\\"%s\\\"",output_dir
.c_str()) );
375 defines2
.push_back ( "__i386__" );
376 defines2
.push_back ( "_X86_" );
378 // TODO FIXME - wine hacks?
379 /*if(module.name =~ /^gdi32_(?:enhmfdrv|mfdrv)$/) {
380 push @includes, ".." );
383 if ( strstr ( module.name.c_str(), "_test" )
385 include.push_back ( msvc_wine_dir + "\\" + output_dir );
388 if (!msvc_headers || module.name == "winetest")
390 includes.push_back ( wine_include_dir );
396 for ( i
= 0; i
< includes
.size(); i
++ );
398 const string
& include
= includes
[i
];
399 if ( strpbrk ( include
.c_str(), "[\\\"]" ) )
401 fprintf ( OUT
, " /I \"%s\"", include
.c_str() );
405 fprintf ( OUT
, " /I %s", include
.c_str() );
410 fprintf ( OUT
, " /I \".\"" );
411 for ( i
= 0; i
< defines2
.size(); i
++ )
413 const string
& define
= defines2
[i
];
414 if ( strpbrk ( define
.c_str(), "[\\\"]" ) )
416 fprintf ( OUT
, " /D \"%s\"", define
.c_str() );
420 fprintf ( OUT
, " /D %s", define
.c_str() );
423 if ( wine
) fprintf ( OUT
, " /D inline=__inline" );
424 if ( 0 && wine
) fprintf ( OUT
, " /D \"__STDC__\"" );
426 fprintf ( OUT
, lib
? " /YX" : " /FR" );
427 fprintf ( OUT
, " /FD" );
428 if ( debug
) fprintf ( OUT
, " /GZ" );
429 if ( debug
&& lib
) fprintf ( OUT
, " " );
430 fprintf ( OUT
, " /c" );
431 if ( !no_cpp
) fprintf ( OUT
, " /TP" );
432 fprintf ( OUT
, "\r\n" );
438 fprintf ( OUT
, "# SUBTRACT CPP /X /YX\r\n" );
439 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n" );
440 fprintf ( OUT
, "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n" );
442 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"_DEBUG\"\r\n" );
443 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
446 for ( i
= 0; i
< includes
.size(); i
++ )
448 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
451 fprintf ( OUT
, " /d \"_DEBUG\"\r\n" );
457 fprintf ( OUT
, "# SUBTRACT CPP /YX\r\n" );
458 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n" );
459 fprintf ( OUT
, "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n" );
461 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"NDEBUG\"\r\n" );
462 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
465 for ( i
= 0; i
< includes
.size(); i
++ )
466 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
468 fprintf ( OUT
, "/d \"NDEBUG\"\r\n" );
470 fprintf ( OUT
, "BSC32=bscmake.exe\r\n" );
471 fprintf ( OUT
, "# ADD BASE BSC32 /nologo\r\n" );
472 fprintf ( OUT
, "# ADD BSC32 /nologo\r\n" );
476 fprintf ( OUT
, "LINK32=link.exe\r\n" );
477 fprintf ( OUT
, "# ADD BASE LINK32 " );
478 vector
<string
> libraries
;
479 libraries
.push_back ( "kernel32.lib" );
480 libraries
.push_back ( "user32.lib" );
481 libraries
.push_back ( "gdi32.lib" );
482 libraries
.push_back ( "winspool.lib" );
483 libraries
.push_back ( "comdlg32.lib" );
484 libraries
.push_back ( "advapi32.lib" );
485 libraries
.push_back ( "shell32.lib" );
486 libraries
.push_back ( "ole32.lib" );
487 libraries
.push_back ( "oleaut32.lib" );
488 libraries
.push_back ( "uuid.lib" );
489 libraries
.push_back ( "odbc32.lib" );
490 libraries
.push_back ( "odbccp32.lib" );
491 for ( i
= 0; i
< libraries
.size(); i
++ )
493 fprintf ( OUT
, "%s ", libraries
[i
].c_str() );
495 fprintf ( OUT
, " /nologo" );
496 if ( dll
) fprintf ( OUT
, " /dll" );
497 if ( console
) fprintf ( OUT
, " /subsystem:console" );
498 if ( debug
) fprintf ( OUT
, " /debug" );
499 fprintf ( OUT
, " /machine:I386" );
500 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
501 fprintf ( OUT
, "\r\n" );
503 fprintf ( OUT
, "# ADD LINK32" );
504 fprintf ( OUT
, " /nologo" );
505 // TODO FIXME - do we need their kludge?
506 //if ( module.name == "ntdll" ) fprintf ( OUT, " libcmt.lib" ); // FIXME: Kludge
507 for ( i
= 0; i
< imports
.size(); i
++ )
509 const string
& import
= imports
[i
];
510 if ( import
!= "msvcrt" )
511 fprintf ( OUT
, " %s.lib", import
.c_str() );
513 if ( dll
) fprintf ( OUT
, " /dll" );
514 if ( console
) fprintf ( OUT
, " /subsystem:console" );
515 if ( debug
) fprintf ( OUT
, " /debug" );
516 fprintf ( OUT
, " /machine:I386" );
517 // TODO FIXME - do we need their kludge?
518 //if ( module.name == "ntdll" ) fprintf ( OUT, " /nodefaultlib" ); // FIXME: Kludge
519 if ( dll
) fprintf ( OUT
, " /def:\"%s.def\"", module
.name
.c_str() );
520 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
521 fprintf ( OUT
, "\r\n" );
525 fprintf ( OUT
, "LIB32=link.exe -lib\r\n" );
526 fprintf ( OUT
, "# ADD BASE LIB32 /nologo\r\n" );
527 fprintf ( OUT
, "# ADD LIB32 /nologo\r\n" );
533 if ( cfgs
.size() != 0 )
535 fprintf ( OUT
, "\r\n" );
536 fprintf ( OUT
, "!ENDIF \r\n" );
537 fprintf ( OUT
, "\r\n" );
540 if ( module
.name
== "winebuild" )
542 fprintf ( OUT
, "# Begin Special Build Tool\r\n" );
543 fprintf ( OUT
, "SOURCE=\"$(InputPath)\"\r\n" );
544 fprintf ( OUT
, "PostBuild_Desc=Copying wine.dll and wine_unicode.dll ...\r\n" );
545 fprintf ( OUT
, "PostBuild_Cmds=" );
546 fprintf ( OUT
, "copy ..\\..\\library\\%s\\wine.dll $(OutDir)\t",
547 output_dir
.c_str() );
548 fprintf ( OUT
, "copy ..\\..\\unicode\\%s\\wine_unicode.dll $(OutDir)\r\n",
549 output_dir
.c_str() );
550 fprintf ( OUT
, "# End Special Build Tool\r\n" );
553 fprintf ( OUT
, "# Begin Target\r\n" );
554 fprintf ( OUT
, "\r\n" );
555 for ( i
= 0; i
< cfgs
.size(); i
++ )
557 fprintf ( OUT
, "# Name \"%s\"\r\n", cfgs
[i
].c_str() );
560 fprintf ( OUT
, "# Begin Group \"Source Files\"\r\n" );
561 fprintf ( OUT
, "\r\n" );
562 fprintf ( OUT
, "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\r\n" );
564 for ( size_t isrcfile
= 0; isrcfile
< source_files
.size(); isrcfile
++ )
566 string source_file
= DosSeparator(source_files
[isrcfile
]);
568 if ( strncmp ( source_file
.c_str(), ".\\", 2 ) )
570 source_file
= string(".\\") + source_file
;
573 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
575 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
577 // TODO FIXME - not sure what this is doing? wine hack maybe?
578 //if ( basename !~ /\..{1,3}$/; ) basename += string(".dll");
579 string dbg_c_file
= basename
+ ".dbg.c";
581 fprintf ( OUT
, "# Begin Source File\r\n" );
582 fprintf ( OUT
, "\r\n" );
583 fprintf ( OUT
, "SOURCE=%s\r\n", dbg_c_file
.c_str() );
584 fprintf ( OUT
, "# End Source File\r\n" );
587 fprintf ( OUT
, "# Begin Source File\r\n" );
588 fprintf ( OUT
, "\r\n" );
590 fprintf ( OUT
, "SOURCE=%s\r\n", source_file
.c_str() );
592 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
595 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
597 string spec_file
= source_file
;
598 string def_file
= basename
+ ".def";
600 // TODO FIXME - not sure what this is doing? wine hack maybe?
601 //if ( basename !~ /\..{1,3}$/; ) basename += ".dll";
602 string dbg_file
= basename
+ ".dbg";
603 string dbg_c_file
= basename
+ ".dbg.c";
605 string srcdir
= "."; // FIXME: Is this really always correct?
607 fprintf ( OUT
, "# Begin Custom Build\r\n" );
608 fprintf ( OUT
, "InputPath=%s\r\n", spec_file
.c_str() );
609 fprintf ( OUT
, "\r\n" );
610 fprintf ( OUT
, "BuildCmds= \\\r\n" );
611 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe --def %s > %s \\\r\n",
616 if ( module
.name
== "ntdll" )
619 for ( i
= 0; i
< c_srcs
.size(); i
++ )
621 const string
& c_src
= c_srcs
[i
];
624 fprintf ( OUT
, "\techo %s >> %s \\\r\n", c_src
.c_str(), dbg_file
.c_str() );
628 fprintf ( OUT
, "\techo %s > %s \\\r\n", c_src
.c_str(), dbg_file
.c_str() );
631 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
632 output_dir
.c_str() );
633 fprintf ( OUT
, " -o %s --debug -C%s %s \\\r\n",
641 for ( i
= 0; i
< c_srcs
.size(); i
++ )
643 const string
& c_src
= c_srcs
[i
];
644 if ( !strcmp ( &c_src
[c_src
.size()-2], ".c" ) )
646 if ( sc_srcs
.size() )
652 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
653 output_dir
.c_str() );
654 fprintf ( OUT
, " -o %s --debug -C%s %s \\\r\n",
660 fprintf ( OUT
, "\t\r\n" );
661 fprintf ( OUT
, "\r\n" );
662 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", def_file
.c_str() );
663 fprintf ( OUT
, " $(BuildCmds)\r\n" );
664 fprintf ( OUT
, "\r\n" );
665 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", dbg_c_file
.c_str() );
666 fprintf ( OUT
, " $(BuildCmds)\r\n" );
667 fprintf ( OUT
, "# End Custom Build\r\n" );
670 /*else if ( source_file =~ /([^\\]*?\.h)$/ )
674 foreach my $cfg (@cfgs) {
678 fprintf ( OUT, "!IF \"$(CFG)\" == \"$cfg\"\r\n" );
679 fprintf ( OUT, "\r\n" );
681 fprintf ( OUT, "\r\n" );
682 fprintf ( OUT, "!ELSEIF \"$(CFG)\" == \"$cfg\"\r\n" );
683 fprintf ( OUT, "\r\n" );
687 $output_dir =~ s/^$project - //;
688 $output_dir =~ s/ /_/g;
689 $output_dir =~ s/C\+\+/Cxx/g;
690 if($output_prefix_dir) {
691 $output_dir = "$output_prefix_dir\\$output_dir" );
694 fprintf ( OUT, "# Begin Custom Build\r\n" );
695 fprintf ( OUT, "OutDir=%s\r\n", output_dir.c_str() );
696 fprintf ( OUT, "InputPath=%s\r\n", source_file.c_str() );
697 fprintf ( OUT, "\r\n" );
698 fprintf ( OUT, "\"$(OutDir)\\wine\\%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", h_file.c_str() );
699 fprintf ( OUT, "\tcopy \"$(InputPath)\" \"$(OutDir)\\wine\"\r\n" );
700 fprintf ( OUT, "\r\n" );
701 fprintf ( OUT, "# End Custom Build\r\n" );
704 if ( cfgs.size() != 0)
706 fprintf ( OUT, "\r\n" );
707 fprintf ( OUT, "!ENDIF \r\n" );
708 fprintf ( OUT, "\r\n" );
712 fprintf ( OUT
, "# End Source File\r\n" );
714 fprintf ( OUT
, "# End Group\r\n" );
715 fprintf ( OUT
, "# Begin Group \"Header Files\"\r\n" );
716 fprintf ( OUT
, "\r\n" );
717 fprintf ( OUT
, "# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\r\n" );
718 for ( i
= 0; i
< header_files
.size(); i
++ )
720 const string
& header_file
= header_files
[i
];
721 fprintf ( OUT
, "# Begin Source File\r\n" );
722 fprintf ( OUT
, "\r\n" );
723 fprintf ( OUT
, "SOURCE=.\\%s\r\n", header_file
.c_str() );
724 fprintf ( OUT
, "# End Source File\r\n" );
726 fprintf ( OUT
, "# End Group\r\n" );
730 fprintf ( OUT
, "# Begin Group \"Resource Files\"\r\n" );
731 fprintf ( OUT
, "\r\n" );
732 fprintf ( OUT
, "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\r\n" );
733 for ( i
= 0; i
< resource_files
.size(); i
++ )
735 const string
& resource_file
= resource_files
[i
];
736 fprintf ( OUT
, "# Begin Source File\r\n" );
737 fprintf ( OUT
, "\r\n" );
738 fprintf ( OUT
, "SOURCE=.\\%s\r\n", resource_file
.c_str() );
739 fprintf ( OUT
, "# End Source File\r\n" );
741 fprintf ( OUT
, "# End Group\r\n" );
743 fprintf ( OUT
, "# End Target\r\n" );
744 fprintf ( OUT
, "# End Project\r\n" );
750 MSVCBackend::_generate_dsw_header ( FILE* OUT
)
752 fprintf ( OUT
, "Microsoft Developer Studio Workspace File, Format Version 6.00\r\n" );
753 fprintf ( OUT
, "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r\n" );
754 fprintf ( OUT
, "\r\n" );
758 MSVCBackend::_generate_dsw_project (
760 const Module
& module
,
761 std::string dsp_file
,
762 const std::vector
<Dependency
*>& dependencies
)
764 dsp_file
= DosSeparator ( std::string(".\\") + dsp_file
);
766 // TODO FIXME - must they be sorted?
767 //@dependencies = sort(@dependencies);
769 fprintf ( OUT
, "###############################################################################\r\n" );
770 fprintf ( OUT
, "\r\n" );
771 fprintf ( OUT
, "Project: \"%s\"=%s - Package Owner=<4>\r\n", module
.name
.c_str(), dsp_file
.c_str() );
772 fprintf ( OUT
, "\r\n" );
773 fprintf ( OUT
, "Package=<5>\r\n" );
774 fprintf ( OUT
, "{{{\r\n" );
775 fprintf ( OUT
, "}}}\r\n" );
776 fprintf ( OUT
, "\r\n" );
777 fprintf ( OUT
, "Package=<4>\r\n" );
778 fprintf ( OUT
, "{{{\r\n" );
779 for ( size_t i
= 0; i
< dependencies
.size(); i
++ )
781 Dependency
& dependency
= *dependencies
[i
];
782 fprintf ( OUT
, " Begin Project Dependency\r\n" );
783 fprintf ( OUT
, " Project_Dep_Name %s\r\n", dependency
.module
.name
.c_str() );
784 fprintf ( OUT
, " End Project Dependency\r\n" );
786 fprintf ( OUT
, "}}}\r\n" );
787 fprintf ( OUT
, "\r\n" );
791 MSVCBackend::_generate_dsw_footer ( FILE* OUT
)
793 fprintf ( OUT
, "###############################################################################\r\n" );
794 fprintf ( OUT
, "\r\n" );
795 fprintf ( OUT
, "Global:\r\n" );
796 fprintf ( OUT
, "\r\n" );
797 fprintf ( OUT
, "Package=<5>\r\n" );
798 fprintf ( OUT
, "{{{\r\n" );
799 fprintf ( OUT
, "}}}\r\n" );
800 fprintf ( OUT
, "\r\n" );
801 fprintf ( OUT
, "Package=<3>\r\n" );
802 fprintf ( OUT
, "{{{\r\n" );
803 fprintf ( OUT
, "}}}\r\n" );
804 fprintf ( OUT
, "\r\n" );
805 fprintf ( OUT
, "###############################################################################\r\n" );
806 fprintf ( OUT
, "\r\n" );
810 MSVCBackend::_generate_wine_dsw ( FILE* OUT
)
812 _generate_dsw_header(OUT
);
813 // TODO FIXME - is it necessary to sort them?
814 for ( size_t i
= 0; i
< ProjectNode
.modules
.size(); i
++ )
816 Module
& module
= *ProjectNode
.modules
[i
];
818 std::string dsp_file
= DspFileName ( module
);
820 // TODO FIXME - more wine hacks?
821 /*if ( module.name == "gdi32" )
823 for ( size_t idir = 0; idir < gdi32_dirs.size(); idir++ )
825 string dir2 = gdi32_dirs[idir];
826 $dir2 =~ s%^.*?/([^/]+)$%$1%;
828 dependencies.push_back ( Replace ( "gdi32_" + dir2, "/", "_" ) );
832 _generate_dsw_project ( OUT
, module
, dsp_file
, module
.dependencies
);
834 _generate_dsw_footer ( OUT
);