Changeset 224291 in webkit
- Timestamp:
- Nov 1, 2017 1:44:55 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r224288 r224291 1 2017-11-01 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 Yusuke Suzuki. 7 8 * Scripts/build-jsc: 9 * Scripts/build-webkit: 10 * Scripts/update-vswhere.py: Added. 11 * Scripts/webkitdirs.pm: 12 (requireModulesForVSWhere): 13 (pickCurrentVisualStudioInstallation): 14 (pickLegacyVisualStudioInstallation): 15 (visualStudioInstallDir): 16 (visualStudioInstallDirVSWhere): 17 (visualStudioInstallDirLegacy): 18 (visualStudioInstallDirFallback): 19 (msBuildInstallDir): 20 (visualStudioVersion): 21 (visualStudioVersionFromInstallDir): 22 (generateBuildSystemFromCMakeProject): 23 1 24 2017-11-01 Tim Horton <timothy_horton@apple.com> 2 25 -
trunk/Tools/Scripts/build-jsc
r224266 r224291 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
r224266 r224291 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
r224266 r224291 161 161 my $winVersion; 162 162 my $willUseVCExpressWhenBuilding = 0; 163 my $vsWhereFoundInstallation; 164 my $vsWhereLegacyInstallation; 163 165 164 166 # Defined in VCSUtils. … … 590 592 } 591 593 594 sub requireModulesForVSWhere 595 { 596 require Encode; 597 require Encode::Locale; 598 require JSON::PP; 599 } 600 601 sub pickCurrentVisualStudioInstallation 602 { 603 return $vsWhereFoundInstallation if defined $vsWhereFoundInstallation; 604 605 requireModulesForVSWhere(); 606 determineSourceDir(); 607 608 # Prefer Enterprise, then Professional, then Community, then 609 # anything else that provides MSBuild. 610 foreach my $productType (( 611 'Microsoft.VisualStudio.Product.Enterprise', 612 'Microsoft.VisualStudio.Product.Professional', 613 'Microsoft.VisualStudio.Product.Community', 614 undef 615 )) { 616 my $command = "$sourceDir/WebKitLibraries/win/tools/vswhere -nologo -latest -format json -requires Microsoft.Component.MSBuild"; 617 if (defined $productType) { 618 $command .= " -products $productType"; 619 } 620 my $vsWhereOut = `$command`; 621 my $installations = []; 622 eval { 623 $installations = JSON::PP::decode_json(Encode::encode('UTF-8' => Encode::decode(console_in => $vsWhereOut))); 624 }; 625 print "Error getting Visual Studio Location: $@\n" if $@; 626 undef $@; 627 628 if (scalar @$installations) { 629 my $installation = $installations->[0]; 630 $vsWhereFoundInstallation = $installation; 631 return $installation; 632 } 633 } 634 return undef; 635 } 636 637 sub pickLegacyVisualStudioInstallation 638 { 639 return $vsWhereLegacyInstallation if defined $vsWhereLegacyInstallation; 640 641 requireModulesForVSWhere(); 642 determineSourceDir(); 643 644 my $vsWhereOut = `$sourceDir/WebKitLibraries/win/tools/vswhere -nologo -legacy -format json`; 645 my $installations_all = []; 646 eval { 647 $installations_all = JSON::PP::decode_json(Encode::encode('UTF-8' => Encode::decode(console_in => $vsWhereOut))); 648 }; 649 print "Error getting Visual Studio Legacy Location: $@\n" if $@; 650 undef $@; 651 652 # It's possible that a non-legacy installation without msbuild 653 # would not be found by the latest, but would be found by this 654 # vswhere call, and we want to skip those, so check for versions 655 # with an installation version before 15.0. 656 my @installations = grep { $_->{installationVersion} < 15 } @$installations_all; 657 658 # We don't get much information that would let us choose between 659 # legacy installations, so we'll take the first. 660 if (scalar @installations) { 661 my $installation = $installations[0]; 662 $vsWhereLegacyInstallation = $installation; 663 return $installation; 664 } 665 return undef; 666 } 667 592 668 sub visualStudioInstallDir 593 669 { … … 598 674 $vsInstallDir =~ s|[\\/]$||; 599 675 } else { 600 $vsInstallDir = File::Spec->catdir(programFilesPathX86(), "Microsoft Visual Studio", "2017", "Community");676 $vsInstallDir = visualStudioInstallDirVSWhere(); 601 677 if (not -e $vsInstallDir) { 602 $vsInstallDir = File::Spec->catdir(programFilesPathX86(), "Microsoft Visual Studio 14.0"); 678 $vsInstallDir = visualStudioInstallDirLegacy(); 679 } 680 if (not -e $vsInstallDir) { 681 $vsInstallDir = visualStudioInstallDirFallback(); 682 print "Fallback $vsInstallDir\n"; 603 683 } 604 684 } … … 609 689 } 610 690 691 sub visualStudioInstallDirVSWhere 692 { 693 pickCurrentVisualStudioInstallation(); 694 if (defined($vsWhereFoundInstallation)) { 695 return $vsWhereFoundInstallation->{installationPath}; 696 } 697 return undef; 698 } 699 700 sub visualStudioInstallDirLegacy 701 { 702 pickLegacyVisualStudioInstallation(); 703 if (defined($vsWhereLegacyInstallation)) { 704 return $vsWhereLegacyInstallation->{installationPath}; 705 } 706 return undef; 707 } 708 709 sub visualStudioInstallDirFallback 710 { 711 foreach my $productType (( 712 'Enterprise', 713 'Professional', 714 'Community', 715 )) { 716 my $installdir = File::Spec->catdir(programFilesPathX86(), 717 "Microsoft Visual Studio", "2017", $productType); 718 my $msbuilddir = File::Spec->catdir($installdir, 719 "MSBuild", "15.0", "bin"); 720 if (-e $installdir && -e $msbuilddir) { 721 return $installdir; 722 } 723 } 724 return File::Spec->catdir(programFilesPathX86(), "Microsoft Visual Studio 14.0"); 725 } 726 611 727 sub msBuildInstallDir 612 728 { 613 729 return $msBuildInstallDir if defined $msBuildInstallDir; 614 730 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 } 731 my $version = visualStudioVersion(); 732 if ($version >= 15.0) { 733 my $installDir = visualStudioInstallDir(); 734 $msBuildInstallDir = File::Spec->catdir($installDir, 735 "MSBuild", $version, "bin"); 736 } else { 737 $msBuildInstallDir = File::Spec->catdir(programFilesPathX86(), 738 "MSBuild", "14.0", "Bin") 739 } 740 619 741 chomp($msBuildInstallDir = `cygpath "$msBuildInstallDir"`) if isCygwin(); 620 742 … … 628 750 629 751 my $installDir = visualStudioInstallDir(); 630 631 $vsVersion = ($installDir =~ /Microsoft Visual Studio ([0-9]+\.[0-9]*)/) ? $1 : "14"; 752 $vsVersion = visualStudioVersionFromInstallDir($installDir); 632 753 633 754 print "Using Visual Studio $vsVersion\n"; 634 755 return $vsVersion; 756 } 757 758 sub visualStudioVersionFromInstallDir 759 { 760 my ($dir) = @_; 761 my $version; 762 763 if ($dir =~ m|Microsoft Visual Studio[/\\]2017|) { 764 $version = "15.0"; 765 } 766 767 if (!defined($version)) { 768 if ($dir =~ /Microsoft Visual Studio ([0-9]+\.[0-9]*)/) { 769 $version = $1; 770 } 771 } 772 773 return $version; 635 774 } 636 775 … … 2085 2224 } 2086 2225 } elsif (isAnyWindows() && isWin64()) { 2087 push @args, '-G "Visual Studio 14 2015 Win64"'; 2226 if (visualStudioVersion() >= 15) { 2227 push @args, '-G "Visual Studio 15 2017 Win64"'; 2228 } else { 2229 push @args, '-G "Visual Studio 14 2015 Win64"'; 2230 } 2088 2231 } 2089 2232 # 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.