Skip to content

Commit 6258bca

Browse files
committed
vcxproj: handle GUI programs, too
So far, we only built Console programs, but we are about to introduce a program that targets the Windows subsystem (i.e. it is a so-called "GUI" program). Let's handle this preemptively in the script that generates the Visual Studio files. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent c981b04 commit 6258bca

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

contrib/buildsystems/Generators/Vcxproj.pm

+9-2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ sub createProject {
9292
my $rcdefines = $defines;
9393
$rcdefines =~ s/(?<!\\)"/\\$&/g;
9494

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+
95102
my $dir = $vcxproj;
96103
$dir =~ s/\/[^\/]*$//;
97104
die "Could not create the directory $dir for $label project!\n" unless (-d "$dir" || mkdir "$dir");
@@ -179,9 +186,9 @@ sub createProject {
179186
<AdditionalLibraryDirectories>\$(VCPKGLibDirectory);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
180187
<AdditionalDependencies>\$(VCPKGLibs);\$(AdditionalDependencies)</AdditionalDependencies>
181188
<AdditionalOptions>invalidcontinue.obj %(AdditionalOptions)</AdditionalOptions>
182-
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
189+
<EntryPointSymbol>$entrypoint</EntryPointSymbol>
183190
<ManifestFile>$cdup\\compat\\win32\\git.manifest</ManifestFile>
184-
<SubSystem>Console</SubSystem>
191+
<SubSystem>$subsystem</SubSystem>
185192
</Link>
186193
EOM
187194
if ($target eq 'libgit') {

0 commit comments

Comments
 (0)