aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Costa <miguel.costa@qt.io>2021-02-18 16:33:31 +0100
committerMiguel Costa <miguel.costa@qt.io>2021-03-03 10:37:46 +0000
commita2552f04dc91fd35d33d70b6452077e5a81aca70 (patch)
tree9f4105008c30db292987d25b3b09df0414d68c89
parent01d1fd47f6fe11fe66879059c8b849fd17128551 (diff)
Disable WSL cross-compilation in VS2017
Cross-compilation (i.e. "Linux builds") of Qt VS projects using WSL is not supported in VS2017 and is now disabled. This is due to required Linux build tasks (e.g. ExecuteCommand) not being present in the MSBuild assemblies that ship with VS2017. Change-Id: Icf0b223b13da558e0375113d4293822a191c8322 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/qtmsbuild/QtMSBuild.csproj2
-rw-r--r--src/qtmsbuild/Tasks/HostExec_LinuxWSL.cs7
-rw-r--r--src/qtmsbuild/Tasks/HostExec_LinuxWSL_Error.cs60
-rw-r--r--src/qtmsbuild/Tasks/HostTranslatePaths_LinuxWSL.cs7
-rw-r--r--src/qtmsbuild/Tasks/HostTranslatePaths_LinuxWSL_Error.cs52
5 files changed, 124 insertions, 4 deletions
diff --git a/src/qtmsbuild/QtMSBuild.csproj b/src/qtmsbuild/QtMSBuild.csproj
index 99e84810..97951c0e 100644
--- a/src/qtmsbuild/QtMSBuild.csproj
+++ b/src/qtmsbuild/QtMSBuild.csproj
@@ -317,6 +317,8 @@
// -->
<ItemGroup>
<Compile Include="Tasks\CriticalSection.cs" />
+ <Compile Include="Tasks\HostExec_LinuxWSL_Error.cs" />
+ <Compile Include="Tasks\HostTranslatePaths_LinuxWSL_Error.cs" />
<Compile Include="Tasks\ListQrc.cs" />
<Compile Include="Tasks\ParseVarDefs.cs" />
<Compile Include="Tasks\GetVarsFromMakefile.cs" />
diff --git a/src/qtmsbuild/Tasks/HostExec_LinuxWSL.cs b/src/qtmsbuild/Tasks/HostExec_LinuxWSL.cs
index 342da3cb..0a6bd948 100644
--- a/src/qtmsbuild/Tasks/HostExec_LinuxWSL.cs
+++ b/src/qtmsbuild/Tasks/HostExec_LinuxWSL.cs
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#region Task TaskName="HostExec" Condition="'$(ApplicationType)' == 'Linux' AND '$(PlatformToolset)' == 'WSL_1_0'"
+#region Task TaskName="HostExec" Condition="'$(VisualStudioVersion)' == '16.0' AND '$(ApplicationType)' == 'Linux' AND '$(PlatformToolset)' == 'WSL_1_0'"
#region Reference
//$(VCTargetsPath)\Application Type\Linux\1.0\Microsoft.Build.Linux.Tasks.dll
@@ -85,6 +85,7 @@ namespace QtVsTools.QtMsBuild.Tasks
System.Boolean IgnoreExitCode = false)
#endregion
{
+#if VS2019
#region Code
if (!string.IsNullOrEmpty(Message))
Log.LogMessage(MessageImportance.High, Message);
@@ -143,7 +144,9 @@ namespace QtVsTools.QtMsBuild.Tasks
return false;
}
#endregion
-
+#else
+ ExitCode = 0;
+#endif
return true;
}
}
diff --git a/src/qtmsbuild/Tasks/HostExec_LinuxWSL_Error.cs b/src/qtmsbuild/Tasks/HostExec_LinuxWSL_Error.cs
new file mode 100644
index 00000000..c538a91a
--- /dev/null
+++ b/src/qtmsbuild/Tasks/HostExec_LinuxWSL_Error.cs
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt VS Tools.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#region Task TaskName="HostExec" Condition="'$(VisualStudioVersion)' != '16.0' AND '$(ApplicationType)' == 'Linux' AND '$(PlatformToolset)' == 'WSL_1_0'"
+
+namespace QtVsTools.QtMsBuild.Tasks
+{
+ public static class HostExec_LinuxWSL_Error
+ {
+ public static Microsoft.Build.Utilities.TaskLoggingHelper Log { get; set; }
+
+ public static bool Execute(
+ #region Parameters
+ System.String Command,
+ out System.Int32 ExitCode,
+ System.String Message = null,
+ System.String RedirectStdOut = null,
+ System.String RedirectStdErr = null,
+ System.String WorkingDirectory = null,
+ Microsoft.Build.Framework.ITaskItem[] Inputs = null,
+ Microsoft.Build.Framework.ITaskItem[] Outputs = null,
+ System.String RemoteTarget = null,
+ System.String RemoteProjectDir = null,
+ System.Boolean IgnoreExitCode = false)
+ #endregion
+ {
+ #region Code
+ ExitCode = 1;
+ Log.LogError("Cross-compilation of Qt projects in WSL not supported.");
+ return false;
+ #endregion
+ }
+ }
+}
+#endregion
diff --git a/src/qtmsbuild/Tasks/HostTranslatePaths_LinuxWSL.cs b/src/qtmsbuild/Tasks/HostTranslatePaths_LinuxWSL.cs
index 9d1a6687..1723b116 100644
--- a/src/qtmsbuild/Tasks/HostTranslatePaths_LinuxWSL.cs
+++ b/src/qtmsbuild/Tasks/HostTranslatePaths_LinuxWSL.cs
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#region Task TaskName="HostTranslatePaths" Condition="'$(ApplicationType)' == 'Linux' AND '$(PlatformToolset)' == 'WSL_1_0'"
+#region Task TaskName="HostTranslatePaths" Condition="'$(VisualStudioVersion)' == '16.0' AND '$(ApplicationType)' == 'Linux' AND '$(PlatformToolset)' == 'WSL_1_0'"
#region Reference
//$(VCTargetsPath)\Application Type\Linux\1.0\liblinux.dll
@@ -74,6 +74,7 @@ namespace QtVsTools.QtMsBuild.Tasks
System.String[] Names = null)
#endregion
{
+#if VS2019
#region Code
Result = new ITaskItem[] { };
var newItems = new List<ITaskItem>();
@@ -96,7 +97,9 @@ namespace QtVsTools.QtMsBuild.Tasks
}
Result = newItems.ToArray();
#endregion
-
+#else
+ Result = null;
+#endif
return true;
}
}
diff --git a/src/qtmsbuild/Tasks/HostTranslatePaths_LinuxWSL_Error.cs b/src/qtmsbuild/Tasks/HostTranslatePaths_LinuxWSL_Error.cs
new file mode 100644
index 00000000..c5c8cbcd
--- /dev/null
+++ b/src/qtmsbuild/Tasks/HostTranslatePaths_LinuxWSL_Error.cs
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt VS Tools.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#region Task TaskName="HostTranslatePaths" Condition="'$(VisualStudioVersion)' != '16.0' AND '$(ApplicationType)' == 'Linux' AND '$(PlatformToolset)' == 'WSL_1_0'"
+
+namespace QtVsTools.QtMsBuild.Tasks
+{
+ public static class HostTranslatePaths_LinuxWSL_Error
+ {
+ public static Microsoft.Build.Utilities.TaskLoggingHelper Log { get; set; }
+
+ public static bool Execute(
+ #region Parameters
+ Microsoft.Build.Framework.ITaskItem[] Items,
+ out Microsoft.Build.Framework.ITaskItem[] Result,
+ System.String[] Names = null)
+ #endregion
+ {
+ #region Code
+ Result = null;
+ Log.LogError("Cross-compilation of Qt projects in WSL not supported.");
+ return false;
+ #endregion
+ }
+ }
+}
+#endregion