Skip to content

Commit 9fce715

Browse files
Philip Oakleydscho
Philip Oakley
authored andcommitted
Vcproj.pm: list git.exe first to be startup project
Visual Studio takes the first listed application/library as the default startup project [1]. Detect the 'git' project and place it the head of the apps list, rather than the tail. Export the apps list before libs list for both the projects and global structures of the .sln file. [1] http://stackoverflow.com/questions/1238553/ vs2008-where-is-the-startup-project-setting-stored-for-a-solution "In the solution file, there are a list of pseudo-XML "Project" entries. It turns out that whatever is the first one ends up as the Startup Project, unless it’s overridden in the suo file. Argh. I just rearranged the order in the file and it’s good." "just moving the pseudo-xml isn't enough. You also have to move the group of entries in the "GlobalSection(ProjectConfigurationPlatforms) = postSolution" group that has the GUID of the project you moved to the top. So there are two places to move lines." Signed-off-by: Philip Oakley <[email protected]>
1 parent f8b3c1e commit 9fce715

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

contrib/buildsystems/Generators/Vcproj.pm

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -513,20 +513,18 @@ sub createGlueProject {
513513
foreach (@apps) {
514514
$_ =~ s/\//_/g;
515515
$_ =~ s/\.exe//;
516-
push(@tmp, $_);
516+
if ($_ eq "git" ) {
517+
unshift(@tmp, $_);
518+
} else {
519+
push(@tmp, $_);
520+
}
517521
}
518522
@apps = @tmp;
519523

520524
open F, ">git.sln" || die "Could not open git.sln for writing!\n";
521525
binmode F, ":crlf";
522526
print F "$SLN_HEAD";
523-
foreach (@libs) {
524-
my $libname = $_;
525-
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
526-
print F "$SLN_PRE";
527-
print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
528-
print F "$SLN_POST";
529-
}
527+
530528
my $uuid_libgit = $build_structure{"LIBS_libgit_GUID"};
531529
my $uuid_xdiff_lib = $build_structure{"LIBS_xdiff_lib_GUID"};
532530
foreach (@apps) {
@@ -540,6 +538,13 @@ sub createGlueProject {
540538
print F " EndProjectSection";
541539
print F "$SLN_POST";
542540
}
541+
foreach (@libs) {
542+
my $libname = $_;
543+
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
544+
print F "$SLN_PRE";
545+
print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
546+
print F "$SLN_POST";
547+
}
543548

544549
print F << "EOM";
545550
Global
@@ -551,17 +556,17 @@ EOM
551556
print F << "EOM";
552557
GlobalSection(ProjectConfigurationPlatforms) = postSolution
553558
EOM
554-
foreach (@libs) {
555-
my $libname = $_;
556-
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
559+
foreach (@apps) {
560+
my $appname = $_;
561+
my $uuid = $build_structure{"APPS_${appname}_GUID"};
557562
print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
558563
print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
559564
print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";
560565
print F "\t\t${uuid}.Release|Win32.Build.0 = Release|Win32\n";
561566
}
562-
foreach (@apps) {
563-
my $appname = $_;
564-
my $uuid = $build_structure{"APPS_${appname}_GUID"};
567+
foreach (@libs) {
568+
my $libname = $_;
569+
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
565570
print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
566571
print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
567572
print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";

0 commit comments

Comments
 (0)