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 22, 2022
1 parent 1abc867 commit dc954b3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions contrib/buildsystems/Generators/Vcxproj.pm
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 dc954b3

Please sign in to comment.