Changeset 224143 in webkit
- Timestamp:
- Oct 27, 2017 8:49:10 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r224140 r224143 1 2017-10-27 Stephan Szabo <stephan.szabo@sony.com> 2 3 [Win] Detect Visual Studio 2017 location 4 https://bugs.webkit.org/show_bug.cgi?id=175275 5 6 Reviewed by Per Arne Vollan. 7 8 * Scripts/build-jsc: 9 * Scripts/build-webkit: 10 * Scripts/update-vswhere.py: Added. 11 * Scripts/webkitdirs.pm: 12 (pickCurrentVisualStudioInstallation): 13 (pickLegacyVisualStudioInstallation): 14 (visualStudioInstallDir): 15 (visualStudioInstallDirVSWhere): 16 (visualStudioInstallDirLegacy): 17 (visualStudioInstallDirFallback): 18 (msBuildInstallDir): 19 (visualStudioVersion): 20 (visualStudioVersionFromInstallDir): 21 (generateBuildSystemFromCMakeProject): 22 1 23 2017-10-27 Devin Rousso <webkit@devinrousso.com> 2 24 -
trunk/Tools/Scripts/build-jsc
r223904 r224143 118 118 if (isJSCOnly() && isWindows()) { 119 119 (system("python Tools/Scripts/update-webkit-wincairo-libs.py") == 0) or die; 120 system("python Tools/Scripts/update-vswhere.py"); 120 121 } 121 122 -
trunk/Tools/Scripts/build-webkit
r223818 r224143 246 246 } 247 247 248 if (isAnyWindows()) { 249 system("python Tools/Scripts/update-vswhere.py"); 250 } 251 248 252 # If asked to build just the WebKit project, overwrite the projects 249 253 # list after all of the port specific tweaks have been made to -
trunk/Tools/Scripts/webkitdirs.pm
r223234 r224143 36 36 use Cwd qw(realpath); 37 37 use Digest::MD5 qw(md5_hex); 38 use Encode; 39 use Encode::Locale; 38 40 use FindBin; 39 41 use File::Basename; … … 43 45 use File::Temp qw(tempdir); 44 46 use File::stat; 47 use JSON::PP; 45 48 use List::Util; 46 49 use POSIX; … … 161 164 my $winVersion; 162 165 my $willUseVCExpressWhenBuilding = 0; 166 my $vsWhereFoundInstallation; 167 my $vsWhereLegacyInstallation; 163 168 164 169 # Defined in VCSUtils. … … 590 595 } 591 596 597 sub pickCurrentVisualStudioInstallation 598 { 599 return $vsWhereFoundInstallation if defined $vsWhereFoundInstallation; 600 601 determineSourceDir(); 602 603 # Prefer Enterprise, then Professional, then Community, then 604 # anything else that provides MSBuild. 605 foreach my $productType (( 606 'Microsoft.VisualStudio.Product.Enterprise', 607 'Microsoft.VisualStudio.Product.Professional', 608 'Microsoft.VisualStudio.Product.Community', 609 undef 610 )) { 611 my $command = "$sourceDir/WebKitLibraries/win/tools/vswhere -nologo -latest -format json -requires Microsoft.Component.MSBuild"; 612 if (defined $productType) { 613 $command .= " -products $productType"; 614 } 615 my $vsWhereOut = `$command`; 616 my $installations = []; 617 eval { 618 $installations = decode_json Encode::encode('UTF-8' => Encode::decode(console_in => $vsWhereOut)); 619 }; 620 print "Error getting Visual Studio Location: $@\n" if $@; 621 undef $@; 622 623 if (scalar @$installations) { 624 my $installation = $installations->[0]; 625 $vsWhereFoundInstallation = $installation; 626 return $installation; 627 } 628 } 629 return undef; 630 } 631 632 sub pickLegacyVisualStudioInstallation 633 { 634 return $vsWhereLegacyInstallation if defined $vsWhereLegacyInstallation; 635 636 determineSourceDir(); 637 638 my $vsWhereOut = `$sourceDir/WebKitLibraries/win/tools/vswhere -nologo -legacy -format json`; 639 my $installations_all = []; 640 eval { 641 $installations_all = decode_json Encode::encode('UTF-8' => Encode::decode(console_in => $vsWhereOut)); 642 }; 643 print "Error getting Visual Studio Legacy Location: $@\n" if $@; 644 undef $@; 645 646 # It's possible that a non-legacy installation without msbuild 647 # would not be found by the latest, but would be found by this 648 # vswhere call, and we want to skip those, so check for versions 649 # with an installation version before 15.0. 650 my @installations = grep { (+$_->{installationVersion}) < 15 } @$installations_all; 651 652 # We don't get much information that would let us choose between 653 # legacy installations, so we'll take the first. 654 if (scalar @installations) { 655 my $installation = $installations[0]; 656 $vsWhereLegacyInstallation = $installation; 657 return $installation; 658 } 659 return undef; 660 } 661 592 662 sub visualStudioInstallDir 593 663 { … … 598 668 $vsInstallDir =~ s|[\\/]$||; 599 669 } else { 600 $vsInstallDir = File::Spec->catdir(programFilesPathX86(), "Microsoft Visual Studio", "2017", "Community");670 $vsInstallDir = visualStudioInstallDirVSWhere(); 601 671 if (not -e $vsInstallDir) { 602 $vsInstallDir = File::Spec->catdir(programFilesPathX86(), "Microsoft Visual Studio 14.0"); 672 $vsInstallDir = visualStudioInstallDirLegacy(); 673 } 674 if (not -e $vsInstallDir) { 675 $vsInstallDir = visualStudioInstallDirFallback(); 676 print "Fallback $vsInstallDir\n"; 603 677 } 604 678 } … … 609 683 } 610 684 685 sub visualStudioInstallDirVSWhere 686 { 687 pickCurrentVisualStudioInstallation(); 688 if (defined($vsWhereFoundInstallation)) { 689 return $vsWhereFoundInstallation->{installationPath}; 690 } 691 return undef; 692 } 693 694 sub visualStudioInstallDirLegacy 695 { 696 pickLegacyVisualStudioInstallation(); 697 if (defined($vsWhereLegacyInstallation)) { 698 return $vsWhereLegacyInstallation->{installationPath}; 699 } 700 return undef; 701 } 702 703 sub visualStudioInstallDirFallback 704 { 705 foreach my $productType (( 706 'Enterprise', 707 'Professional', 708 'Community', 709 )) { 710 my $installdir = File::Spec->catdir(programFilesPathX86(), 711 "Microsoft Visual Studio", "2017", $productType); 712 my $msbuilddir = File::Spec->catdir($installdir, 713 "MSBuild", "15.0", "bin"); 714 if (-e $installdir && -e $msbuilddir) { 715 return $installdir; 716 } 717 } 718 return File::Spec->catdir(programFilesPathX86(), "Microsoft Visual Studio 14.0"); 719 } 720 611 721 sub msBuildInstallDir 612 722 { 613 723 return $msBuildInstallDir if defined $msBuildInstallDir; 614 724 615 $msBuildInstallDir = File::Spec->catdir(programFilesPathX86(), "Microsoft Visual Studio", "2017", "Community", "MSBuild", "15.0", "Bin"); 616 if (not -e $msBuildInstallDir) { 617 $msBuildInstallDir = File::Spec->catdir(programFilesPathX86(), "MSBuild", "14.0", "Bin"); 618 } 725 my $version = visualStudioVersion(); 726 if ($version >= 15.0) { 727 my $installDir = visualStudioInstallDir(); 728 $msBuildInstallDir = File::Spec->catdir($installDir, 729 "MSBuild", $version, "bin"); 730 } else { 731 $msBuildInstallDir = File::Spec->catdir(programFilesPathX86(), 732 "MSBuild", "14.0", "Bin") 733 } 734 619 735 chomp($msBuildInstallDir = `cygpath "$msBuildInstallDir"`) if isCygwin(); 620 736 … … 628 744 629 745 my $installDir = visualStudioInstallDir(); 630 631 $vsVersion = ($installDir =~ /Microsoft Visual Studio ([0-9]+\.[0-9]*)/) ? $1 : "14"; 746 $vsVersion = visualStudioVersionFromInstallDir($installDir); 632 747 633 748 print "Using Visual Studio $vsVersion\n"; 634 749 return $vsVersion; 750 } 751 752 sub visualStudioVersionFromInstallDir 753 { 754 my ($dir) = @_; 755 my $version; 756 757 if ($dir =~ m|Microsoft Visual Studio[/\\]2017|) { 758 $version = "15.0"; 759 } 760 761 if (!defined($version)) { 762 if ($dir =~ /Microsoft Visual Studio ([0-9]+\.[0-9]*)/) { 763 $version = $1; 764 } 765 } 766 767 return $version; 635 768 } 636 769 … … 2085 2218 } 2086 2219 } elsif (isAnyWindows() && isWin64()) { 2087 push @args, '-G "Visual Studio 14 2015 Win64"'; 2220 if (visualStudioVersion() >= 15) { 2221 push @args, '-G "Visual Studio 15 2017 Win64"'; 2222 } else { 2223 push @args, '-G "Visual Studio 14 2015 Win64"'; 2224 } 2088 2225 } 2089 2226 # Do not show progress of generating bindings in interactive Ninja build not to leave noisy lines on tty
Note: See TracChangeset
for help on using the changeset viewer.