Skip to content

Commit f27e7a8

Browse files
authored
Merge branch 'master' into patch-10
2 parents d33fcd6 + 7cd4fdd commit f27e7a8

File tree

4 files changed

+93
-52
lines changed

4 files changed

+93
-52
lines changed

docs/build/cmake-projects-in-visual-studio.md

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "CMake projects in Visual Studio"
3-
ms.date: "06/12/2019"
3+
ms.date: "10/01/2019"
44
helpviewer_keywords: ["CMake in Visual C++"]
55
ms.assetid: 444d50df-215e-4d31-933a-b41841f186f8
66
---
@@ -25,7 +25,7 @@ For more information, see [Install the C++ Linux workload in Visual Studio](../l
2525

2626
## IDE Integration
2727

28-
When you choose **File | Open | Folder** to open a folder containing a CMakeLists.txt file, the following things happen:
28+
When you choose **File > Open > Folder** to open a folder containing a CMakeLists.txt file, the following things happen:
2929

3030
- Visual Studio adds **CMake** items to the **Project** menu, with commands for viewing and editing CMake scripts.
3131

@@ -54,18 +54,17 @@ If you need to pass arguments to an executable at debug time, you can use anothe
5454
5555
## Open an existing cache
5656

57-
When you open an existing CMake cache, Visual Studio will not attempt to manage your cache and build tree for you. This gives your custom or preferred tools complete control over how CMake configures your project. You can open an existing cache in Visual Studio via **File > Open > CMake** and navigating to an existing CMakeCache.txt. Alternatively, if you have already opened the project in Visual Studio, you can add an existing cache to it the same way you would add a new configuration. See our blog post on [opening an existing cache in Visual Studio](https://devblogs.microsoft.com/cppblog/open-existing-cmake-caches-in-visual-studio/) for more information.
58-
57+
When you open an existing CMake cache, Visual Studio will not attempt to manage your cache and build tree for you. This gives your custom or preferred tools complete control over how CMake configures your project. You can open an existing cache in Visual Studio via **File > Open > CMake** and navigating to an existing CMakeCache.txt. Alternatively, if you have already opened the project in Visual Studio, you can add an existing cache to it the same way you would add a new configuration. For more information, see our blog post on [opening an existing cache in Visual Studio](https://devblogs.microsoft.com/cppblog/open-existing-cmake-caches-in-visual-studio/).
5958

6059
## Building CMake projects
6160

6261
To build a CMake project, you have these choices:
6362

64-
1. In the General toolbar, find the **Configurations** dropdown; it is probably showing "Linux-Debug" or "x64-Debug" by default. Select the desired configuration and press **F5**, or click the **Run** (green triangle) button on the toolbar. The project automatically builds first, just like a Visual Studio solution.
63+
1. In the General toolbar, find the **Configurations** dropdown. It probably shows "x64-Debug" by default. Select the desired configuration and press **F5**, or click the **Run** (green triangle) button on the toolbar. The project automatically builds first, just like a Visual Studio solution.
6564

6665
1. Right click on the CMakeLists.txt and select **Build** from the context menu. If you have multiple targets in your folder structure, you can choose to build all or only one specific target.
6766

68-
1. From the main menu, select **Build | Build Solution** (**F7** or **Ctrl+Shift+B**). Make sure that a CMake target is already selected in the **Startup Item** dropdown in the **General** toolbar.
67+
1. From the main menu, select **Build > Build All** (**F7** or **Ctrl+Shift+B**). Make sure that a CMake target is already selected in the **Startup Item** dropdown in the **General** toolbar.
6968

7069
![CMake build menu command](media/cmake-build-menu.png "CMake build command menu")
7170

@@ -87,13 +86,13 @@ The **Run** or **F5** commands first build the project if changes have been made
8786

8887
You can customize a CMake debugging session by setting properties in the **launch.vs.json** file. For more information, see [Configure CMake debugging sessions](configure-cmake-debugging-sessions.md).
8988

90-
## Vcpkg Integration
89+
## Just My Code for CMake projects
9190

92-
If you have installed [vcpkg](vcpkg.md), CMake projects opened in Visual Studio will automatically integrate the vcpkg toolchain file. This means no additional configuration is required to use vcpkg with your CMake projects. This support works for both local vcpkg installations and vcpkg installations on remote machines that you are targeting. This behavior is disabled automatically when you specify any other toolchain in your CMake Settings configuration.
91+
When you build for Windows using the MSVC compiler, your CMake projects have support for Just my Code debugging in the compiler and linker if the option is enabled in Visual Studio. To change the setting, go to **Tools** > **Options** > **Debugging** > **General**.
9392

94-
## Just My Code for CMake projects
93+
## Vcpkg Integration
9594

96-
When you build for Windows using the MSVC compiler, your CMake projects now support Just my Code debugging in the compiler and linker if the option is enabled in Visual Studio. To change the setting, go to **Tools** > **Options** > **Debugging** > **General**.
95+
If you have installed [vcpkg](vcpkg.md), CMake projects opened in Visual Studio will automatically integrate the vcpkg toolchain file. This means no additional configuration is required to use vcpkg with your CMake projects. This support works for both local vcpkg installations and vcpkg installations on remote systems that you are targeting. This behavior is disabled automatically when you specify any other toolchain in your CMake Settings configuration.
9796

9897
## Customize configuration feedback
9998

@@ -116,15 +115,9 @@ As soon as you save the file, the configuration step automatically runs again an
116115

117116
When significant changes are made to the **CMakeSettings.json** or to CMakeLists.txt files, Visual Studio automatically reruns the CMake configure step. If the configure step finishes without errors, the information that is collected is available in C++ IntelliSense and language services and also in build and debug operations.
118117

119-
When multiple CMake projects use the same CMake configuration name (for example, x86-Debug), all of them are configured and built (in their own build root folder) when that configuration is selected. You can debug the targets from all of the CMake projects that participate in that CMake configuration.
120-
121-
![CMake Build Only menu item](media/cmake-build-only.png "CMake Build Only menu item")
122-
123-
To limit builds and debug sessions to a subset of the projects in the workspace, create a new configuration with a unique name in the **CMakeSettings.json** file and apply it to those projects only. When that configuration is selected, the IntelliSense and build and debug commands are enabled only for those specified projects.
124-
125118
## Troubleshooting CMake cache errors
126119

127-
If you need more information about the state of the CMake cache to diagnose a problem, open the **CMake** main menu or the **CMakeLists.txt** context menu in **Solution Explorer** to run one of these commands:
120+
If you need more information about the state of the CMake cache to diagnose a problem, open the **Project** main menu or the **CMakeLists.txt** context menu in **Solution Explorer** to run one of these commands:
128121

129122
- **View Cache** opens the CMakeCache.txt file from the build root folder in the editor. (Any edits you make here to CMakeCache.txt are wiped out if you clean the cache. To make changes that persist after the cache is cleaned, see [Customize CMake settings](customize-cmake-settings.md).)
130123

@@ -134,13 +127,7 @@ If you need more information about the state of the CMake cache to diagnose a pr
134127

135128
- **Generate Cache** forces the generate step to run even if Visual Studio considers the environment up-to-date.
136129

137-
Automatic cache generation can be disabled in the **Tools | Options | CMake | General** dialog.
138-
139-
## Single File Compilation
140-
141-
To build a single file in a CMake project, right-click on the file in **Solution Explorer** and choose **Compile**. You can also build the file that is currently open in the editor by using the main CMake menu:
142-
143-
![CMake single file compilation](media/cmake-single-file-compile.png)
130+
Automatic cache generation can be disabled in the **Tools > Options > CMake > General** dialog.
144131

145132
## Run CMake from the command line
146133

@@ -168,7 +155,7 @@ For more information, see [Install the C++ Linux workload in Visual Studio](../l
168155

169156
## IDE Integration
170157

171-
When you choose **File | Open | Folder** to open a folder containing a CMakeLists.txt file, the following things happen:
158+
When you choose **File > Open > Folder** to open a folder containing a CMakeLists.txt file, the following things happen:
172159

173160
- Visual Studio adds a **CMake** menu item to the main menu, with commands for viewing and editing CMake scripts.
174161

@@ -197,13 +184,13 @@ If you need to pass arguments to an executable at debug time, you can use anothe
197184
198185
## Import an existing cache
199186

200-
When you import an existing CMakeCache.txt file, Visual Studio automatically extracts customized variables and creates a pre-populated **CMakeSettings.json** file based on them. The original cache is not modified in any way and can still be used from the command line or with whatever tool or IDE was used to generate it. The new **CMakeSettings.json** file is placed alongside the project’s root CMakeLists.txt. Visual Studio generates a new cache based the settings file. You can override automatic cache generation in the **Tools | Options | CMake | General** dialog.
187+
When you import an existing CMakeCache.txt file, Visual Studio automatically extracts customized variables and creates a pre-populated **CMakeSettings.json** file based on them. The original cache is not modified in any way and can still be used from the command line or with whatever tool or IDE was used to generate it. The new **CMakeSettings.json** file is placed alongside the project’s root CMakeLists.txt. Visual Studio generates a new cache based the settings file. You can override automatic cache generation in the **Tools > Options > CMake > General** dialog.
201188

202189
Not everything in the cache is imported. Properties such as the generator and the location of the compilers are replaced with defaults that are known to work well with the IDE.
203190

204191
### To import an existing cache
205192

206-
1. From the main menu, choose **File | Open | CMake**:
193+
1. From the main menu, choose **File > Open > CMake**:
207194

208195
![Open CMake](media/cmake-file-open.png "File, Open, CMake")
209196

@@ -223,7 +210,7 @@ To build a CMake project, you have these choices:
223210

224211
1. Right click on the CMakeLists.txt and select **Build** from the context menu. If you have multiple targets in your folder structure, you can choose to build all or only one specific target.
225212

226-
1. From the main menu, select **Build | Build Solution** (**F7** or **Ctrl+Shift+B**). Make sure that a CMake target is already selected in the **Startup Item** dropdown in the **General** toolbar.
213+
1. From the main menu, select **Build > Build Solution** (**F7** or **Ctrl+Shift+B**). Make sure that a CMake target is already selected in the **Startup Item** dropdown in the **General** toolbar.
227214

228215
![CMake build menu command](media/cmake-build-menu.png "CMake build command menu")
229216

@@ -279,7 +266,7 @@ If you need more information about the state of the CMake cache to diagnose a pr
279266

280267
- **Generate Cache** forces the generate step to run even if Visual Studio considers the environment up-to-date.
281268

282-
Automatic cache generation can be disabled in the **Tools | Options | CMake | General** dialog.
269+
Automatic cache generation can be disabled in the **Tools > Options > CMake > General** dialog.
283270

284271
## Single File Compilation
285272

docs/build/reference/arch-x64.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "/arch (x64)"
3-
ms.date: "11/04/2016"
3+
ms.date: "10/01/2019"
44
ms.assetid: ecda22bf-5bed-43f4-99fb-88aedd83d9d8
55
---
66
# /arch (x64)
@@ -10,7 +10,7 @@ Specifies the architecture for code generation on x64. Also see [/arch (x86)](ar
1010
## Syntax
1111

1212
```
13-
/arch:[AVX|AVX2]
13+
/arch:[AVX|AVX2|AVX512]
1414
```
1515

1616
## Arguments
@@ -21,21 +21,38 @@ Enables the use of Intel Advanced Vector Extensions instructions.
2121
**/arch:AVX2**<br/>
2222
Enables the use of Intel Advanced Vector Extensions 2 instructions.
2323

24+
**/arch:AVX512**<br/>
25+
Enables the use of Intel Advanced Vector Extensions 512 instructions.
26+
2427
## Remarks
2528

29+
The **/arch** option enables the use of certain instruction set extensions, particularly for vector calculation, available in processors from Intel and AMD. In general, more recently introduced processors may support additional extensions over those supported by older processors, although you should consult the documentation for a particular processor or test for instruction set extension support using [__cpuid](../../intrinsics/cpuid-cpuidex.md) before executing code using an instruction set extension.
30+
2631
**/arch** only affects code generation for native functions. When you use [/clr](clr-common-language-runtime-compilation.md) to compile, **/arch** has no effect on code generation for managed functions.
2732

28-
The `__AVX__` preprocessor symbol is defined when the **/arch:AVX** compiler option is specified. The `__AVX2__` preprocessor symbol is defined when the **/arch:AVX2** compiler option is specified. For more information, see [Predefined Macros](../../preprocessor/predefined-macros.md). The **/arch:AVX2** option was introduced in Visual Studio 2013 Update 2, version 12.0.34567.1.
33+
The processor extensions have the following characteristics:
34+
35+
- The default mode uses SSE2 instructions for scalar floating-point and vector calculations. These instructions allow calculation with 128-bit vectors of single-precision, double-precision and 1, 2, 4 or 8 byte integer values, as well as single-precision and double-precision scalar floating-point values.
36+
37+
- **AVX** introduced an alternative instruction encoding for vector and floating-point scalar instructions that allows vectors of either 128 bits or 256 bits, and zero-extends all vector results to the full vector size. (For legacy compatibility, SSE-style vector instructions preserve all bits beyond bit 127.) Most floating-point operations are extended to 256 bits.
38+
39+
- **AVX2** extends most integer operations to 256-bit vectors and enables use of Fused Multiply-Add (FMA) instructions.
40+
41+
- **AVX-512** introduced another instruction encoding form that allows 512-bit vectors, plus certain other optional features. Instructions for additional operations were also added.
42+
43+
Each **/arch** option may also enable the use of other non-vector instructions that are associated with that option. An example is the use of certain BMI instructions when **/arch:AVX2** is specified.
44+
45+
The `__AVX__` preprocessor symbol is defined when the **/arch:AVX**, **/arch:AVX2** or **/arch:AVX512** compiler option is specified. The `__AVX2__` preprocessor symbol is defined when the **/arch:AVX2** or **/arch:AVX512** compiler option is specified. The `__AVX512F__`, `__AVX512CD__`, `__AVX512BW__`, `__AVX512DQ__` and `__AVX512VL__` preprocessor symbols are defined when the **/arch:AVX512** compiler option is specified. For more information, see [Predefined Macros](../../preprocessor/predefined-macros.md). The **/arch:AVX2** option was introduced in Visual Studio 2013 Update 2, version 12.0.34567.1. Limited support for **/arch:AVX512** was added in Visual Studio 2017, and expanded in Visual Studio 2019.
2946

30-
### To set the /arch:AVX or /arch:AVX2 compiler option in Visual Studio
47+
### To set the /arch:AVX, /arch:AVX2 or /arch:AVX512 compiler option in Visual Studio
3148

3249
1. Open the **Property Pages** dialog box for the project. For more information, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
3350

3451
1. Select the **Configuration Properties**, **C/C++** folder.
3552

3653
1. Select the **Code Generation** property page.
3754

38-
1. In the **Enable Enhanced Instruction Set** drop-down box, choose **Advanced Vector Extensions (/arch:AVX)** or **Advanced Vector Extensions 2 (/arch:AVX2)**.
55+
1. In the **Enable Enhanced Instruction Set** drop-down box, choose **Advanced Vector Extensions (/arch:AVX)**, **Advanced Vector Extensions 2 (/arch:AVX2)** or **Advanced Vector Extensions 512 (/arch:AVX512)**.
3956

4057
### To set this compiler option programmatically
4158

0 commit comments

Comments
 (0)