01bb414ae81f8463865b911f3af4fbf9c7a90db0
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 FILE* OUT
= fopen ( dsp_file
.c_str(), "w" );
25 vector
<string
> imports
;
26 for ( i
= 0; i
< module
.non_if_data
.libraries
.size(); i
++ )
28 imports
.push_back ( module
.non_if_data
.libraries
[i
]->name
);
31 string module_type
= Right(module
.GetTargetName(),3);
32 bool lib
= (module_type
== "lib");
33 bool dll
= (module_type
== "dll");
34 bool exe
= (module_type
== "exe");
35 // TODO FIXME - need more checks here for 'sys' and possibly 'drv'?
37 bool console
= exe
; // FIXME: Not always correct
39 // TODO FIXME - not sure if the count here is right...
41 const char* p
= strpbrk ( dsp_file
.c_str(), "/\\" );
45 p
= strpbrk ( p
+1, "/\\" );
47 string msvc_wine_dir
= "..";
49 msvc_wine_dir
+= "\\..";
51 string wine_include_dir
= msvc_wine_dir
+ "\\include";
53 //$progress_current++;
54 //$output->progress("$dsp_file (file $progress_current of $progress_max)");
56 // TODO FIXME - what's diff. betw. 'c_srcs' and 'source_files'?
57 vector
<string
> c_srcs
, source_files
, resource_files
;
58 vector
<const IfableData
*> ifs_list
;
59 ifs_list
.push_back ( &module
.non_if_data
);
60 while ( ifs_list
.size() )
62 const IfableData
& data
= *ifs_list
.back();
64 // TODO FIXME - refactor needed - we're discarding if conditions
65 for ( i
= 0; i
< data
.ifs
.size(); i
++ )
66 ifs_list
.push_back ( &data
.ifs
[i
]->data
);
67 const vector
<File
*>& files
= data
.files
;
68 for ( i
= 0; i
< files
.size(); i
++ )
70 // TODO FIXME - do we want the full path of the file here?
71 const string
& file
= files
[i
]->name
;
72 source_files
.push_back ( file
);
73 if ( !stricmp ( Right(file
,2).c_str(), ".c" ) )
74 c_srcs
.push_back ( file
);
75 if ( !stricmp ( Right(file
,3).c_str(), ".rc" ) )
76 resource_files
.push_back ( file
);
79 // TODO FIXME - we don't include header files in our build system
80 //my @header_files = @{module->{header_files}};
81 vector
<string
> header_files
;
83 // TODO FIXME - wine hack?
84 /*if (module.name !~ /^wine(?:_unicode|build|runtests|test)?$/ &&
85 module.name !~ /^(?:gdi32)_.+?$/ &&
86 module.name !~ /_test$/)
88 push @source_files, "$project.spec" );
89 @source_files = sort(@source_files);
93 bool no_msvc_headers
= true;
94 // TODO FIXME - wine hack?
95 /*if (module.name =~ /^wine(?:runtests|test)$/
96 || module.name =~ /_test$/)
98 no_msvc_headers = false;
101 std::vector
<std::string
> cfgs
;
103 cfgs
.push_back ( module
.name
+ " - Win32" );
107 std::vector
<std::string
> _cfgs
;
108 for ( i
= 0; i
< cfgs
.size(); i
++ )
110 _cfgs
.push_back ( cfgs
[i
] + " C" );
111 _cfgs
.push_back ( cfgs
[i
] + " C++" );
117 // TODO FIXME - wine hack?
120 std::vector<std::string> _cfgs;
121 for ( i = 0; i < cfgs.size(); i++ )
123 _cfgs.push_back ( cfgs[i] + " Debug" );
124 _cfgs.push_back ( cfgs[i] + " Release" );
130 if (!no_msvc_headers
)
132 std::vector
<std::string
> _cfgs
;
133 for ( i
= 0; i
< cfgs
.size(); i
++ )
135 _cfgs
.push_back ( cfgs
[i
] + " MSVC Headers" );
136 _cfgs
.push_back ( cfgs
[i
] + " Wine Headers" );
142 string default_cfg
= cfgs
.back();
144 fprintf ( OUT
, "# Microsoft Developer Studio Project File - Name=\"%s\" - Package Owner=<4>\n", module
.name
.c_str() );
145 fprintf ( OUT
, "# Microsoft Developer Studio Generated Build File, Format Version 6.00\n" );
146 fprintf ( OUT
, "# ** DO NOT EDIT **\n" );
147 fprintf ( OUT
, "\n" );
151 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\n" );
155 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\n" );
159 fprintf ( OUT
, "# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n" );
161 fprintf ( OUT
, "\n" );
163 fprintf ( OUT
, "CFG=$default_cfg\n" );
164 fprintf ( OUT
, "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n" );
165 fprintf ( OUT
, "!MESSAGE use the Export Makefile command and run\n" );
166 fprintf ( OUT
, "!MESSAGE \n" );
167 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\".\n", module
.name
.c_str() );
168 fprintf ( OUT
, "!MESSAGE \n" );
169 fprintf ( OUT
, "!MESSAGE You can specify a configuration when running NMAKE\n" );
170 fprintf ( OUT
, "!MESSAGE by defining the macro CFG on the command line. For example:\n" );
171 fprintf ( OUT
, "!MESSAGE \n" );
172 fprintf ( OUT
, "!MESSAGE NMAKE /f \"%s.mak\" CFG=\"%s\"\n", module
.name
.c_str(), default_cfg
.c_str() );
173 fprintf ( OUT
, "!MESSAGE \n" );
174 fprintf ( OUT
, "!MESSAGE Possible choices for configuration are:\n" );
175 fprintf ( OUT
, "!MESSAGE \n" );
176 for ( i
= 0; i
< cfgs
.size(); i
++ )
178 const string
& cfg
= cfgs
[i
];
181 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Static Library\")\n", cfg
.c_str() );
185 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Dynamic-Link Library\")\n", cfg
.c_str() );
189 fprintf ( OUT
, "!MESSAGE \"%s\" (based on \"Win32 (x86) Console Application\")\n", cfg
.c_str() );
192 fprintf ( OUT
, "!MESSAGE \n" );
193 fprintf ( OUT
, "\n" );
195 fprintf ( OUT
, "# Begin Project\n" );
196 fprintf ( OUT
, "# PROP AllowPerConfigDependencies 0\n" );
197 fprintf ( OUT
, "# PROP Scc_ProjName \"\"\n" );
198 fprintf ( OUT
, "# PROP Scc_LocalPath \"\"\n" );
199 fprintf ( OUT
, "CPP=cl.exe\n" );
200 if ( !lib
&& !exe
) fprintf ( OUT
, "MTL=midl.exe\n" );
201 fprintf ( OUT
, "RSC=rc.exe\n" );
205 std::string output_dir
;
206 for ( size_t icfg
= 0; icfg
< cfgs
.size(); icfg
++ )
208 std::string
& cfg
= cfgs
[icfg
];
213 fprintf ( OUT
, "!IF \"$(CFG)\" == \"%s\"\n", cfg
.c_str() );
214 fprintf ( OUT
, "\n" );
218 fprintf ( OUT
, "\n" );
219 fprintf ( OUT
, "!ELSEIF \"$(CFG)\" == \"%s\"\n", cfg
.c_str() );
220 fprintf ( OUT
, "\n" );
224 bool debug
= !strstr ( cfg
.c_str(), "Release" );
225 bool msvc_headers
= ( 0 != strstr ( cfg
.c_str(), "MSVC Headers" ) );
227 fprintf ( OUT
, "# PROP BASE Use_MFC 0\n" );
231 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 1\n" );
235 fprintf ( OUT
, "# PROP BASE Use_Debug_Libraries 0\n" );
238 output_dir
= Replace(cfg
,module
.name
+ " - ","");
239 output_dir
= Replace(output_dir
," ","_");
240 output_dir
= Replace(output_dir
,"C++","Cxx");
241 // TODO FIXME - wine hack?
242 //if ( output_prefix_dir.size() )
243 // output_dir = output_prefix_dir + "\\" + output_dir;
245 fprintf ( OUT
, "# PROP BASE Output_Dir \"%s\"\n", output_dir
.c_str() );
246 fprintf ( OUT
, "# PROP BASE Intermediate_Dir \"%s\"\n", output_dir
.c_str() );
248 fprintf ( OUT
, "# PROP BASE Target_Dir \"\"\n" );
250 fprintf ( OUT
, "# PROP Use_MFC 0\n" );
253 fprintf ( OUT
, "# PROP Use_Debug_Libraries 1\n" );
257 fprintf ( OUT
, "# PROP Use_Debug_Libraries 0\n" );
259 fprintf ( OUT
, "# PROP Output_Dir \"%s\"\n", output_dir
.c_str() );
260 fprintf ( OUT
, "# PROP Intermediate_Dir \"%s\"\n", output_dir
.c_str() );
262 if ( dll
) fprintf ( OUT
, "# PROP Ignore_Export_Lib 0\n" );
263 fprintf ( OUT
, "# PROP Target_Dir \"\"\n" );
265 vector
<string
> defines
;
266 defines
.push_back ( "WINVER=0x0501" );
267 defines
.push_back ( "_WIN32_WINNT=0x0501" );
268 defines
.push_back ( "_WIN32_IE=0x0600" );
269 defines
.push_back ( "WIN32" );
270 defines
.push_back ( "_WINDOWS" );
271 defines
.push_back ( "WIN32" );
272 defines
.push_back ( "_MBCS" );
275 defines
.push_back ( "_DEBUG" );
278 fprintf ( OUT
, "# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od" );
279 defines
.push_back ( "_LIB" );
283 fprintf ( OUT
, "# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
284 defines
.push_back ( "_WINDOWS" );
285 defines
.push_back ( "_USRDLL" );
286 // TODO FIXME - wine hack?
287 //defines.push_back ( string("\U") + module.name + "\E_EXPORTS" );
292 defines
.push_back ( "NDEBUG" );
295 fprintf ( OUT
, "# ADD BASE CPP /nologo /W3 /GX /O2" );
296 defines
.push_back ( "_LIB" );
300 fprintf ( OUT
, "# ADD BASE CPP /nologo /MT /W3 /GX /O2" );
301 defines
.push_back ( "_WINDOWS" );
302 defines
.push_back ( "_USRDLL" );
303 // TODO FIXME - wine hack?
304 //defines.push_back ( string("\U") + module.name + "\E_EXPORTS" );
308 for ( i
= 0; i
< defines
.size(); i
++ )
310 fprintf ( OUT
, " /D \"%s\"", defines
[i
].c_str() );
312 if ( lib
|| exe
) fprintf ( OUT
, " /YX" );
313 fprintf ( OUT
, " /FD" );
316 fprintf ( OUT
, " /GZ" );
317 if ( lib
|| exe
) fprintf ( OUT
, " " );
319 fprintf ( OUT
, " /c" );
320 fprintf ( OUT
, "\n" );
322 vector
<string
> defines2
;
323 defines2
.push_back ( "WINVER=0x0501" );
324 defines2
.push_back ( "_WIN32_WINNT=0x0501" );
325 defines2
.push_back ( "_WIN32_IE=0x0600" );
326 defines2
.push_back ( "WIN32" );
327 defines2
.push_back ( "_WINDOWS" );
328 defines2
.push_back ( "_MBCS" );
331 defines2
.push_back ( "_DEBUG" );
334 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
335 defines2
.push_back ( "_LIB" );
339 fprintf ( OUT
, "# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od" );
340 defines2
.push_back ( "_USRDLL" );
345 defines2
.push_back ( "NDEBUG" );
348 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
349 defines2
.push_back ( "_LIB" );
353 fprintf ( OUT
, "# ADD CPP /nologo /MT /W3 /GX /O2" );
354 defines2
.push_back ( "_USRDLL" );
358 std::vector
<std::string
> includes
;
359 // TODO FIXME - wine hack?
362 // TODO FIXME - wine hack?
363 //defines2.push_back ( string("_\U") + module.name + "\E_" );
364 // TODO FIXME - wine hack?
365 /*if ( module.name !~ /^(?:wine(?:build|test)|.*?_test)$/ )
366 defines2.push_back ( "__WINESRC__" );*/
368 defines2
.push_back ( "__WINE_USE_NATIVE_HEADERS" );
369 string output_dir2
= Replace(output_dir
,"\\","\\\\");
370 defines2
.push_back ( ssprintf("__WINETEST_OUTPUT_DIR=\\\"%s\\\"",output_dir
.c_str()) );
371 defines2
.push_back ( "__i386__" );
372 defines2
.push_back ( "_X86_" );
374 // TODO FIXME - wine hacks?
375 /*if($project =~ /^gdi32_(?:enhmfdrv|mfdrv)$/) {
376 push @includes, ".." );
379 if ($project =~ /_test$/) {
380 push @includes, "$msvc_wine_dir\\$output_dir" );
383 if (!$msvc_headers || $project eq "winetest") {
384 push @includes, $wine_include_dir;
390 for ( i
= 0; i
< includes
.size(); i
++ );
392 const string
& include
= includes
[i
];
393 if ( strpbrk ( include
.c_str(), "[\\\"]" ) )
395 fprintf ( OUT
, " /I \"%s\"", include
.c_str() );
399 fprintf ( OUT
, " /I %s", include
.c_str() );
404 for ( i
= 0; i
< defines2
.size(); i
++ )
406 const string
& define
= defines2
[i
];
407 if ( strpbrk ( define
.c_str(), "[\\\"]" ) )
409 fprintf ( OUT
, " /D \"%s\"", define
.c_str() );
413 fprintf ( OUT
, " /D %s", define
.c_str() );
416 if ( wine
) fprintf ( OUT
, " /D inline=__inline" );
417 //fprintf ( OUT, " /D \"__STDC__\"" if 0 && $wine;
419 fprintf ( OUT
, lib
? " /YX" : " /FR" );
420 fprintf ( OUT
, " /FD" );
421 if ( debug
) fprintf ( OUT
, " /GZ" );
422 if ( debug
&& lib
) fprintf ( OUT
, " " );
423 fprintf ( OUT
, " /c" );
424 if ( !no_cpp
) fprintf ( OUT
, " /TP" );
425 fprintf ( OUT
, "\n" );
431 fprintf ( OUT
, "# SUBTRACT CPP /X /YX\n" );
432 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\n" );
433 fprintf ( OUT
, "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\n" );
435 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"_DEBUG\"\n" );
436 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
439 for ( i
= 0; i
< includes
.size(); i
++ )
441 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
444 fprintf ( OUT
, " /d \"_DEBUG\"\n" );
450 fprintf ( OUT
, "# SUBTRACT CPP /YX\n" );
451 fprintf ( OUT
, "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\n" );
452 fprintf ( OUT
, "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\n" );
454 fprintf ( OUT
, "# ADD BASE RSC /l 0x41d /d \"NDEBUG\"\n" );
455 fprintf ( OUT
, "# ADD RSC /l 0x41d" );
458 for ( i
= 0; i
< includes
.size(); i
++ )
459 fprintf ( OUT
, " /i \"%s\"", includes
[i
].c_str() );
461 fprintf ( OUT
, "/d \"NDEBUG\"\n" );
463 fprintf ( OUT
, "BSC32=bscmake.exe\n" );
464 fprintf ( OUT
, "# ADD BASE BSC32 /nologo\n" );
465 fprintf ( OUT
, "# ADD BSC32 /nologo\n" );
469 fprintf ( OUT
, "LINK32=link.exe\n" );
470 fprintf ( OUT
, "# ADD BASE LINK32 " );
471 vector
<string
> libraries
;
472 libraries
.push_back ( "kernel32.lib" );
473 libraries
.push_back ( "user32.lib" );
474 libraries
.push_back ( "gdi32.lib" );
475 libraries
.push_back ( "winspool.lib" );
476 libraries
.push_back ( "comdlg32.lib" );
477 libraries
.push_back ( "advapi32.lib" );
478 libraries
.push_back ( "shell32.lib" );
479 libraries
.push_back ( "ole32.lib" );
480 libraries
.push_back ( "oleaut32.lib" );
481 libraries
.push_back ( "uuid.lib" );
482 libraries
.push_back ( "odbc32.lib" );
483 libraries
.push_back ( "odbccp32.lib" );
484 for ( i
= 0; i
< libraries
.size(); i
++ )
486 fprintf ( OUT
, "%s ", libraries
[i
].c_str() );
488 fprintf ( OUT
, " /nologo" );
489 if ( dll
) fprintf ( OUT
, " /dll" );
490 if ( console
) fprintf ( OUT
, " /subsystem:console" );
491 if ( debug
) fprintf ( OUT
, " /debug" );
492 fprintf ( OUT
, " /machine:I386" );
493 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
494 fprintf ( OUT
, "\n" );
496 fprintf ( OUT
, "# ADD LINK32" );
497 fprintf ( OUT
, " /nologo" );
498 // TODO FIXME - do we need their kludge?
499 //fprintf ( OUT, " libcmt.lib" if $project =~ /^ntdll$/; # FIXME: Kludge
500 for ( i
= 0; i
< imports
.size(); i
++ )
502 const string
& import
= imports
[i
];
503 if ( import
!= "msvcrt" )
504 fprintf ( OUT
, " %s.lib", import
.c_str() );
506 if ( dll
) fprintf ( OUT
, " /dll" );
507 if ( console
) fprintf ( OUT
, " /subsystem:console" );
508 if ( debug
) fprintf ( OUT
, " /debug" );
509 fprintf ( OUT
, " /machine:I386" );
510 // TODO FIXME - do we need their kludge?
511 //fprintf ( OUT, " /nodefaultlib" if $project =~ /^ntdll$/; # FIXME: Kludge
512 if ( dll
) fprintf ( OUT
, " /def:\"%s.def\"", module
.name
.c_str() );
513 if ( debug
) fprintf ( OUT
, " /pdbtype:sept" );
514 fprintf ( OUT
, "\n" );
518 fprintf ( OUT
, "LIB32=link.exe -lib\n" );
519 fprintf ( OUT
, "# ADD BASE LIB32 /nologo\n" );
520 fprintf ( OUT
, "# ADD LIB32 /nologo\n" );
526 if ( cfgs
.size() != 0 )
528 fprintf ( OUT
, "\n" );
529 fprintf ( OUT
, "!ENDIF \n" );
530 fprintf ( OUT
, "\n" );
533 if ( module
.name
== "winebuild" )
535 fprintf ( OUT
, "# Begin Special Build Tool\n" );
536 fprintf ( OUT
, "SOURCE=\"$(InputPath)\"\n" );
537 fprintf ( OUT
, "PostBuild_Desc=Copying wine.dll and wine_unicode.dll ...\n" );
538 fprintf ( OUT
, "PostBuild_Cmds=" );
539 fprintf ( OUT
, "copy ..\\..\\library\\%s\\wine.dll $(OutDir)\t",
540 output_dir
.c_str() );
541 fprintf ( OUT
, "copy ..\\..\\unicode\\%s\\wine_unicode.dll $(OutDir)\n",
542 output_dir
.c_str() );
543 fprintf ( OUT
, "# End Special Build Tool\n" );
545 fprintf ( OUT
, "# Begin Target\n" );
546 fprintf ( OUT
, "\n" );
547 for ( i
= 0; i
< cfgs
.size(); i
++ )
549 fprintf ( OUT
, "# Name \"%s\"\n", cfgs
[i
].c_str() );
552 fprintf ( OUT
, "# Begin Group \"Source Files\"\n" );
553 fprintf ( OUT
, "\n" );
554 fprintf ( OUT
, "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n" );
556 for ( i
= 0; i
< source_files
.size(); i
++ )
558 string source_file
= DosSeparator(source_files
[i
]);
560 if ( strncmp ( source_file
.c_str(), ".\\", 2 ) )
562 source_file
= string(".\\") + source_file
;
565 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
567 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
569 // TODO FIXME - not sure what this is doing? wine hack maybe?
570 //if ( $basename !~ /\..{1,3}$/; ) basename += string(".dll");
571 string dbg_c_file
= basename
+ ".dbg.c";
573 fprintf ( OUT
, "# Begin Source File\n" );
574 fprintf ( OUT
, "\n" );
575 fprintf ( OUT
, "SOURCE=%s\n", dbg_c_file
.c_str() );
576 fprintf ( OUT
, "# End Source File\n" );
579 fprintf ( OUT
, "# Begin Source File\n" );
580 fprintf ( OUT
, "\n" );
582 fprintf ( OUT
, "SOURCE=%s\n", source_file
.c_str() );
584 if ( !strcmp ( &source_file
[source_file
.size()-5], ".spec" ) )
586 string basename
= string ( source_file
.c_str(), source_file
.size() - 5 );
588 string spec_file
= source_file
;
589 string def_file
= basename
+ ".def";
591 // TODO FIXME - not sure what this is doing? wine hack maybe?
592 //if ( $basename !~ /\..{1,3}$/; ) basename += ".dll";
593 string dbg_file
= basename
+ ".dbg";
594 string dbg_c_file
= basename
+ ".dbg.c";
596 string srcdir
= "."; // FIXME: Is this really always correct?
598 fprintf ( OUT
, "# Begin Custom Build\n" );
599 fprintf ( OUT
, "InputPath=%s\n", spec_file
.c_str() );
600 fprintf ( OUT
, "\n" );
601 fprintf ( OUT
, "BuildCmds= \\\n" );
602 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe --def %s > %s \\\n",
607 if ( module
.name
== "ntdll" )
610 for ( i
= 0; i
< c_srcs
.size(); i
++ )
612 const string
& c_src
= c_srcs
[i
];
615 fprintf ( OUT
, "\techo %s >> %s \\\n", c_src
.c_str(), dbg_file
.c_str() );
619 fprintf ( OUT
, "\techo %s > %s \\\n", c_src
.c_str(), dbg_file
.c_str() );
622 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
623 output_dir
.c_str() );
624 fprintf ( OUT
, " -o %s --debug -C%s %s \\\n",
632 for ( i
= 0; i
< c_srcs
.size(); i
++ )
634 const string
& c_src
= c_srcs
[i
];
635 if ( !strcmp ( &c_src
[c_src
.size()-2], ".c" ) )
637 if ( sc_srcs
.size() )
643 fprintf ( OUT
, "\t..\\..\\tools\\winebuild\\%s\\winebuild.exe",
644 output_dir
.c_str() );
645 fprintf ( OUT
, " -o %s --debug -C%s %s \\\n",
651 fprintf ( OUT
, "\t\n" );
652 fprintf ( OUT
, "\n" );
653 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n", def_file
.c_str() );
654 fprintf ( OUT
, " $(BuildCmds)\n" );
655 fprintf ( OUT
, "\n" );
656 fprintf ( OUT
, "\"%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n", dbg_c_file
.c_str() );
657 fprintf ( OUT
, " $(BuildCmds)\n" );
658 fprintf ( OUT
, "# End Custom Build\n" );
660 /*else if ( source_file =~ /([^\\]*?\.h)$/ )
664 foreach my $cfg (@cfgs) {
668 fprintf ( OUT, "!IF \"$(CFG)\" == \"$cfg\"\n" );
669 fprintf ( OUT, "\n" );
671 fprintf ( OUT, "\n" );
672 fprintf ( OUT, "!ELSEIF \"$(CFG)\" == \"$cfg\"\n" );
673 fprintf ( OUT, "\n" );
677 $output_dir =~ s/^$project - //;
678 $output_dir =~ s/ /_/g;
679 $output_dir =~ s/C\+\+/Cxx/g;
680 if($output_prefix_dir) {
681 $output_dir = "$output_prefix_dir\\$output_dir" );
684 fprintf ( OUT, "# Begin Custom Build\n" );
685 fprintf ( OUT, "OutDir=%s\n", output_dir.c_str() );
686 fprintf ( OUT, "InputPath=%s\n", source_file.c_str() );
687 fprintf ( OUT, "\n" );
688 fprintf ( OUT, "\"$(OutDir)\\wine\\%s\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n", h_file.c_str() );
689 fprintf ( OUT, "\tcopy \"$(InputPath)\" \"$(OutDir)\\wine\"\n" );
690 fprintf ( OUT, "\n" );
691 fprintf ( OUT, "# End Custom Build\n" );
694 if ( cfgs.size() != 0)
696 fprintf ( OUT, "\n" );
697 fprintf ( OUT, "!ENDIF \n" );
698 fprintf ( OUT, "\n" );
702 fprintf ( OUT
, "# End Source File\n" );
704 fprintf ( OUT
, "# End Group\n" );
706 fprintf ( OUT
, "# Begin Group \"Header Files\"\n" );
707 fprintf ( OUT
, "\n" );
708 fprintf ( OUT
, "# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n" );
709 for ( i
= 0; i
< header_files
.size(); i
++ )
711 const string
& header_file
= header_files
[i
];
712 fprintf ( OUT
, "# Begin Source File\n" );
713 fprintf ( OUT
, "\n" );
714 fprintf ( OUT
, "SOURCE=.\\%s\n", header_file
.c_str() );
715 fprintf ( OUT
, "# End Source File\n" );
717 fprintf ( OUT
, "# End Group\n" );
721 fprintf ( OUT
, "# Begin Group \"Resource Files\"\n" );
722 fprintf ( OUT
, "\n" );
723 fprintf ( OUT
, "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n" );
724 for ( i
= 0; i
< resource_files
.size(); i
++ )
726 const string
& resource_file
= resource_files
[i
];
727 fprintf ( OUT
, "# Begin Source File\n" );
728 fprintf ( OUT
, "\n" );
729 fprintf ( OUT
, "SOURCE=.\\%s\n", resource_file
.c_str() );
730 fprintf ( OUT
, "# End Source File\n" );
732 fprintf ( OUT
, "# End Group\n" );
734 fprintf ( OUT
, "# End Target\n" );
735 fprintf ( OUT
, "# End Project\n" );
741 MSVCBackend::_generate_dsw_header ( FILE* OUT
)
743 fprintf ( OUT
, "Microsoft Developer Studio Workspace File, Format Version 6.00\n" );
744 fprintf ( OUT
, "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n" );
745 fprintf ( OUT
, "\n" );
749 MSVCBackend::_generate_dsw_project (
751 const Module
& module
,
752 std::string dsp_file
,
753 const std::vector
<Dependency
*>& dependencies
)
755 dsp_file
= std::string(".\\") + dsp_file
;
756 // TODO FIXME - what does next line do?
757 //$dsp_file =~ y%/%\\%;
759 // TODO FIXME - must they be sorted?
760 //@dependencies = sort(@dependencies);
762 fprintf ( OUT
, "###############################################################################\n" );
763 fprintf ( OUT
, "\n" );
764 fprintf ( OUT
, "Project: \"%s\"=%s - Package Owner=<4>\n", module
.name
.c_str(), dsp_file
.c_str() );
765 fprintf ( OUT
, "\n" );
766 fprintf ( OUT
, "Package=<5>\n" );
767 fprintf ( OUT
, "{{{\n" );
768 fprintf ( OUT
, "}}}\n" );
769 fprintf ( OUT
, "\n" );
770 fprintf ( OUT
, "Package=<4>\n" );
771 fprintf ( OUT
, "{{{\n" );
772 for ( size_t i
= 0; i
< dependencies
.size(); i
++ )
774 Dependency
& dependency
= *dependencies
[i
];
775 fprintf ( OUT
, " Begin Project Dependency\n" );
776 fprintf ( OUT
, " Project_Dep_Name %s\n", dependency
.module
.name
.c_str() );
777 fprintf ( OUT
, " End Project Dependency\n" );
779 fprintf ( OUT
, "}}}\n" );
780 fprintf ( OUT
, "\n" );
784 MSVCBackend::_generate_dsw_footer ( FILE* OUT
)
786 fprintf ( OUT
, "###############################################################################\n" );
787 fprintf ( OUT
, "\n" );
788 fprintf ( OUT
, "Global:\n" );
789 fprintf ( OUT
, "\n" );
790 fprintf ( OUT
, "Package=<5>\n" );
791 fprintf ( OUT
, "{{{\n" );
792 fprintf ( OUT
, "}}}\n" );
793 fprintf ( OUT
, "\n" );
794 fprintf ( OUT
, "Package=<3>\n" );
795 fprintf ( OUT
, "{{{\n" );
796 fprintf ( OUT
, "}}}\n" );
797 fprintf ( OUT
, "\n" );
798 fprintf ( OUT
, "###############################################################################\n" );
799 fprintf ( OUT
, "\n" );
803 MSVCBackend::_generate_wine_dsw ( FILE* OUT
)
805 _generate_dsw_header(OUT
);
806 // TODO FIXME - is it necessary to sort them?
807 for ( size_t i
= 0; i
< ProjectNode
.modules
.size(); i
++ )
808 //foreach my $module (sort(keys(%modules)))
810 Module
& module
= *ProjectNode
.modules
[i
];
812 //my $project = module->{project};
813 std::string dsp_file
= DspFileName ( module
);
815 // TODO FIXME - more wine hacks?
816 /*if($project =~ /^gdi32$/) {
817 foreach my $dir (@gdi32_dirs) {
819 $dir2 =~ s%^.*?/([^/]+)$%$1%;
821 my $module = "gdi32_$dir2";
823 push @dependencies, $module;
827 _generate_dsw_project ( OUT
, module
, dsp_file
, module
.dependencies
);
829 _generate_dsw_footer ( OUT
);