diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm index 67418ed607..bcbb71410b 100644 --- a/contrib/buildsystems/Generators/Vcxproj.pm +++ b/contrib/buildsystems/Generators/Vcxproj.pm @@ -92,7 +92,7 @@ sub createProject { my ($name, $git_dir, $out_dir, $rel_dir, $build_structure, $static_library) = @_; my $label = $static_library ? "lib" : "app"; my $prefix = $static_library ? "LIBS_" : "APPS_"; - my $config_type = $static_library ? "StaticLibrary" : "Utility"; + my $config_type = $static_library ? "StaticLibrary" : "Application"; print "Generate $name vcxproj $label project\n"; my $cdup = $name; $cdup =~ s/[^\/]+/../g; @@ -129,7 +129,7 @@ sub createProject { my $libs = ''; if (!$static_library) { - $libs = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}})); + $libs = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|libcurl\.lib|libeay32\.lib|libiconv\.lib|ssleay32\.lib|zlib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}})); } $defines =~ s/-D//g; @@ -139,6 +139,39 @@ sub createProject { $defines =~ s/\'//g; die "Could not create the directory $target for $label project!\n" unless (-d "$target" || mkdir "$target"); + + use File::Copy; + copy("$git_dir/compat/vcbuild/packages.config", "$target/packages.config"); + + my $needsCurl = grep(/libcurl.lib/, @{$$build_structure{"$prefix${name}_LIBS"}}); + my $targetsImport = ''; + my $targetsErrors = ''; + my $afterTargets = ''; + open F, "<$git_dir/compat/vcbuild/packages.config"; + while () { + if (/"; + } elsif ($needsCurl && $1 eq 'curl') { + # libcurl is only available targeting v100 and v110 + $libs .= ";$rel_dir\\compat\\vcbuild\\GEN.PKGS\\$1.$2\\build\\native\\lib\\v110\\\$(Platform)\\Release\\dynamic\\libcurl.lib"; + $afterTargets .= "\n "; + } elsif ($needsCurl && $1 eq 'expat') { + # libexpat is only available targeting v100 and v110 + $libs .= ";$rel_dir\\compat\\vcbuild\\GEN.PKGS\\$1.$2\\build\\native\\lib\\v110\\\$(Platform)\\Release\\dynamic\\utf8\\libexpat.lib"; + } + next if ($1 =~ /^(zlib$|openssl(?!.*(x64|x86)$))/); + my $targetsFile = "$rel_dir\\compat\\vcbuild\\GEN.PKGS\\$1.$2\\build\\native\\$1.targets"; + $targetsImport .= "\n "; + $targetsErrors .= "\n "; + } + } + close F; + open F, ">$vcxproj" or die "Could not open $vcxproj for writing!\n"; binmode F, ":crlf :utf8"; print F chr(0xFEFF); @@ -211,6 +244,7 @@ sub createProject { $libs;\$(AdditionalDependencies) + invalidcontinue.obj %(AdditionalOptions) $cdup\\compat\\win32\\git.manifest Console @@ -284,9 +318,25 @@ EOM EOM } print F << "EOM"; + + + - + $targetsImport + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + $targetsErrors + +EOM + if (!$static_library && $afterTargets ne '') { + print F << "EOM"; + $afterTargets + +EOM + } + print F << "EOM"; EOM close F;