34444cd544ef281c9edc67e684444cb16e8a953c
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 for ( i
= 0; i
< defines
.size(); i
++ )
313 fprintf ( OUT
, " /D \"%s\"", defines
[i
].c_str() );
315 if ( lib
|| exe
) fprintf ( OUT
, " /YX" );
316 fprintf ( OUT
, " /FD" );
319 fprintf ( OUT
, " /GZ" );
320 if ( lib
|| exe
) fprintf ( OUT
, " " );
322 fprintf ( OUT
, " /c" );
323 fprintf ( OUT
, "\r\n" );
325 vector
<string
> defines2
;
326 defines2
.push_back ( "WINVER=0x0501" );
327 defines2
.push_back ( "_WIN32_WINNT=0x0501" );
328 defines2
.push_back ( "_WIN32_IE=0x0600" );
329 defines2
.push_back ( "WIN32" );
330 defines2
.push_back ( "_WINDOWS" );
331 defines2
.push_back ( "_MBCS" );
334 defines2
.push_back ( "_DEBUG" );
337 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
338 defines2
.push_back ( "_LIB" );
342 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
343 defines2
.push_back ( "_USRDLL" );
348 defines2
.push_back ( "NDEBUG" );
351 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
352 defines2
.push_back ( "_LIB" );
356 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
357 defines2
.push_back ( "_USRDLL" );
361 std::vector
<std::string
> includes
;
362 // TODO FIXME - wine hack?
365 // TODO FIXME - wine hack?
366 //defines2.push_back ( string("_\U") + module.name + "\E_" );
367 // TODO FIXME - wine hack?
368 /*if ( module.name !~ /^(?:wine(?:build|test)|.*?_test)$/ )
369 defines2.push_back ( "__WINESRC__" );*/
371 defines2
.push_back ( "__WINE_USE_NATIVE_HEADERS" );
372 string output_dir2
= Replace(output_dir
,"\\","\\\\");
373 defines2
.push_back ( ssprintf("__WINETEST_OUTPUT_DIR=\\\"%s\\\"",output_dir
.c_str()) );
374 defines2
.push_back ( "__i386__" );
375 defines2
.push_back ( "_X86_" );
377 // TODO FIXME - wine hacks?
378 /*if(module.name =~ /^gdi32_(?:enhmfdrv|mfdrv)$/) {
379 push @includes, ".." );
382 if ( strstr ( module.name.c_str(), "_test" )
384 include.push_back ( msvc_wine_dir + "\\" + output_dir );
387 if (!msvc_headers || module.name == "winetest")
389 includes.push_back ( wine_include_dir );
395 for ( i
= 0; i
< includes
.size(); i
++ );
397 const string
& include
= includes
[i
];
398 if ( strpbrk ( include
.c_str(), "[\\\"]" ) )
400 fprintf ( OUT
, " /I \"%s\"", include
.c_str() );
404 fprintf ( OUT
, " /I %s", include
.c_str() );
409 for ( i
= 0; i
< defines2
.size(); i
++ )
411 const string
& define
= defines2
[i
];
412 if ( strpbrk ( define
.c_str(), "[\\\"]" ) )
414 fprintf ( OUT
, " /D \"%s\"", define
.c_str() );
418 fprintf ( OUT
, " /D %s", define
.c_str() );
421 if ( wine
) fprintf ( OUT
, " /D inline=__inline" );
422 if ( 0 && wine
) fprintf ( OUT
, " /D \"__STDC__\"" );
424 fprintf ( OUT
, lib
? " /YX" : " /FR" );
425 fprintf ( OUT
, " /FD" );
426 if ( debug
) fprintf ( OUT
, " /GZ" );
427 if ( debug
&& lib
) fprintf ( OUT
, " " );
428 fprintf ( OUT
, " /c" );
429 if ( !no_cpp
) fprintf ( OUT
, " /TP" );
430 fprintf ( OUT
, "\r\n" );
436 fprintf ( OUT
, "# SUBTRACT CPP /X /YX\r\n" );
437 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n" );
438 fprintf ( OUT
, "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n" );
440 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"_DEBUG\"\r\n" );
441 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
444 for ( i
= 0; i
< includes
.size(); i
++ )
446 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
449 fprintf ( OUT
, " /d \"_DEBUG\"\r\n" );
455 fprintf ( OUT
, "# SUBTRACT CPP /YX\r\n" );
456 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n" );
457 fprintf ( OUT
, "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n" );
459 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"NDEBUG\"\r\n" );
460 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
463 for ( i
= 0; i
< includes
.size(); i
++ )
464 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
466 fprintf ( OUT
, "/d \"NDEBUG\"\r\n" );
468 fprintf ( OUT
, "BSC32=bscmake.exe\r\n" );
469 fprintf ( OUT
, "# ADD BASE BSC32 /nologo\r\n" );
470 fprintf ( OUT
, "# ADD BSC32 /nologo\r\n" );
474 fprintf ( OUT
, "LINK32=link.exe\r\n" );
475 fprintf ( OUT
, "# ADD BASE LINK32 " );
476 vector
<string
> libraries
;
477 libraries
.push_back ( "kernel32.lib" );
478 libraries
.push_back ( "user32.lib" );
479 libraries
.push_back ( "gdi32.lib" );
480 libraries
.push_back ( "winspool.lib" );
481 libraries
.push_back ( "comdlg32.lib" );
482 libraries
.push_back ( "advapi32.lib" );
483 libraries
.push_back ( "shell32.lib" );
484 libraries
.push_back ( "ole32.lib" );
485 libraries
.push_back ( "oleaut32.lib" );
486 libraries
.push_back ( "uuid.lib" );
487 libraries
.push_back ( "odbc32.lib" );
488 libraries
.push_back ( "odbccp32.lib" );
489 for ( i
= 0; i
< libraries
.size(); i
++ )
491 fprintf ( OUT
, "%s ", libraries
[i
].c_str() );
493 fprintf ( OUT
, " /nologo" );
494 if ( dll
) fprintf ( OUT
, " /dll" );
495 if ( console
) fprintf ( OUT
, " /subsystem:console" );
496 if ( debug
) fprintf ( OUT
, " /debug" );
497 fprintf ( OUT
, " /machine:I386" );
498 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
499 fprintf ( OUT
, "\r\n" );
501 fprintf ( OUT
, "# ADD LINK32" );
502 fprintf ( OUT
, " /nologo" );
503 // TODO FIXME - do we need their kludge?
504 //if ( module.name == "ntdll" ) fprintf ( OUT, " libcmt.lib" ); // FIXME: Kludge
505 for ( i
= 0; i
< imports
.size(); i
++ )
507 const string
& import
= imports
[i
];
508 if ( import
!= "msvcrt" )
509 fprintf ( OUT
, " %s.lib", import
.c_str() );
511 if ( dll
) fprintf ( OUT
, " /dll" );
512 if ( console
) fprintf ( OUT
, " /subsystem:console" );
513 if ( debug
) fprintf ( OUT
, " /debug" );
514 fprintf ( OUT
, " /machine:I386" );
515 // TODO FIXME - do we need their kludge?
516 //if ( module.name == "ntdll" ) fprintf ( OUT, " /nodefaultlib" ); // FIXME: Kludge
517 if ( dll
) fprintf ( OUT
, " /def:\"%s.def\"", module
.name
.c_str() );
518 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
519 fprintf ( OUT
, "\r\n" );
523 fprintf ( OUT
, "LIB32=link.exe -lib\r\n" );
524 fprintf ( OUT
, "# ADD BASE LIB32 /nologo\r\n" );
525 fprintf ( OUT
, "# ADD LIB32 /nologo\r\n" );
531 if ( cfgs
.size() != 0 )
533 fprintf ( OUT
, "\r\n" );
534 fprintf ( OUT
, "!ENDIF \r\n" );
535 fprintf ( OUT
, "\r\n" );
538 if ( module
.name
== "winebuild" )
540 fprintf ( OUT
, "# Begin Special Build Tool\r\n" );
541 fprintf ( OUT
, "SOURCE=\"$(InputPath)\"\r\n" );
542 fprintf ( OUT
, "PostBuild_Desc=Copying wine.dll and wine_unicode.dll ...\r\n" );
543 fprintf ( OUT
, "PostBuild_Cmds=" );
544 fprintf ( OUT
, "copy ..\\..\\library\\%s\\wine.dll $(OutDir)\t",
545 output_dir
.c_str() );
546 fprintf ( OUT
, "copy ..\\..\\unicode\\%s\\wine_unicode.dll $(OutDir)\r\n",
547 output_dir
.c_str() );
548 fprintf ( OUT
, "# End Special Build Tool\r\n" );
551 fprintf ( OUT
, "# Begin Target\r\n" );
552 fprintf ( OUT
, "\r\n" );
553 for ( i
= 0; i
< cfgs
.size(); i
++ )
555 fprintf ( OUT
, "# Name \"%s\"\r\n", cfgs
[i
].c_str() );
558 fprintf ( OUT
, "# Begin Group \"Source Files\"\r\n" );
559 fprintf ( OUT
, "\r\n" );
560 fprintf ( OUT
, "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\r\n" );
562 for ( size_t isrcfile
= 0; isrcfile
< source_files
.size(); isrcfile
++ )
564 string source_file
= DosSeparator(source_files
[isrcfile
]);
566 if ( strncmp ( source_file
.c_str(), ".\\", 2 ) )
568 source_file
= string(".\\") + source_file
;
571 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
573 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
575 // TODO FIXME - not sure what this is doing? wine hack maybe?
576 //if ( basename !~ /\..{1,3}$/; ) basename += string(".dll");
577 string dbg_c_file
= basename
+ ".dbg.c";
579 fprintf ( OUT
, "# Begin Source File\r\n" );
580 fprintf ( OUT
, "\r\n" );
581 fprintf ( OUT
, "SOURCE=%s\r\n", dbg_c_file
.c_str() );
582 fprintf ( OUT
, "# End Source File\r\n" );
585 fprintf ( OUT
, "# Begin Source File\r\n" );
586 fprintf ( OUT
, "\r\n" );
588 fprintf ( OUT
, "SOURCE=%s\r\n", source_file
.c_str() );
590 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
593 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
595 string spec_file
= source_file
;
596 string def_file
= basename
+ ".def";
598 // TODO FIXME - not sure what this is doing? wine hack maybe?
599 //if ( basename !~ /\..{1,3}$/; ) basename += ".dll";
600 string dbg_file
= basename
+ ".dbg";
601 string dbg_c_file
= basename
+ ".dbg.c";
603 string srcdir
= "."; // FIXME: Is this really always correct?
605 fprintf ( OUT
, "# Begin Custom Build\r\n" );
606 fprintf ( OUT
, "InputPath=%s\r\n", spec_file
.c_str() );
607 fprintf ( OUT
, "\r\n" );
608 fprintf ( OUT
, "BuildCmds= \\\r\n" );
609 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe --def %s > %s \\\r\n",
614 if ( module
.name
== "ntdll" )
617 for ( i
= 0; i
< c_srcs
.size(); i
++ )
619 const string
& c_src
= c_srcs
[i
];
622 fprintf ( OUT
, "\techo %s >> %s \\\r\n", c_src
.c_str(), dbg_file
.c_str() );
626 fprintf ( OUT
, "\techo %s > %s \\\r\n", c_src
.c_str(), dbg_file
.c_str() );
629 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
630 output_dir
.c_str() );
631 fprintf ( OUT
, " -o %s --debug -C%s %s \\\r\n",
639 for ( i
= 0; i
< c_srcs
.size(); i
++ )
641 const string
& c_src
= c_srcs
[i
];
642 if ( !strcmp ( &c_src
[c_src
.size()-2], ".c" ) )
644 if ( sc_srcs
.size() )
650 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
651 output_dir
.c_str() );
652 fprintf ( OUT
, " -o %s --debug -C%s %s \\\r\n",
658 fprintf ( OUT
, "\t\r\n" );
659 fprintf ( OUT
, "\r\n" );
660 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", def_file
.c_str() );
661 fprintf ( OUT
, " $(BuildCmds)\r\n" );
662 fprintf ( OUT
, "\r\n" );
663 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", dbg_c_file
.c_str() );
664 fprintf ( OUT
, " $(BuildCmds)\r\n" );
665 fprintf ( OUT
, "# End Custom Build\r\n" );
668 /*else if ( source_file =~ /([^\\]*?\.h)$/ )
672 foreach my $cfg (@cfgs) {
676 fprintf ( OUT, "!IF \"$(CFG)\" == \"$cfg\"\r\n" );
677 fprintf ( OUT, "\r\n" );
679 fprintf ( OUT, "\r\n" );
680 fprintf ( OUT, "!ELSEIF \"$(CFG)\" == \"$cfg\"\r\n" );
681 fprintf ( OUT, "\r\n" );
685 $output_dir =~ s/^$project - //;
686 $output_dir =~ s/ /_/g;
687 $output_dir =~ s/C\+\+/Cxx/g;
688 if($output_prefix_dir) {
689 $output_dir = "$output_prefix_dir\\$output_dir" );
692 fprintf ( OUT, "# Begin Custom Build\r\n" );
693 fprintf ( OUT, "OutDir=%s\r\n", output_dir.c_str() );
694 fprintf ( OUT, "InputPath=%s\r\n", source_file.c_str() );
695 fprintf ( OUT, "\r\n" );
696 fprintf ( OUT, "\"$(OutDir)\\wine\\%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\r\n", h_file.c_str() );
697 fprintf ( OUT, "\tcopy \"$(InputPath)\" \"$(OutDir)\\wine\"\r\n" );
698 fprintf ( OUT, "\r\n" );
699 fprintf ( OUT, "# End Custom Build\r\n" );
702 if ( cfgs.size() != 0)
704 fprintf ( OUT, "\r\n" );
705 fprintf ( OUT, "!ENDIF \r\n" );
706 fprintf ( OUT, "\r\n" );
710 fprintf ( OUT
, "# End Source File\r\n" );
712 fprintf ( OUT
, "# End Group\r\n" );
713 fprintf ( OUT
, "# Begin Group \"Header Files\"\r\n" );
714 fprintf ( OUT
, "\r\n" );
715 fprintf ( OUT
, "# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\r\n" );
716 for ( i
= 0; i
< header_files
.size(); i
++ )
718 const string
& header_file
= header_files
[i
];
719 fprintf ( OUT
, "# Begin Source File\r\n" );
720 fprintf ( OUT
, "\r\n" );
721 fprintf ( OUT
, "SOURCE=.\\%s\r\n", header_file
.c_str() );
722 fprintf ( OUT
, "# End Source File\r\n" );
724 fprintf ( OUT
, "# End Group\r\n" );
728 fprintf ( OUT
, "# Begin Group \"Resource Files\"\r\n" );
729 fprintf ( OUT
, "\r\n" );
730 fprintf ( OUT
, "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\r\n" );
731 for ( i
= 0; i
< resource_files
.size(); i
++ )
733 const string
& resource_file
= resource_files
[i
];
734 fprintf ( OUT
, "# Begin Source File\r\n" );
735 fprintf ( OUT
, "\r\n" );
736 fprintf ( OUT
, "SOURCE=.\\%s\r\n", resource_file
.c_str() );
737 fprintf ( OUT
, "# End Source File\r\n" );
739 fprintf ( OUT
, "# End Group\r\n" );
741 fprintf ( OUT
, "# End Target\r\n" );
742 fprintf ( OUT
, "# End Project\r\n" );
748 MSVCBackend::_generate_dsw_header ( FILE* OUT
)
750 fprintf ( OUT
, "Microsoft Developer Studio Workspace File, Format Version 6.00\r\n" );
751 fprintf ( OUT
, "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r\n" );
752 fprintf ( OUT
, "\r\n" );
756 MSVCBackend::_generate_dsw_project (
758 const Module
& module
,
759 std::string dsp_file
,
760 const std::vector
<Dependency
*>& dependencies
)
762 dsp_file
= DosSeparator ( std::string(".\\") + dsp_file
);
764 // TODO FIXME - must they be sorted?
765 //@dependencies = sort(@dependencies);
767 fprintf ( OUT
, "###############################################################################\r\n" );
768 fprintf ( OUT
, "\r\n" );
769 fprintf ( OUT
, "Project: \"%s\"=%s - Package Owner=<4>\r\n", module
.name
.c_str(), dsp_file
.c_str() );
770 fprintf ( OUT
, "\r\n" );
771 fprintf ( OUT
, "Package=<5>\r\n" );
772 fprintf ( OUT
, "{{{\r\n" );
773 fprintf ( OUT
, "}}}\r\n" );
774 fprintf ( OUT
, "\r\n" );
775 fprintf ( OUT
, "Package=<4>\r\n" );
776 fprintf ( OUT
, "{{{\r\n" );
777 for ( size_t i
= 0; i
< dependencies
.size(); i
++ )
779 Dependency
& dependency
= *dependencies
[i
];
780 fprintf ( OUT
, " Begin Project Dependency\r\n" );
781 fprintf ( OUT
, " Project_Dep_Name %s\r\n", dependency
.module
.name
.c_str() );
782 fprintf ( OUT
, " End Project Dependency\r\n" );
784 fprintf ( OUT
, "}}}\r\n" );
785 fprintf ( OUT
, "\r\n" );
789 MSVCBackend::_generate_dsw_footer ( FILE* OUT
)
791 fprintf ( OUT
, "###############################################################################\r\n" );
792 fprintf ( OUT
, "\r\n" );
793 fprintf ( OUT
, "Global:\r\n" );
794 fprintf ( OUT
, "\r\n" );
795 fprintf ( OUT
, "Package=<5>\r\n" );
796 fprintf ( OUT
, "{{{\r\n" );
797 fprintf ( OUT
, "}}}\r\n" );
798 fprintf ( OUT
, "\r\n" );
799 fprintf ( OUT
, "Package=<3>\r\n" );
800 fprintf ( OUT
, "{{{\r\n" );
801 fprintf ( OUT
, "}}}\r\n" );
802 fprintf ( OUT
, "\r\n" );
803 fprintf ( OUT
, "###############################################################################\r\n" );
804 fprintf ( OUT
, "\r\n" );
808 MSVCBackend::_generate_wine_dsw ( FILE* OUT
)
810 _generate_dsw_header(OUT
);
811 // TODO FIXME - is it necessary to sort them?
812 for ( size_t i
= 0; i
< ProjectNode
.modules
.size(); i
++ )
814 Module
& module
= *ProjectNode
.modules
[i
];
816 std::string dsp_file
= DspFileName ( module
);
818 // TODO FIXME - more wine hacks?
819 /*if ( module.name == "gdi32" )
821 for ( size_t idir = 0; idir < gdi32_dirs.size(); idir++ )
823 string dir2 = gdi32_dirs[idir];
824 $dir2 =~ s%^.*?/([^/]+)$%$1%;
826 dependencies.push_back ( Replace ( "gdi32_" + dir2, "/", "_" ) );
830 _generate_dsw_project ( OUT
, module
, dsp_file
, module
.dependencies
);
832 _generate_dsw_footer ( OUT
);