@@ -89,6 +89,16 @@ sub createProject {
8989 $defines =~ s / >/ >/ g ;
9090 $defines =~ s /\' // g ;
9191
92+ my $rcdefines = $defines ;
93+ $rcdefines =~ s / (?<!\\ )"/ \\ $& / g ;
94+
95+ my $entrypoint = ' wmainCRTStartup' ;
96+ my $subsystem = ' Console' ;
97+ if (grep /^-mwindows$/ , @{$$build_structure {" $prefix${name} _LFLAGS" }}) {
98+ $entrypoint = ' wWinMainCRTStartup' ;
99+ $subsystem = ' Windows' ;
100+ }
101+
92102 my $dir = $vcxproj ;
93103 $dir =~ s /\/ [^\/ ]*$// ;
94104 die " Could not create the directory $dir for $label project!\n " unless (-d " $dir " || mkdir " $dir " );
@@ -176,9 +186,9 @@ sub createProject {
176186 <AdditionalLibraryDirectories>\$ (VCPKGLibDirectory);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
177187 <AdditionalDependencies>\$ (VCPKGLibs);\$ (AdditionalDependencies)</AdditionalDependencies>
178188 <AdditionalOptions>invalidcontinue.obj %(AdditionalOptions)</AdditionalOptions>
179- <EntryPointSymbol>wmainCRTStartup </EntryPointSymbol>
189+ <EntryPointSymbol>$entrypoint </EntryPointSymbol>
180190 <ManifestFile>$cdup \\ compat\\ win32\\ git.manifest</ManifestFile>
181- <SubSystem>Console </SubSystem>
191+ <SubSystem>$subsystem </SubSystem>
182192 </Link>
183193EOM
184194 if ($target eq ' libgit' ) {
203213 <PreprocessorDefinitions>WIN32;_DEBUG;$defines ;%(PreprocessorDefinitions)</PreprocessorDefinitions>
204214 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
205215 </ClCompile>
216+ <ResourceCompile>
217+ <PreprocessorDefinitions>WIN32;_DEBUG;$rcdefines ;%(PreprocessorDefinitions)</PreprocessorDefinitions>
218+ </ResourceCompile>
206219 <Link>
207220 <GenerateDebugInformation>true</GenerateDebugInformation>
208221 </Link>
216229 <FunctionLevelLinking>true</FunctionLevelLinking>
217230 <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
218231 </ClCompile>
232+ <ResourceCompile>
233+ <PreprocessorDefinitions>WIN32;NDEBUG;$rcdefines ;%(PreprocessorDefinitions)</PreprocessorDefinitions>
234+ </ResourceCompile>
219235 <Link>
220236 <GenerateDebugInformation>true</GenerateDebugInformation>
221237 <EnableCOMDATFolding>true</EnableCOMDATFolding>
225241 <ItemGroup>
226242EOM
227243 foreach (@sources ) {
228- print F << "EOM" ;
244+ if (/ \. rc$ / ) {
245+ print F << "EOM" ;
246+ <ResourceCompile Include="$_ " />
247+ EOM
248+ } else {
249+ print F << "EOM" ;
229250 <ClCompile Include="$_ " />
230251EOM
252+ }
231253 }
232254 print F << "EOM" ;
233255 </ItemGroup>
0 commit comments