Title: [245087] trunk/Tools
Revision
245087
Author
[email protected]
Date
2019-05-08 19:06:39 -0700 (Wed, 08 May 2019)

Log Message

[Win] build-webkit should be ready for Visual Studio 2019
https://bugs.webkit.org/show_bug.cgi?id=196622

Reviewed by Ross Kirsling.

1. Accommodated to the new msbuild.exe location of VS 2019.
2. Removed the hard coded "Visual Studio 15" generator.

build-webkit is going to choose a Visual Studio generator version
matching with the latest installed VS. If you invoke vcvars.bat
before build-webkit, it chooses the corresponding Visual Studio
generator version by cheking 'VisualStudioVersion' env var which
is set by vcvars.bat.

* Scripts/webkitdirs.pm: Renamed $vcBuildPath to $msBuildPath. Removed $msBuildInstallDir.
(msBuildPath): When looking for MSBuild, look in
"MSBuild\Current\bin" (the new expected location) and fallback
to "MSBuild\15.0\bin" if we can't find an MSBuild.exe in the
first location.
(msBuildInstallDir): Renamed to msBuildPath.
(generateBuildSystemFromCMakeProject): Use -A switch to specify x64.
Add -G "Visual Studio " switch if a env var 'VisualStudioVersion'

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (245086 => 245087)


--- trunk/Tools/ChangeLog	2019-05-09 01:34:05 UTC (rev 245086)
+++ trunk/Tools/ChangeLog	2019-05-09 02:06:39 UTC (rev 245087)
@@ -1,3 +1,28 @@
+2019-05-08  Stephan Szabo  <[email protected]> and Fujii Hironori  <[email protected]>
+
+        [Win] build-webkit should be ready for Visual Studio 2019
+        https://bugs.webkit.org/show_bug.cgi?id=196622
+
+        Reviewed by Ross Kirsling.
+
+        1. Accommodated to the new msbuild.exe location of VS 2019.
+        2. Removed the hard coded "Visual Studio 15" generator.
+
+        build-webkit is going to choose a Visual Studio generator version
+        matching with the latest installed VS. If you invoke vcvars.bat
+        before build-webkit, it chooses the corresponding Visual Studio
+        generator version by cheking 'VisualStudioVersion' env var which
+        is set by vcvars.bat.
+
+        * Scripts/webkitdirs.pm: Renamed $vcBuildPath to $msBuildPath. Removed $msBuildInstallDir.
+        (msBuildPath): When looking for MSBuild, look in
+        "MSBuild\Current\bin" (the new expected location) and fallback
+        to "MSBuild\15.0\bin" if we can't find an MSBuild.exe in the
+        first location.
+        (msBuildInstallDir): Renamed to msBuildPath.
+        (generateBuildSystemFromCMakeProject): Use -A switch to specify x64.
+        Add -G "Visual Studio " switch if a env var 'VisualStudioVersion'
+
 2019-05-08  Don Olmstead  <[email protected]>
 
         [PlayStation] Update port options

Modified: trunk/Tools/Scripts/webkitdirs.pm (245086 => 245087)


--- trunk/Tools/Scripts/webkitdirs.pm	2019-05-09 01:34:05 UTC (rev 245086)
+++ trunk/Tools/Scripts/webkitdirs.pm	2019-05-09 02:06:39 UTC (rev 245087)
@@ -159,9 +159,8 @@
 
 # Variables for Win32 support
 my $programFilesPath;
-my $vcBuildPath;
+my $msBuildPath;
 my $vsInstallDir;
-my $msBuildInstallDir;
 my $vsVersion;
 my $windowsSourceDir;
 my $winVersion;
@@ -676,18 +675,20 @@
     return $vsInstallDir;
 }
 
-sub msBuildInstallDir
+sub msBuildPath
 {
-    return $msBuildInstallDir if defined $msBuildInstallDir;
-
     my $installDir = visualStudioInstallDir();
-    $msBuildInstallDir = File::Spec->catdir($installDir,
-        "MSBuild", "15.0", "bin");
 
-    chomp($msBuildInstallDir = `cygpath "$msBuildInstallDir"`) if isCygwin();
+    # FIXME: vswhere.exe should be used to find msbuild.exe after AppleWin will get vswhere with -find switch.
+    # <https://github.com/Microsoft/vswhere/wiki/Find-MSBuild>
+    # <https://github.com/Microsoft/vswhere/releases/tag/2.6.6%2Bd9dbe79db3>
+    my $path = File::Spec->catdir($installDir, "MSBuild", "Current", "bin", "MSBuild.exe");
+    $path = File::Spec->catdir($installDir, "MSBuild", "15.0", "bin", "MSBuild.exe") unless -e $path;
 
-    print "Using MSBuild: $msBuildInstallDir\n";
-    return $msBuildInstallDir;
+    chomp($path = `cygpath "$path"`) if isCygwin();
+
+    print "Using MSBuild: $path\n";
+    return $path;
 }
 
 sub determineConfigurationForVisualStudio
@@ -1836,7 +1837,7 @@
 sub setupCygwinEnv()
 {
     return if !isAnyWindows();
-    return if $vcBuildPath;
+    return if $msBuildPath;
 
     my $programFilesPath = programFilesPath();
 
@@ -1848,10 +1849,10 @@
 
     # We will actually use MSBuild to build WebKit, but we need to find the Visual Studio install (above) to make
     # sure we use the right options.
-    $vcBuildPath = File::Spec->catfile(msBuildInstallDir(), qw(MSBuild.exe));
-    if (! -e $vcBuildPath) {
+    $msBuildPath = msBuildPath();
+    if (! -e $msBuildPath) {
         print "*************************************************************\n";
-        print "Cannot find '$vcBuildPath'\n";
+        print "Cannot find '$msBuildPath'\n";
         print "Please make sure execute that the Microsoft .NET Framework SDK\n";
         print "is installed on this machine.\n";
         print "*************************************************************\n";
@@ -1911,7 +1912,7 @@
 
     my $maxCPUCount = '/maxcpucount:' . numberOfCPUs();
 
-    my @command = ($vcBuildPath, "/verbosity:minimal", $project, $action, $config, $platform, "/fl", $errorLogging, "/fl1", $warningLogging, $maxCPUCount);
+    my @command = ($msBuildPath, "/verbosity:minimal", $project, $action, $config, $platform, "/fl", $errorLogging, "/fl1", $warningLogging, $maxCPUCount);
     print join(" ", @command), "\n";
     return system @command;
 }
@@ -2195,11 +2196,14 @@
             push @args, "Ninja";
         }
         push @args, "-DUSE_THIN_ARCHIVES=OFF" if isPlayStation();
-    } elsif (isAnyWindows() && isWin64()) {
-        push @args, '-G "Visual Studio 15 2017 Win64"';
-        push @args, '-DCMAKE_GENERATOR_TOOLSET="host=x64"';
-    } elsif (isPlayStation()) {
-        push @args, '-G "Visual Studio 15"';
+    } else {
+        if (isAnyWindows() && isWin64()) {
+            push @args, '-A x64';
+        }
+        if ((isAnyWindows() || isPlayStation()) && defined $ENV{VisualStudioVersion}) {
+            my $var = int($ENV{VisualStudioVersion});
+            push @args, qq(-G "Visual Studio $var");
+        }
     }
 
     # Do not show progress of generating bindings in interactive Ninja build not to leave noisy lines on tty
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to