Commit Graph

231 Commits

Author SHA1 Message Date
Brad King
48db261e69 cmake --build: Use both inter- and intra-project parallelism with msbuild
Since commit 1ab3881ec9 (cmake: Add options for parallel builds to
--build mode, 2018-04-14, v3.12.0-rc1~42^2), `cmake --build --parallel`
has added two options to the msbuild command line:

* `/m` enables inter-project parallelism in msbuild.
* `/p:CL_MPCount=1` suppresses intra-project parallelism in cl.

The latter was used to avoid `O(N^2)` compilation threads on `N`
processors.  In practice however, projects often have many source files
in a few targets, so `--parallel` actually reduces parallelism.

Drop the latter option to restore intra-project parallelism.
Users can always add `-- /p:CL_MPCount=1` themselves.

Fixes: #20564
2022-11-16 09:38:41 -05:00
Ilia K
3166547cf6 ASM_MARMASM: Add support for Microsoft ARM assembler language
https://learn.microsoft.com/en-us/cpp/assembler/arm/arm-assembler-reference

Fixes: #23999
2022-11-09 10:22:46 -05:00
Brad King
8d6f015d59 Drop Visual Studio 10 2010 generator
This generator has been deprecated since CMake 3.22.  Remove it.
2022-09-26 15:43:04 -04:00
Nicholas Sinlock
f972e4fd3a cmVSGenerator: Add support for two-part toolset versions for Visual Studio
Enables the Global Visual Studio Versioned Generator to use two-part toolset versions,
if only one toolset has that version number. For example, (14.32 is specified when
14.32.32142 and 14.32.23242 are installed). This change also add a unique return code
and message if a two-part version is used when multiple matching versions are present.

Fixes: #23933
2022-09-02 14:41:37 -07:00
Brad King
289932ded0 VS: Revert "Write ZERO_CHECK.proj for VS19 and above"
Revert commit a334f1b906 (VS: Write ZERO_CHECK.proj for VS19 and above,
2021-12-24, v3.24.0-rc1~607^2) and a supporting change from
commit 7219988b00 (VS: Exclude ZERO_CHECK.proj from .sln for
include_external_msproject, 2022-07-15, v3.24.0-rc4~1^2).

The change was made to support `dotnet` tooling in addition to
`msbuild`.  However, not having `ZERO_CHECK` in the `.sln` breaks common
interactive workflows.  Revert the change for now.  Later it can be
re-introduced behind some kind of option that enables `dotnet` support.

Fixes: #23726
Issue: #20227
2022-07-22 12:54:20 -04:00
Sumit Bhardwaj
7219988b00 VS: Exclude ZERO_CHECK.proj from .sln for include_external_msproject
In `cmGlobalVisualStudio7Generator::WriteTargetsToSolution`, we skip
writing `ZERO_CHECK.proj` to solution file as the check in
`cmGlobalVisualStudioGenerator::IsInSolution` returns `false` for
`ZERO_CHECK`. However, we write ZERO_CHECK to ProjectDependencies for
external projects as there are no checks in
`cmGlobalVisualStudio71Generator::WriteExternalProject`.

Similar to `cmGlobalVisualStudioGenerator::IsInSolution`, we introduce
`IsDepInSolution(const std::string&)` which excludes `ZERO_CHECK.proj`
from being added to sln file for the cases where we have `ZERO_CHECK.proj`.

