Skip to content

Commit 0434ff3

Browse files
TylerMSFTTylerMSFT
authored andcommitted
tech review
1 parent 65a1e9d commit 0434ff3

File tree

3 files changed

+30
-26
lines changed

3 files changed

+30
-26
lines changed

docs/build/cmake-remote-debugging.md

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
title: "Tutorial: Run and debug a CMake project on a remote machine"
33
ms.date: "11/20/2020"
44
ms.topic: tutorial
5-
description: "How to use Visual Studio C++ on Windows to create and build a CMake project than you can deploy and debug on an ARM64 device."
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."
66
---
77

88
# Tutorial: Run and debug a CMake project on a remote machine
99

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 an ARM64 device. 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 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.
1111

1212
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.
1313

@@ -17,25 +17,28 @@ In this tutorial, you'll learn how to:
1717
>
1818
> * create a CMake project
1919
> * configure a CMake project to build for ARM64
20-
> * configure a CMake project to run on a remote ARM64 device
21-
> * debug a CMake project running on a remote ARM64 device
20+
> * configure a CMake project to run on a remote ARM64 Windows machine
21+
> * debug a CMake project running on a remote ARM64 Windows machine
2222
2323
## Prerequisites
2424

2525
### On the host machine
2626

27-
Set up Visual Studio for cross-platform C++ development by installing the ARM64 build tools:
27+
To set up Visual Studio for cross-platform C++ development, install the ARM64 build tools:
2828

29-
Todo! VS installer > Modify > Individual Components
30-
In the **Compilers, build tools, and runtimes** section install
31-
C++ ARM64 build tools (v14.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)
30+
1. On the Visual Studio Installer home screen, choose **Modify**. (Look under **More** if you don't see it).
31+
1. From the choices at the top, choose **Individual components**.
32+
1. Scroll down to the **Compilers, build tools, and runtimes** section.
33+
1. Ensure that the following are selected:
34+
- **C++ Cmake tools for Windows**
35+
- **MSVC v142 - VS 2019 C++ ARM64 build tools (v14.28)** (choose the latest version)
36+
1. Select **Modify** to install the tools.
3237

3338
### On the remote machine
3439

35-
Install the remote debugging tools on the remote machine.
36-
37-
ToDo! This tutorial targets ARM64, so install the ARM64 version of the Visual Studio 2019 remote debugging tools.
38-
[link to download](https://visualstudio.microsoft.com/downloads/#remote-tools-for-visual-studio-2019)
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.
3942

4043
## Create a CMake project
4144

@@ -46,7 +49,7 @@ Give Visual Studio a few moments to create the project and populate the **Soluti
4649

4750
## Change the configuration to target ARM64
4851

49-
Because you are targeting an ARM64 device, you need to use the ARM64 build tools. To select the ARM64 build tools, select the Visual Studio **Configuration** dropdown and select **Manage Configurations...**
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...**
5053

5154
![Choose Manage Configurations in the Visual Studio configurations drop-down](media/vs2019-cmake-manage-configurations.png)
5255

@@ -59,6 +62,11 @@ Select the **Toolset** dropdown and from the list of build tools, choose **msvc_
5962
> [!Note]
6063
> 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.
6164
65+
Save the `CMakeSettings.json` file and ensure that your **arm64-debug** configuration is selected in the configuration dropdown:
66+
67+
![Ensure that arm64-debug is selected in the Visual Studio configurations drop-down](media/vs2019-cmake-manage-configurations-arm.png)
68+
69+
6270
## Add a debug configuration file
6371

6472
Next, add configuration information that tells Visual Studio where to find your remote machine, and other configuration details.
@@ -75,10 +83,10 @@ In the **Solution Explorer**, right-click the executable and select **Add Debug
7583

7684
This creates a `launch.vs.json` file in your project. Open it and change the following entries to enable remote debugging:
7785

78-
- `projectTarget` : set to the name of your executable; for example, `CMakeProject3`
86+
- `projectTarget` : set to the name of your target, for example, `CMakeProject3.exe` You can check the
7987
- `remoteMachineName` : set to the IP address of the remote ARM64 machine, or its machine name.
8088

81-
## Start the remote debugger monitor on the ARM64 device
89+
## Start the remote debugger monitor on the ARM64 Windows machine
8290

8391
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.
8492

@@ -98,7 +106,7 @@ If you choose **No Authentication**, update the `launch.vs.json` file in your pr
98106
"windowsAuthenticationType": "Remote Windows with No authentication"
99107
"name": "CMakeLists.txt",
100108
"project": "CMakeLists.txt",
101-
"projectTarget": "CMakeProject1",
109+
"projectTarget": "CMakeProject3.exe",
102110
"remoteMachineName": "<ip address goes here>",
103111
"cwd": "${debugInfo.defaultWorkingDirectory}",
104112
"program": "${debugInfo.fullTargetPath}",
@@ -126,28 +134,24 @@ The default CPP file is a simple hello world console app. Set a breakpoint on `r
126134

127135
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:
128136

129-
![Startup item dropdown](media/startup-item.png)
137+
![Example startup item dropdown with CMakeProject3.exe selected](media/startup-item.png)
130138

131139
To start debugging, on the VS toolbar choose **Debug** > **Start Debugging** (or press **F5**).
132140

133141
If it doesn't start, ensure that the following are set correctly in the `launch.vs.json` file:
134-
- `"remoteMachineName"` should be set to the IP address, or machine name, of the remote ARM64 device.
142+
- `"remoteMachineName"` should be set to the IP address, or machine name, of the remote ARM64 Windows machine.
135143
- `"name"` should match the selection in the VS startup item dropdown.
136-
- `"projectTarget"` should be set to the name of the executable file.
137-
- `"type"` should be set to `"remoteWindows"`
144+
- `"projectTarget"` should match the name of the executable file.
145+
- `"type"` should be `"remoteWindows"`
138146
- 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.
139147

140148
After the project builds, the app should appear on the remote ARM64 machine:
141149

142-
![Startup item dropdown](media/remote-cmake-app.png)
150+
![Hello Cmake console app running on remote Windows ARM64 machine](media/remote-cmake-app.png)
143151

144152
## What you learned
145153

146-
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 device.
147-
148-
## Target other platforms.
149-
150-
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.
151155

152156
## Next steps
153157

docs/build/media/startup-item.png

-2.37 KB
Loading
8.65 KB
Loading

0 commit comments

Comments
 (0)