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-projects-in-visual-studio.md
+16-29Lines changed: 16 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "CMake projects in Visual Studio"
3
-
ms.date: "06/12/2019"
3
+
ms.date: "10/01/2019"
4
4
helpviewer_keywords: ["CMake in Visual C++"]
5
5
ms.assetid: 444d50df-215e-4d31-933a-b41841f186f8
6
6
---
@@ -25,7 +25,7 @@ For more information, see [Install the C++ Linux workload in Visual Studio](../l
25
25
26
26
## IDE Integration
27
27
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:
29
29
30
30
- Visual Studio adds **CMake** items to the **Project** menu, with commands for viewing and editing CMake scripts.
31
31
@@ -54,18 +54,17 @@ If you need to pass arguments to an executable at debug time, you can use anothe
54
54
55
55
## Open an existing cache
56
56
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/).
59
58
60
59
## Building CMake projects
61
60
62
61
To build a CMake project, you have these choices:
63
62
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.
65
64
66
65
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.
67
66
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.
69
68
70
69

71
70
@@ -87,13 +86,13 @@ The **Run** or **F5** commands first build the project if changes have been made
87
86
88
87
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).
89
88
90
-
## Vcpkg Integration
89
+
## Just My Code for CMake projects
91
90
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**.
93
92
94
-
## Just My Code for CMake projects
93
+
## Vcpkg Integration
95
94
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.
97
96
98
97
## Customize configuration feedback
99
98
@@ -116,15 +115,9 @@ As soon as you save the file, the configuration step automatically runs again an
116
115
117
116
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.
118
117
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
-

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
-
125
118
## Troubleshooting CMake cache errors
126
119
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:
128
121
129
122
-**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).)
130
123
@@ -134,13 +127,7 @@ If you need more information about the state of the CMake cache to diagnose a pr
134
127
135
128
-**Generate Cache** forces the generate step to run even if Visual Studio considers the environment up-to-date.
136
129
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
-

130
+
Automatic cache generation can be disabled in the **Tools > Options > CMake > General** dialog.
144
131
145
132
## Run CMake from the command line
146
133
@@ -168,7 +155,7 @@ For more information, see [Install the C++ Linux workload in Visual Studio](../l
168
155
169
156
## IDE Integration
170
157
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:
172
159
173
160
- Visual Studio adds a **CMake** menu item to the main menu, with commands for viewing and editing CMake scripts.
174
161
@@ -197,13 +184,13 @@ If you need to pass arguments to an executable at debug time, you can use anothe
197
184
198
185
## Import an existing cache
199
186
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.
201
188
202
189
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.
203
190
204
191
### To import an existing cache
205
192
206
-
1. From the main menu, choose **File | Open | CMake**:
193
+
1. From the main menu, choose **File > Open > CMake**:
@@ -223,7 +210,7 @@ To build a CMake project, you have these choices:
223
210
224
211
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.
225
212
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.
227
214
228
215

229
216
@@ -279,7 +266,7 @@ If you need more information about the state of the CMake cache to diagnose a pr
279
266
280
267
-**Generate Cache** forces the generate step to run even if Visual Studio considers the environment up-to-date.
281
268
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.
Copy file name to clipboardExpand all lines: docs/build/reference/arch-x64.md
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "/arch (x64)"
3
-
ms.date: "11/04/2016"
3
+
ms.date: "10/01/2019"
4
4
ms.assetid: ecda22bf-5bed-43f4-99fb-88aedd83d9d8
5
5
---
6
6
# /arch (x64)
@@ -10,7 +10,7 @@ Specifies the architecture for code generation on x64. Also see [/arch (x86)](ar
10
10
## Syntax
11
11
12
12
```
13
-
/arch:[AVX|AVX2]
13
+
/arch:[AVX|AVX2|AVX512]
14
14
```
15
15
16
16
## Arguments
@@ -21,21 +21,38 @@ Enables the use of Intel Advanced Vector Extensions instructions.
21
21
**/arch:AVX2**<br/>
22
22
Enables the use of Intel Advanced Vector Extensions 2 instructions.
23
23
24
+
**/arch:AVX512**<br/>
25
+
Enables the use of Intel Advanced Vector Extensions 512 instructions.
26
+
24
27
## Remarks
25
28
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
+
26
31
**/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.
27
32
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.
29
46
30
-
### To set the /arch:AVXor /arch:AVX2 compiler option in Visual Studio
47
+
### To set the /arch:AVX, /arch:AVX2or /arch:AVX512 compiler option in Visual Studio
31
48
32
49
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).
33
50
34
51
1. Select the **Configuration Properties**, **C/C++** folder.
35
52
36
53
1. Select the **Code Generation** property page.
37
54
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)**.
0 commit comments