You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/cmake-remote-debugging.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
---
2
-
title: "Tutorial: Run and debug a CMake project on a remote machine"
3
-
ms.date: "11/20/2020"
2
+
title: "Tutorial: Debug a CMake project on a remote ARM64 Windows machine"
3
+
ms.date: "11/21/2020"
4
4
ms.topic: tutorial
5
5
description: "How to use Visual Studio C++ on Windows to create and build a CMake project that you can deploy and debug on a remote ARM64 Windows machine."
6
6
---
7
7
8
-
# Tutorial: Run and debug a CMake project on a remote machine
8
+
# Tutorial: Debug a CMake project on a remote ARM64 Windows machine
9
9
10
-
This tutorial shows how to use Visual Studio C++ on Windows to create and build a CMake project than you can deploy and debug on a remote ARM64 Windows machine. The steps can be generalized to deploy and debug a CMake project that doesn't target ARM64.
10
+
This tutorial shows how to use Visual Studio C++ on Windows to create and build a CMake project that you can deploy and debug on a remote ARM64 Windows machine. These steps can be generalized to remotely deploy and debug a CMake project on other architectures.
11
11
12
-
This tutorial focuses on ARM64 because the default debugging experience for ARM64 is remote debugging. Attempting to debug ARM64 without configuring your CMake project as shown in this tutorial will result in an error that VS can't find the remote machine.
12
+
This tutorial focuses on ARM64 because the default debugging experience for ARM64 is remote debugging. Attempting to debug ARM64 without configuring your CMake project as shown in this tutorial results in an error that Visual Studio can't find the remote machine.
13
13
14
14
In this tutorial, you'll learn how to:
15
15
@@ -26,41 +26,43 @@ In this tutorial, you'll learn how to:
26
26
27
27
To set up Visual Studio for cross-platform C++ development, install the ARM64 build tools:
28
28
29
-
1. Run the Visual Studio Installer. If you haven't installed Visual Studio yet, see [Install Visual Studio](https://docs.microsoft.com/visualstudio/install/install-visual-studio?view=vs-2019#:~:text=Install%20Visual%20Studio%201%20Make%20sure%20your%20computer,...%204%20Choose%20workloads.%20...%20More%20items...%20)
29
+
1. Run the Visual Studio Installer. If you haven't installed Visual Studio yet, see [Install Visual Studio](https://docs.microsoft.com/visualstudio/install/install-visual-studio#:~:text=Install%20Visual%20Studio%201%20Make%20sure%20your%20computer,...%204%20Choose%20workloads.%20...%20More%20items...%20)
30
30
1. On the Visual Studio Installer home screen, choose **Modify**. (Look under **More** if you don't see it).
31
31
1. From the choices at the top, choose **Individual components**.
32
32
1. Scroll down to the **Compilers, build tools, and runtimes** section.
33
33
1. Ensure that the following are selected:
34
-
-**C++ Cmake tools for Windows**
34
+
-**C++ CMake tools for Windows**
35
35
-**MSVC v142 - VS 2019 C++ ARM64 build tools (v14.28)** (choose the latest version)
36
36
1. Select **Modify** to install the tools.
37
37
38
38
### On the remote machine
39
39
40
-
1. Install the ARM64 remote tools on the remote machine as described in [Download and Install the remote tools](https://docs.microsoft.com/visualstudio/debugger/remote-debugging-cpp?view=vs-2019&viewFallbackFrom=vs-2019%23download-and-install-the-remote-tools#download-and-install-the-remote-tools)
41
-
1. Follow the directions in [set up the remote debugger](https://docs.microsoft.com/visualstudio/debugger/remote-debugging-cpp?view=vs-2019&viewFallbackFrom=vs-2019%23download-and-install-the-remote-tools#BKMK_setup) on the remote ARM64 machine.
40
+
1. Install the ARM64 remote tools on the remote machine as described in [Download and Install the remote tools](https://docs.microsoft.com/visualstudio/debugger/remote-debugging-cpp?%23download-and-install-the-remote-tools#download-and-install-the-remote-tools).
41
+
1. Follow the directions in [set up the remote debugger](https://docs.microsoft.com/visualstudio/debugger/remote-debugging-cpp?%23download-and-install-the-remote-tools#BKMK_setup) on the remote ARM64 Windows machine.
42
42
43
43
## Create a CMake project
44
44
45
-
On the Windows host machine, run Visual Studio and choose **Create new project** > **CMake Project** > **Next**
46
-
Give the project a name and choose a location. Then select **Create**.
45
+
On the Windows host machine:
46
+
1. Run Visual Studio
47
+
1. From the main menu, select **Create new project** > **CMake Project** > **Next**
48
+
1. Give the project a name and choose a location. Then select **Create**.
47
49
48
50
Give Visual Studio a few moments to create the project and populate the **Solution Explorer**.
49
51
50
52
## Change the configuration to target ARM64
51
53
52
-
Because you are targeting an ARM64 Windows machine, you need to use the ARM64 build tools. To select the ARM64 build tools, select the Visual Studio **Configuration** dropdown and select **Manage Configurations...**
54
+
Because you're targeting an ARM64 Windows machine, you need to use the ARM64 build tools. To select the ARM64 build tools, select the Visual Studio **Configuration** dropdown and select **Manage Configurations...**
53
55
54
56

55
57
56
-
Change the **Configuration name** to **arm64-debug**. This is a unique, friendly name to make it easier for you to identify these settings.
58
+
Change the **Configuration name** to **arm64-debug**. This is a unique, friendly name to make it easier for you to identify these settings in the **Configuration** dropdown.
57
59
58
-
Select the **Toolset** dropdown and from the list of build tools, choose **msvc_arm64_x64**. Your settings should look something like this:
60
+
Select the **Toolset** dropdown. From the list of build tools, choose **msvc_arm64_x64**. Your settings should now look something like this:
> In the **Toolset** dropdown, **msvc_arm64** builds for 64-bit ARM, and**msvc_arm64 x64** uses the 64-bit host tools to cross-compile for ARM64--which is what you will do in this tutorial.
65
+
> In the **Toolset** dropdown, **msvc_arm64** builds for 64-bit ARM.**msvc_arm64 x64** uses the 64-bit host tools to cross-compile for ARM64--which is what you will do in this tutorial.
64
66
65
67
Save the `CMakeSettings.json` file and ensure that your **arm64-debug** configuration is selected in the configuration dropdown:
66
68
@@ -83,18 +85,18 @@ In the **Solution Explorer**, right-click the executable and select **Add Debug
83
85
84
86
This creates a `launch.vs.json` file in your project. Open it and change the following entries to enable remote debugging:
85
87
86
-
-`projectTarget` : set to the name of your target, for example, `CMakeProject3.exe` You can check the
88
+
-`projectTarget` : set to the name of your target, for example, `CMakeProject3.exe` You can check the startup item dropdown for the .exe file to get this name.
87
89
-`remoteMachineName` : set to the IP address of the remote ARM64 machine, or its machine name.
88
90
89
91
## Start the remote debugger monitor on the ARM64 Windows machine
90
92
91
-
Before you run your CMake project, ensure that the Visual Studio 2019 remote debugger is running on the remote ARM64 machine. You may need to change the remote debugger options depending on your authentication situation.
93
+
Before you run your CMake project, ensure that the Visual Studio 2019 remote debugger is running on the remote ARM64 Windows machine. You may need to change the remote debugger options depending on your authentication situation.
92
94
93
-
From the VS Remote Debugger menu bar, select **Tools** > **Options**. Then set authentication to match how your environment is set up:
95
+
From the Visual Studio Remote Debugger menu bar, select **Tools** > **Options**. Then set authentication to match how your environment is set up:
If you choose **No Authentication**, update the `launch.vs.json` file in your project by adding **"windowsAuthenticationType": "Remote Windows with No authentication"** to the `configurations` section `launch.vs.json`. For example:
99
+
If you choose **No Authentication**, update the `launch.vs.json` file in your project by adding **"windowsAuthenticationType": "Remote Windows with No authentication"** to the `configurations` section `launch.vs.json`. Otherwise, `"windowsAuthenticationType"` defaults to `"Remote Windows authentication"` and doesn't need to be explicitly stated. For example:
98
100
99
101
```XAML
100
102
{
@@ -124,34 +126,32 @@ If you choose **No Authentication**, update the `launch.vs.json` file in your pr
124
126
}
125
127
```
126
128
127
-
Otherwise, `"windowsAuthenticationType"` defaults to `"Remote Windows authentication"` and doesn't need to be explicitly stated.
128
-
129
129
## Debug the app
130
130
131
131
On the host machine, in the Visual Studio **Solution Explorer**, open the CPP file for your CMake project. If you're still in **CMake Targets View**, you'll need to open the **(executable)** node to see it.
132
132
133
133
The default CPP file is a simple hello world console app. Set a breakpoint on `return 0;` so that the program doesn't quickly run and close on the remote machine.
134
134
135
-
On the Visual Studio toolbar, use the startup item dropdown to change the startup item to match the name you specified for `"name"` in the`launch.vs.json` file:
135
+
On the Visual Studio toolbar, use the **Startup Item** dropdown to select the name you specified for `"name"` in your`launch.vs.json` file:
136
136
137
137

138
138
139
-
To start debugging, on the VS toolbar choose **Debug** > **Start Debugging** (or press **F5**).
139
+
To start debugging, on the Visual Studio toolbar choose **Debug** > **Start Debugging** (or press **F5**).
140
140
141
141
If it doesn't start, ensure that the following are set correctly in the `launch.vs.json` file:
142
142
-`"remoteMachineName"` should be set to the IP address, or machine name, of the remote ARM64 Windows machine.
143
-
-`"name"` should match the selection in the VS startup item dropdown.
143
+
-`"name"` should match the selection in the Visual Studio startup item dropdown.
144
144
-`"projectTarget"` should match the name of the executable file.
145
145
-`"type"` should be `"remoteWindows"`
146
146
- If the authentication type on the remote debugger is set to **No Authentication**, you should have `"windowsAuthenticationType": "Remote Windows with No authentication"` set in the `launch.vs.json` file.
147
147
148
-
After the project builds, the app should appear on the remote ARM64 machine:
148
+
After the project builds, the app should appear on the remote ARM64 Windows machine:
149
149
150
-

150
+

151
151
152
152
## What you learned
153
153
154
-
In this tutorial, you created a CMake project, configured it to build for ARM64 and to run on a remote machine. Then you built, ran, and debugged it on a remote ARM64 Windows machine.
154
+
In this tutorial, you created a CMake project, configured it to build for Windows on ARM64, and debugged it on a remote ARM64 Windows machine.
0 commit comments