Skip to content

Commit

Permalink
vcxproj: handle GUI programs, too
Browse files Browse the repository at this point in the history
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 <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Sep 18, 2024
1 parent 7c3c91c commit 5c194da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions contrib/buildsystems/Generators/Vcxproj.pm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ sub createProject {
my $rcdefines = $defines;
$rcdefines =~ s/(?<!\\)"/\\$&/g;

my $entrypoint = 'wmainCRTStartup';
my $subsystem = 'Console';
if (grep /^-mwindows$/, @{$$build_structure{"$prefix${name}_LFLAGS"}}) {
$entrypoint = 'wWinMainCRTStartup';
$subsystem = 'Windows';
}

my $dir = $vcxproj;
$dir =~ s/\/[^\/]*$//;
die "Could not create the directory $dir for $label project!\n" unless (-d "$dir" || mkdir "$dir");
Expand Down Expand Up @@ -179,9 +186,9 @@ sub createProject {
<AdditionalLibraryDirectories>\$(VCPKGLibDirectory);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>\$(VCPKGLibs);\$(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>invalidcontinue.obj %(AdditionalOptions)</AdditionalOptions>
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
<EntryPointSymbol>$entrypoint</EntryPointSymbol>
<ManifestFile>$cdup\\compat\\win32\\git.manifest</ManifestFile>
<SubSystem>Console</SubSystem>
<SubSystem>$subsystem</SubSystem>
</Link>
EOM
if ($target eq 'libgit') {
Expand Down

0 comments on commit 5c194da

Please sign in to comment.