Fixes: #23708
2022-07-20 08:51:38 -04:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Sumit Bhardwaj
a334f1b906 VS: Write ZERO_CHECK.proj for VS19 and above
For VS 19 and above, switch the format of project file to
`VsProjectType::proj` for ZERO_CHECK target. The `ZERO_CHECK.proj`
consists of primitive MSBuild commands only and has no dependency on any
other targets or props files. This proj file is written as a
`ProjectReference` for other targets, but is not written to the sln
file.
2022-02-20 16:47:36 -08:00
Brad King
4313c5acbc VS: Revert "Write ZERO_CHECK.proj for VS19 and above"
Revert commit 925da7d428 (VS: Write ZERO_CHECK.proj for VS19 and above,
2021-12-24).  Although its commit message was mistakenly not updated, it
implemented the change for VS 2017 and below too.  Since it was merged,
I've discovered several subtle failures in nightly testing with VS 2017.
Revert the change pending further investigation.
2022-02-17 11:23:02 -05:00
Brad King
731bdec8b9 Merge topic 'vs-package-restore-docs'
d92469e572 Help: Clarify how package resolve mode is intended to be used
f320a31087 cmake --build: prioritize --resolve-package-references over preset

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6984
2022-02-16 09:41:03 -05:00
Carsten Rudolph
f320a31087 cmake --build: prioritize --resolve-package-references over preset
Fixes: #23224
2022-02-15 10:20:02 -05:00
Sumit Bhardwaj
925da7d428 VS: Write ZERO_CHECK.proj for VS19 and above
Use VsProjectType::proj as the file format for ZERO_CHECK and write
ZERO_CHECK.proj as a msbuild dependency for other projects.
2022-02-12 12:09:09 -05:00
Florian Schweiger
5cdd774d51 VS: Handle build target correct for .NET SDK style projects with Any CPU
* Extend Visual Studio solution parser for reading build target
* Map solution build target to project build target (especially for Any CPU)
* Use C++ <optional> template instead of pointer return value for cmSlnData::GetProjectByGUID
2022-02-07 13:08:37 +01:00
Sumit Bhardwaj
a88f98b3be Make cmGlobalVisualStudioGenerator::VSVersion enum class 2022-01-25 11:25:18 -08:00
Carsten Rudolph
9aa7831f05 Presets: add resolve packages setting to build presets. 2022-01-22 06:35:41 -05:00
Carsten Rudolph
b2f8f0bb87 cmGlobalVisualStudio10Generator: Auto restore NuGet packages. 2022-01-22 06:35:41 -05:00
Carsten Rudolph
193b8fca52 cmBuildOptions: Split build arguments into separate object. 2022-01-22 06:35:38 -05:00
NAKAMURA Takumi
0e58a5ea07 Source: Fix possible IWYU warnings in Windows generators 2021-11-20 00:50:33 +09:00
Brad King
f97f8537f3 VS: Model a default target framework
Add fields to the VS generator to select a target framework.
Migrate the existing default for VS 12 .NET CF for Windows CE.

Report the values in `CMAKE_VS_*` variables and use them for
the CSharp compiler id project too.

Issue: #22849
2021-11-06 06:08:54 -04:00
Brad King
6999b87133 cmGlobalVisualStudio10Generator: Add method to find MSBuild early
Add a way to find MSBuild before the main `FindMakeProgram` code path
has executed.
2021-10-20 13:00:25 -04:00
Brad King
6511654164 cmGlobalVisualStudio10Generator: Allow subclasses to reset MSBuild search
While at it, convert to inline initialization.
2021-10-20 13:00:25 -04:00
Brad King
22dab6eb96 Deprecate Visual Studio 10 2010 generator
Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
2021-07-29 14:15:01 -04:00
Brad King
c46b265839 VS: Add Visual Studio 17 2022 generator
Fixes: #22339
2021-06-25 12:45:44 -04:00
Brad King
b0f830ced6 VS: Do not apply any '/external:*' flag table mapping on VS < 16.10
Since commit 887e9df0c7 (VS: Update v142 CL flag table for VS 16.10,
2021-06-04) we map several `/external:*` flags to their corresponding
`.vcxproj` elements.  These elements were added to `cl.xml` in VS 16.10,
so filter them out in older VS versions.  Add a field to the json flag
table format to specify the minimum version of VS needed for a given
mapping.

Issue: #22308
2021-06-17 08:25:04 -04:00
Brad King
3fd65f5ca6 VS: Compare VS instance versions as strings
This makes the values more readable.
2021-06-17 07:54:48 -04:00
Brad King
e4ca525d84 VS: Do not apply '/external:W*' flag table mapping on VS < 16.10
Since commit 9054cd05e6 (VS: Add flag table entries for '/external:W*'
flags in VS 16.10, 2021-05-28, v3.20.4~10^2) we map flags to the
`ExternalWarningLevel` element.  VS 16.9 does not support that element,
but its `cl` compiler does support the `/external:W*` flags.  Filter out
the flag table entry on older VS versions.

Fixes: #22308
2021-06-16 13:24:32 -04:00
Brad King
e66a7fe07b cmGlobalVisualStudio10Generator: Move static functions to anonymous namespace 2021-06-16 13:20:44 -04:00
Brad King
3db61cf985 VS: Fix VCTargetsPath detection when cross-compiling
Tell `MSBuild` to use the same `Platform` that we generate into the
`VCTargetsPath` detection project.

Fixes: #22068
2021-04-27 14:39:10 -04:00
Brad King
608ef8a6fc VS: Add a mostly-undocumented hook to load custom JSON flag tables
The names and formats of our VS flag tables are internal implementation
details.  However, some institutions need to maintain support for
non-public VS platforms and toolsets.  Provide a hook that their
projects can use to load custom flag table files.  This helps avoid
distributing a custom CMake package within such institutions.

