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(), "w" );
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 module.name !~ /_test$/)
89 push @source_files, "$project.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 || module.name =~ /_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>\n", module
.name
.c_str() );
146 fprintf ( OUT
, "# Microsoft Developer Studio Generated Build File, Format Version 6.00\n" );
147 fprintf ( OUT
, "# ** DO NOT EDIT **\n" );
148 fprintf ( OUT
, "\n" );
152 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\n" );
156 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\n" );
160 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n" );
162 fprintf ( OUT
, "\n" );
164 fprintf ( OUT
, "CFG=$default_cfg\n" );
165 fprintf ( OUT
, "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n" );
166 fprintf ( OUT
, "!MESSAGE use the Export Makefile command and run\n" );
167 fprintf ( OUT
, "!MESSAGE \n" );
168 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\".\n", module
.name
.c_str() );
169 fprintf ( OUT
, "!MESSAGE \n" );
170 fprintf ( OUT
, "!MESSAGE You can specify a configuration when running NMAKE\n" );
171 fprintf ( OUT
, "!MESSAGE by defining the macro CFG on the command line. For example:\n" );
172 fprintf ( OUT
, "!MESSAGE \n" );
173 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\" CFG=\"%s\"\n", module
.name
.c_str(), default_cfg
.c_str() );
174 fprintf ( OUT
, "!MESSAGE \n" );
175 fprintf ( OUT
, "!MESSAGE Possible choices for configuration are:\n" );
176 fprintf ( OUT
, "!MESSAGE \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\")\n", cfg
.c_str() );
186 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Dynamic-Link Library\")\n", cfg
.c_str() );
190 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Console Application\")\n", cfg
.c_str() );
193 fprintf ( OUT
, "!MESSAGE \n" );
194 fprintf ( OUT
, "\n" );
196 fprintf ( OUT
, "# Begin Project\n" );
197 fprintf ( OUT
, "# PROP AllowPerConfigDependencies 0\n" );
198 fprintf ( OUT
, "# PROP Scc_ProjName \"\"\n" );
199 fprintf ( OUT
, "# PROP Scc_LocalPath \"\"\n" );
200 fprintf ( OUT
, "CPP=cl.exe\n" );
201 if ( !lib
&& !exe
) fprintf ( OUT
, "MTL=midl.exe\n" );
202 fprintf ( OUT
, "RSC=rc.exe\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\"\n", cfg
.c_str() );
215 fprintf ( OUT
, "\n" );
219 fprintf ( OUT
, "\n" );
220 fprintf ( OUT
, "!ELSEIF \"$(CFG)\" == \"%s\"\n", cfg
.c_str() );
221 fprintf ( OUT
, "\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\n" );
232 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 1\n" );
236 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 0\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\"\n", output_dir
.c_str() );
247 fprintf ( OUT
, "# PROP BASE Intermediate_Dir \"%s\"\n", output_dir
.c_str() );
249 fprintf ( OUT
, "# PROP BASE Target_Dir \"\"\n" );
251 fprintf ( OUT
, "# PROP Use_MFC 0\n" );
254 fprintf ( OUT
, "# PROP Use_Debug_Libraries 1\n" );
258 fprintf ( OUT
, "# PROP Use_Debug_Libraries 0\n" );
260 fprintf ( OUT
, "# PROP Output_Dir \"%s\"\n", output_dir
.c_str() );
261 fprintf ( OUT
, "# PROP Intermediate_Dir \"%s\"\n", output_dir
.c_str() );
263 if ( dll
) fprintf ( OUT
, "# PROP Ignore_Export_Lib 0\n" );
264 fprintf ( OUT
, "# PROP Target_Dir \"\"\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
, "\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($project =~ /^gdi32_(?:enhmfdrv|mfdrv)$/) {
377 push @includes, ".." );
380 if ($project =~ /_test$/) {
381 push @includes, "$msvc_wine_dir\\$output_dir" );
384 if (!$msvc_headers || $project eq "winetest") {
385 push @includes, $wine_include_dir;
391 for ( i
= 0; i
< includes
.size(); i
++ );
393 const string
& include
= includes
[i
];
394 if ( strpbrk ( include
.c_str(), "[\\\"]" ) )
396 fprintf ( OUT
, " /I \"%s\"", include
.c_str() );
400 fprintf ( OUT
, " /I %s", include
.c_str() );
405 for ( i
= 0; i
< defines2
.size(); i
++ )
407 const string
& define
= defines2
[i
];
408 if ( strpbrk ( define
.c_str(), "[\\\"]" ) )
410 fprintf ( OUT
, " /D \"%s\"", define
.c_str() );
414 fprintf ( OUT
, " /D %s", define
.c_str() );
417 if ( wine
) fprintf ( OUT
, " /D inline=__inline" );
418 //fprintf ( OUT, " /D \"__STDC__\"" if 0 && $wine;
420 fprintf ( OUT
, lib
? " /YX" : " /FR" );
421 fprintf ( OUT
, " /FD" );
422 if ( debug
) fprintf ( OUT
, " /GZ" );
423 if ( debug
&& lib
) fprintf ( OUT
, " " );
424 fprintf ( OUT
, " /c" );
425 if ( !no_cpp
) fprintf ( OUT
, " /TP" );
426 fprintf ( OUT
, "\n" );
432 fprintf ( OUT
, "# SUBTRACT CPP /X /YX\n" );
433 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\n" );
434 fprintf ( OUT
, "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\n" );
436 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"_DEBUG\"\n" );
437 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
440 for ( i
= 0; i
< includes
.size(); i
++ )
442 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
445 fprintf ( OUT
, " /d \"_DEBUG\"\n" );
451 fprintf ( OUT
, "# SUBTRACT CPP /YX\n" );
452 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\n" );
453 fprintf ( OUT
, "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\n" );
455 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"NDEBUG\"\n" );
456 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
459 for ( i
= 0; i
< includes
.size(); i
++ )
460 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
462 fprintf ( OUT
, "/d \"NDEBUG\"\n" );
464 fprintf ( OUT
, "BSC32=bscmake.exe\n" );
465 fprintf ( OUT
, "# ADD BASE BSC32 /nologo\n" );
466 fprintf ( OUT
, "# ADD BSC32 /nologo\n" );
470 fprintf ( OUT
, "LINK32=link.exe\n" );
471 fprintf ( OUT
, "# ADD BASE LINK32 " );
472 vector
<string
> libraries
;
473 libraries
.push_back ( "kernel32.lib" );
474 libraries
.push_back ( "user32.lib" );
475 libraries
.push_back ( "gdi32.lib" );
476 libraries
.push_back ( "winspool.lib" );
477 libraries
.push_back ( "comdlg32.lib" );
478 libraries
.push_back ( "advapi32.lib" );
479 libraries
.push_back ( "shell32.lib" );
480 libraries
.push_back ( "ole32.lib" );
481 libraries
.push_back ( "oleaut32.lib" );
482 libraries
.push_back ( "uuid.lib" );
483 libraries
.push_back ( "odbc32.lib" );
484 libraries
.push_back ( "odbccp32.lib" );
485 for ( i
= 0; i
< libraries
.size(); i
++ )
487 fprintf ( OUT
, "%s ", libraries
[i
].c_str() );
489 fprintf ( OUT
, " /nologo" );
490 if ( dll
) fprintf ( OUT
, " /dll" );
491 if ( console
) fprintf ( OUT
, " /subsystem:console" );
492 if ( debug
) fprintf ( OUT
, " /debug" );
493 fprintf ( OUT
, " /machine:I386" );
494 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
495 fprintf ( OUT
, "\n" );
497 fprintf ( OUT
, "# ADD LINK32" );
498 fprintf ( OUT
, " /nologo" );
499 // TODO FIXME - do we need their kludge?
500 //fprintf ( OUT, " libcmt.lib" if $project =~ /^ntdll$/; # FIXME: Kludge
501 for ( i
= 0; i
< imports
.size(); i
++ )
503 const string
& import
= imports
[i
];
504 if ( import
!= "msvcrt" )
505 fprintf ( OUT
, " %s.lib", import
.c_str() );
507 if ( dll
) fprintf ( OUT
, " /dll" );
508 if ( console
) fprintf ( OUT
, " /subsystem:console" );
509 if ( debug
) fprintf ( OUT
, " /debug" );
510 fprintf ( OUT
, " /machine:I386" );
511 // TODO FIXME - do we need their kludge?
512 //fprintf ( OUT, " /nodefaultlib" if $project =~ /^ntdll$/; # FIXME: Kludge
513 if ( dll
) fprintf ( OUT
, " /def:\"%s.def\"", module
.name
.c_str() );
514 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
515 fprintf ( OUT
, "\n" );
519 fprintf ( OUT
, "LIB32=link.exe -lib\n" );
520 fprintf ( OUT
, "# ADD BASE LIB32 /nologo\n" );
521 fprintf ( OUT
, "# ADD LIB32 /nologo\n" );
527 if ( cfgs
.size() != 0 )
529 fprintf ( OUT
, "\n" );
530 fprintf ( OUT
, "!ENDIF \n" );
531 fprintf ( OUT
, "\n" );
534 if ( module
.name
== "winebuild" )
536 fprintf ( OUT
, "# Begin Special Build Tool\n" );
537 fprintf ( OUT
, "SOURCE=\"$(InputPath)\"\n" );
538 fprintf ( OUT
, "PostBuild_Desc=Copying wine.dll and wine_unicode.dll ...\n" );
539 fprintf ( OUT
, "PostBuild_Cmds=" );
540 fprintf ( OUT
, "copy ..\\..\\library\\%s\\wine.dll $(OutDir)\t",
541 output_dir
.c_str() );
542 fprintf ( OUT
, "copy ..\\..\\unicode\\%s\\wine_unicode.dll $(OutDir)\n",
543 output_dir
.c_str() );
544 fprintf ( OUT
, "# End Special Build Tool\n" );
546 fprintf ( OUT
, "# Begin Target\n" );
547 fprintf ( OUT
, "\n" );
548 for ( i
= 0; i
< cfgs
.size(); i
++ )
550 fprintf ( OUT
, "# Name \"%s\"\n", cfgs
[i
].c_str() );
553 fprintf ( OUT
, "# Begin Group \"Source Files\"\n" );
554 fprintf ( OUT
, "\n" );
555 fprintf ( OUT
, "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n" );
557 for ( size_t isrcfile
= 0; isrcfile
< source_files
.size(); isrcfile
++ )
559 string source_file
= DosSeparator(source_files
[isrcfile
]);
561 if ( strncmp ( source_file
.c_str(), ".\\", 2 ) )
563 source_file
= string(".\\") + source_file
;
566 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
568 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
570 // TODO FIXME - not sure what this is doing? wine hack maybe?
571 //if ( $basename !~ /\..{1,3}$/; ) basename += string(".dll");
572 string dbg_c_file
= basename
+ ".dbg.c";
574 fprintf ( OUT
, "# Begin Source File\n" );
575 fprintf ( OUT
, "\n" );
576 fprintf ( OUT
, "SOURCE=%s\n", dbg_c_file
.c_str() );
577 fprintf ( OUT
, "# End Source File\n" );
580 fprintf ( OUT
, "# Begin Source File\n" );
581 fprintf ( OUT
, "\n" );
583 fprintf ( OUT
, "SOURCE=%s\n", source_file
.c_str() );
585 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
587 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
589 string spec_file
= source_file
;
590 string def_file
= basename
+ ".def";
592 // TODO FIXME - not sure what this is doing? wine hack maybe?
593 //if ( $basename !~ /\..{1,3}$/; ) basename += ".dll";
594 string dbg_file
= basename
+ ".dbg";
595 string dbg_c_file
= basename
+ ".dbg.c";
597 string srcdir
= "."; // FIXME: Is this really always correct?
599 fprintf ( OUT
, "# Begin Custom Build\n" );
600 fprintf ( OUT
, "InputPath=%s\n", spec_file
.c_str() );
601 fprintf ( OUT
, "\n" );
602 fprintf ( OUT
, "BuildCmds= \\\n" );
603 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe --def %s > %s \\\n",
608 if ( module
.name
== "ntdll" )
611 for ( i
= 0; i
< c_srcs
.size(); i
++ )
613 const string
& c_src
= c_srcs
[i
];
616 fprintf ( OUT
, "\techo %s >> %s \\\n", c_src
.c_str(), dbg_file
.c_str() );
620 fprintf ( OUT
, "\techo %s > %s \\\n", c_src
.c_str(), dbg_file
.c_str() );
623 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
624 output_dir
.c_str() );
625 fprintf ( OUT
, " -o %s --debug -C%s %s \\\n",
633 for ( i
= 0; i
< c_srcs
.size(); i
++ )
635 const string
& c_src
= c_srcs
[i
];
636 if ( !strcmp ( &c_src
[c_src
.size()-2], ".c" ) )
638 if ( sc_srcs
.size() )
644 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
645 output_dir
.c_str() );
646 fprintf ( OUT
, " -o %s --debug -C%s %s \\\n",
652 fprintf ( OUT
, "\t\n" );
653 fprintf ( OUT
, "\n" );
654 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n", def_file
.c_str() );
655 fprintf ( OUT
, " $(BuildCmds)\n" );
656 fprintf ( OUT
, "\n" );
657 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n", dbg_c_file
.c_str() );
658 fprintf ( OUT
, " $(BuildCmds)\n" );
659 fprintf ( OUT
, "# End Custom Build\n" );
661 /*else if ( source_file =~ /([^\\]*?\.h)$/ )
665 foreach my $cfg (@cfgs) {
669 fprintf ( OUT, "!IF \"$(CFG)\" == \"$cfg\"\n" );
670 fprintf ( OUT, "\n" );
672 fprintf ( OUT, "\n" );
673 fprintf ( OUT, "!ELSEIF \"$(CFG)\" == \"$cfg\"\n" );
674 fprintf ( OUT, "\n" );
678 $output_dir =~ s/^$project - //;
679 $output_dir =~ s/ /_/g;
680 $output_dir =~ s/C\+\+/Cxx/g;
681 if($output_prefix_dir) {
682 $output_dir = "$output_prefix_dir\\$output_dir" );
685 fprintf ( OUT, "# Begin Custom Build\n" );
686 fprintf ( OUT, "OutDir=%s\n", output_dir.c_str() );
687 fprintf ( OUT, "InputPath=%s\n", source_file.c_str() );
688 fprintf ( OUT, "\n" );
689 fprintf ( OUT, "\"$(OutDir)\\wine\\%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n", h_file.c_str() );
690 fprintf ( OUT, "\tcopy \"$(InputPath)\" \"$(OutDir)\\wine\"\n" );
691 fprintf ( OUT, "\n" );
692 fprintf ( OUT, "# End Custom Build\n" );
695 if ( cfgs.size() != 0)
697 fprintf ( OUT, "\n" );
698 fprintf ( OUT, "!ENDIF \n" );
699 fprintf ( OUT, "\n" );
703 fprintf ( OUT
, "# End Source File\n" );
705 fprintf ( OUT
, "# End Group\n" );
707 fprintf ( OUT
, "# Begin Group \"Header Files\"\n" );
708 fprintf ( OUT
, "\n" );
709 fprintf ( OUT
, "# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n" );
710 for ( i
= 0; i
< header_files
.size(); i
++ )
712 const string
& header_file
= header_files
[i
];
713 fprintf ( OUT
, "# Begin Source File\n" );
714 fprintf ( OUT
, "\n" );
715 fprintf ( OUT
, "SOURCE=.\\%s\n", header_file
.c_str() );
716 fprintf ( OUT
, "# End Source File\n" );
718 fprintf ( OUT
, "# End Group\n" );
722 fprintf ( OUT
, "# Begin Group \"Resource Files\"\n" );
723 fprintf ( OUT
, "\n" );
724 fprintf ( OUT
, "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n" );
725 for ( i
= 0; i
< resource_files
.size(); i
++ )
727 const string
& resource_file
= resource_files
[i
];
728 fprintf ( OUT
, "# Begin Source File\n" );
729 fprintf ( OUT
, "\n" );
730 fprintf ( OUT
, "SOURCE=.\\%s\n", resource_file
.c_str() );
731 fprintf ( OUT
, "# End Source File\n" );
733 fprintf ( OUT
, "# End Group\n" );
735 fprintf ( OUT
, "# End Target\n" );
736 fprintf ( OUT
, "# End Project\n" );
742 MSVCBackend::_generate_dsw_header ( FILE* OUT
)
744 fprintf ( OUT
, "Microsoft Developer Studio Workspace File, Format Version 6.00\n" );
745 fprintf ( OUT
, "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n" );
746 fprintf ( OUT
, "\n" );
750 MSVCBackend::_generate_dsw_project (
752 const Module
& module
,
753 std::string dsp_file
,
754 const std::vector
<Dependency
*>& dependencies
)
756 dsp_file
= std::string(".\\") + dsp_file
;
757 // TODO FIXME - what does next line do?
758 //$dsp_file =~ y%/%\\%;
760 // TODO FIXME - must they be sorted?
761 //@dependencies = sort(@dependencies);
763 fprintf ( OUT
, "###############################################################################\n" );
764 fprintf ( OUT
, "\n" );
765 fprintf ( OUT
, "Project: \"%s\"=%s - Package Owner=<4>\n", module
.name
.c_str(), dsp_file
.c_str() );
766 fprintf ( OUT
, "\n" );
767 fprintf ( OUT
, "Package=<5>\n" );
768 fprintf ( OUT
, "{{{\n" );
769 fprintf ( OUT
, "}}}\n" );
770 fprintf ( OUT
, "\n" );
771 fprintf ( OUT
, "Package=<4>\n" );
772 fprintf ( OUT
, "{{{\n" );
773 for ( size_t i
= 0; i
< dependencies
.size(); i
++ )
775 Dependency
& dependency
= *dependencies
[i
];
776 fprintf ( OUT
, " Begin Project Dependency\n" );
777 fprintf ( OUT
, " Project_Dep_Name %s\n", dependency
.module
.name
.c_str() );
778 fprintf ( OUT
, " End Project Dependency\n" );
780 fprintf ( OUT
, "}}}\n" );
781 fprintf ( OUT
, "\n" );
785 MSVCBackend::_generate_dsw_footer ( FILE* OUT
)
787 fprintf ( OUT
, "###############################################################################\n" );
788 fprintf ( OUT
, "\n" );
789 fprintf ( OUT
, "Global:\n" );
790 fprintf ( OUT
, "\n" );
791 fprintf ( OUT
, "Package=<5>\n" );
792 fprintf ( OUT
, "{{{\n" );
793 fprintf ( OUT
, "}}}\n" );
794 fprintf ( OUT
, "\n" );
795 fprintf ( OUT
, "Package=<3>\n" );
796 fprintf ( OUT
, "{{{\n" );
797 fprintf ( OUT
, "}}}\n" );
798 fprintf ( OUT
, "\n" );
799 fprintf ( OUT
, "###############################################################################\n" );
800 fprintf ( OUT
, "\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
++ )
809 //foreach my $module (sort(keys(%modules)))
811 Module
& module
= *ProjectNode
.modules
[i
];
813 //my $project = module->{project};
814 std::string dsp_file
= DspFileName ( module
);
816 // TODO FIXME - more wine hacks?
817 /*if($project =~ /^gdi32$/) {
818 foreach my $dir (@gdi32_dirs) {
820 $dir2 =~ s%^.*?/([^/]+)$%$1%;
822 my $module = "gdi32_$dir2";
824 push @dependencies, $module;
828 _generate_dsw_project ( OUT
, module
, dsp_file
, module
.dependencies
);
830 _generate_dsw_footer ( OUT
);