Document the hook itself, but explicitly specify that the files the
hook loads are not considered a stable interface.
2021-03-22 13:28:27 -04:00
Marcel Ritzschke
c73b847b03 VS: switch to new folder structure while keeping the old one working
Fixes: #21170
2021-03-18 15:44:13 +01:00
Brad King
3d661c6c3a Merge topic 'vs-toolset-version'
30c835428f VS: Accept and translate '-T version=' values with three components
58a50a3a0a VS: Fix '-T version=14.28' under VS 16.9
09f59da7f0 cmGlobalVisualStudioVersionedGenerator: Clarify local variable name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5903
2021-03-15 08:50:13 -04:00
Brad King
58a50a3a0a VS: Fix '-T version=14.28' under VS 16.9
CMake accepts the toolset version that is default in the current VS
version by matching the name later VS versions will use for the SxS
props files.  It predicts the future name based on the first two
components of the current VS version's default toolset.  However, this
heuristic breaks naming the VS 16.8 toolset version 14.28 under VS 16.9
because the latter's default toolset version is 14.28.29910, which did
not increment the second version component (unprecedented in VS).

Fix this by always using the requested version's SxS props file when it
exists, even if it matches the first two components of the current VS
version's default toolset.  Also add a special case for the name VS
16.10 will use for VS 16.9's default toolset, so that it can be used
with VS 16.9 too.

Fixes: #21922
2021-03-12 08:36:40 -05:00
Brad King
09f59da7f0 cmGlobalVisualStudioVersionedGenerator: Clarify local variable name 2021-03-12 06:33:51 -05:00
Brad King
1b33150f7e cmGlobalVisualStudio10Generator: Generalize flag table lookup interface 2021-03-05 09:34:59 -05:00
Brad King
414b5e0119 cmGlobalVisualStudio10Generator: Clarify LoadFlagTable argument name 2021-03-05 09:34:59 -05:00
Brad King
cbba9f26a8 cmGlobalVisualStudio10Generator: Drop unnecessary temporaries 2021-03-05 09:34:59 -05:00
Brad King
d5522f096d cmGlobalVisualStudio10Generator: Drop default toolset name canonicalization
The default toolset names are always canonical.
2021-03-05 09:34:58 -05:00
Brad King
99f6f1b3b9 cmGlobalVisualStudio10Generator: Remove redundant arguments 2021-03-05 09:34:58 -05:00
Brad King
1b774e18fb cmGlobalVisualStudio10Generator: Remove redundant arguments 2021-03-05 09:34:58 -05:00
Brad King
a1c0758ea0 cmGlobalVisualStudio10Generator: Clarify method name 2021-03-05 09:34:58 -05:00
Brad King
e562e8987c cmGlobalVisualStudio10Generator: Remove unused flag table method argument 2021-03-05 09:34:58 -05:00
Brad King
fe17685722 cmGlobalVisualStudio10Generator: Adopt flag table name methods
Migrate them from `cmVisualStudio10ToolsetOptions`.
2021-03-05 09:34:58 -05:00
Kyle Edwards
5a36542086 Refactor: Add allowArch parameter to cmake::CreateGlobalGenerator() 2020-10-05 09:49:59 -04:00
Kyle Edwards
6051a49c78 Visual Studio: Add Android support 2020-06-24 08:41:09 -04:00
Kyle Edwards
14456923bd cmGlobalVisualStudio10Generator: Move variable initialization to header 2020-06-18 15:35:26 -04:00
Marc Chevrier
2faa3f6c55 Refactoring: Third-parties public headers are under cm3p prefix
Fixes: #20666
2020-05-07 12:06:08 +02:00
Rolf Eike Beer
48adc29721 replace "std::string::find(x) == 0" with cmHasPrefix() 2020-03-23 22:41:43 +01:00
Brad King
4b062c77b3 Merge topic 'vs-version-for-unity'
9135954e2f VS: Do not use native unity builds on VS 2017 versions less than 15.8

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4324
2020-02-05 08:33:50 -05:00
Brad King
9135954e2f VS: Do not use native unity builds on VS 2017 versions less than 15.8
VS 2017 version 15.8 introduced support for unity builds implemented
in part by the `$(VCTargetsPath)/Microsoft.Cpp.Unity.targets` file.
Do not enable unity builds on VS 15 versions that do not have that file.

Fixes: #20284
2020-02-04 11:46:18 -05:00
Vitaly Stakhovsky
bbc07e4561 Source: use std::string in place of const char* 2020-01-29 14:31:01 -05:00