Commit Graph

138 Commits

Author SHA1 Message Date
Brad King
526e2ef71c VS: Add support for add_custom_command DEPFILE
Transform the depfile into MSBuild `AdditionalInputs` content.  Add
MSBuild Targets to update `AdditionalInputs` and the `.tlog` files for
future builds without actually modifying the `.vcxproj` file.

Fixes: #20286
2021-06-09 10:09:58 -04:00
Kitware Robot
bdca8b01d2 Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
2020-09-03 09:30:21 -04:00
Kyle Edwards
6051a49c78 Visual Studio: Add Android support 2020-06-24 08:41:09 -04:00
Brad King
65fe58a4b4 cmVisualStudio10TargetGenerator: Adopt Windows Store and Phone infrastructure
Move support for Resx, Xaml, Certificate, and AppManifest file handling
out of cmGeneratorTarget.
2020-05-18 12:56:56 -04:00
Brad King
156196938c Merge topic 'cmprop-source'
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp
fc223f9860 cmGlobalXCodeGenerator: Fix genex interpreter overloads

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4603
2020-04-15 09:49:46 -04:00
Vitaly Stakhovsky
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp 2020-04-14 10:57:17 -04:00
Justin Goshi
bc877a7e94 Add support to indicate UTF-8 custom command pipe output encoding
Adds a flag to indicate that pipe output from a custom command should be
interpreted as UTF-8 encoded. This change does not introduce a public
way to set the flag, but generators that create internally-generated
commands know if they are calling cmake, which uses UTF-8 pipes.

MSBuild added support for interpreting output of PreBuildEvent,
PreLinkEvent, PostBuildEvent, and CustomBuildStep as UTF-8. This change
will appear in Visual Studio 16.6 Preview 3. It is opt-in, and you need
to add the StdOutEncoding tag. MSBuild treats these as property bags so
if we emit the tag for earlier versions of Visual Studio it would be
safely ignored. This change emits the StdOutEncoding tag and sets it to
UTF-8 whenever the custom command UTF-8 pipe flag is set. This fixes
globalization issues when the output from cmake contained characters
that required MSBuild to interpret as UTF-8 before displaying them.
2020-04-13 12:54:47 -07:00
Brad King
ad22d0c1d0 Merge topic 'vs-non-built-file-item-metadata'
0723e04f7a VS: Add documentation for VS_SETTINGS and VS_SOURCE_SETTINGS_<tool>.
2ca1102f83 VS: Test VS_SETTINGS and VS_SOURCE_SETTINGS_<tool> properties.
f00e1b816d VS: Add VS_SOURCE_SETTINGS_<tool> target property
2ce42f281f VS: Add VS_SETTINGS source file property
53116d3942 VS: Use unordered_map to write HLSL settings.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4498
2020-03-30 13:28:19 -04:00
Rolf Eike Beer
94de927cab VS10Generator: avoid many string allocations 2020-03-24 17:50:42 +01:00
Matt Davies
f00e1b816d VS: Add VS_SOURCE_SETTINGS_<tool> target property
VS_SOURCE_SETTINGS_<tool> is a list of key value pairs that get written as item
metadata for any file associated with <tool> for that target. The entire value
of VS_SOURCE_SETTINGS_<tool> is evaluated as a generator expression. VS_SETTINGS
can override settings specified in this property.
2020-03-20 16:16:58 +00:00
Matt Davies
2ce42f281f VS: Add VS_SETTINGS source file property
VS_SETTINGS is a list of key value pairs that get written as item
metadata for the associated non-built file. The entire value of
VS_SETTINGS is evaluated as a generator expression.
2020-03-20 16:16:58 +00:00
Matt Davies
53116d3942 VS: Use unordered_map to write HLSL settings. 2020-03-20 16:16:44 +00:00
Kinan Mahdi
ac6b18cd90 CSharp: Add support for source groups with out-of-source builds
This also fixes support for multiple sources of the same name in
different directories.  Add a test for both problems.

Issue: #19505
2020-02-28 11:42:01 -05:00
Vitaly Stakhovsky
64843b1737 cmVisualStudio10TargetGenerator: use std::string for tag 2019-11-10 09:29:27 -05:00
Charly Mourglia
89ff3ee779 VS: Add VS_DOTNET_DOCUMENTATION_FILE property
Add a `VS_DOTNET_DOCUMENTATION_FILE` target property to tell VS
generators to add a `DocumentationFile` setting in `.csproj` files.

Fixes: #19784
2019-10-15 11:44:55 -04:00
Brad King
76ae4c5839 Merge topic 'vs-16.4-custom-commands'
0578239d3a VS: Tell VS 16.4 not to verify SYMBOLIC custom command outputs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3860
2019-09-25 12:39:14 -04:00
Brad King
0578239d3a VS: Tell VS 16.4 not to verify SYMBOLIC custom command outputs
VS 16.4 introduces an additional check on `CustomBuild` rules that warns
if the outputs of the command are not created.  However, CMake supports
marking outputs with the `SYMBOLIC` property to indicate that they will
not actually be generated.  That property is used by Makefile and Ninja
generators but has not been needed by the VS generators before.  Teach
the VS generator to disable `VerifyInputsAndOutputsExist` in custom
build rules that have a symbolic output.

Fixes: #19737
2019-09-24 10:41:20 -04:00
Regina Pfeifer
a1ddf2d0ba clang-tidy: Replace typedef with using
Automate the conversion with

  perl -i -0pe 's/typedef ([^;]*) ([^ ]+);/using $2 = $1;/g'

then manually fix a few places.
2019-09-04 18:03:01 +02:00
Brad King
f9b7c660d7 VS: Fix mapping of -Qspectre- flag
The mapping for this flag was added by commit 43aa632f57 (VS: Populate
`-Qspectre-` flag table entry for v142, 2019-01-24, v3.14.0-rc1~74^2~7).
However, it did not do anything because the special logic added by
commit bb60ed6e72 (VS: Add flag table entry for -Qspectre, 2018-10-08,
v3.13.0-rc1~4^2) to move the `SpectreMitigation` element from
`ClCompile` to the top level only handled the presence of the setting
and not its value.  Extend the special logic to carry the value too.

Fixes: #19535
2019-07-30 11:17:28 -04:00
Brad King
187928875d Merge topic 'vs-add-package-reference'
42e14d90b1 VS: Added support for VS package references for nuget

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Leonid Pospelov <pospelovlm@yandex.ru>
Merge-request: !3389
2019-05-31 13:18:31 -04:00
Brad King
82fec3784b Merge topic 'vs-depends-dedup'
42bc67bd43 VS: De-duplicate custom command dependencies
d03a6fc857 VS: Clarify name of custom commands AdditionalInputs variable
fcedf8e552 VS: Isolate custom command input/output generation scopes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3388
2019-05-31 09:04:47 -04:00
Frans van Dorsselaer
d03a6fc857 VS: Clarify name of custom commands AdditionalInputs variable 2019-05-30 13:57:03 -04:00
Kinan Mahdi
42e14d90b1 VS: Added support for VS package references for nuget 2019-05-30 10:22:44 -04:00
Brad King
2d37678226 Merge topic 'vs-project-import'
d145d72e70 VS: add target property VS_PROJECT_IMPORT_<propspath>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3143
2019-04-16 13:43:52 -04:00
Leonid Pospelov
d145d72e70 VS: add target property VS_PROJECT_IMPORT_<propspath>
Fixes: #18998
2019-04-15 13:05:07 -04:00
Leonid Pospelov
2418a5aec0 cmVisualStudio10TargetGenerator: Remove uses of const_cast 2019-04-12 18:20:07 +03:00
Regina Pfeifer
b05b778a2d clang-tidy: Use = delete 2019-01-29 14:09:21 -05:00
Wil Stark
5e4887e673 VS: Honor WinCE deployment properties in VS 2010+
Previously only VS 2008 was supported.
2019-01-10 13:06:25 -05:00
Vitaly Stakhovsky
1601388212 cmVisualStudio10TargetGenerator: Code improvement
Disallow incompletely initialized Elem objects
2018-10-14 18:32:53 -04:00
Brad King
bb60ed6e72 VS: Add flag table entry for -Qspectre
Add special logic to map this flag to a top-level build setting
instead of being in ClCompile.

Fixes: #18426
2018-10-08 14:03:39 -04:00
Niels Dekker
567fabe88e IPO: INTERPROCEDURAL_OPTIMIZATION (LTCG) for Visual Studio
Add IPO support for Visual Studio (which is referred to by VS as
"Link Time Code Generation" and "Whole Program Optimization"), for
VS version >= 10.  This allows CMake/VS users to enable IPO by setting
property `INTERPROCEDURAL_OPTIMIZATION`.

Fixes: #16748
2018-09-17 10:53:10 -04:00
Vitaly Stakhovsky
790fc415b1 cmVisualStudio10TargetGenerator: remove BuildFileStream member
Stream object is now local to `Generate()`
2018-05-16 12:59:00 -04:00
Vitaly Stakhovsky
b88e138369 cmVisualStudio10TargetGenerator: minor code cleanup 2018-05-11 10:05:51 -04:00
Vitaly Stakhovsky
a2b5acec3b cmVisualStudio10TargetGenerator: refactor
`WritePlatformConfigTag` moved to local `Elem` class; other improvements
2018-05-09 08:04:34 -04:00
Brad King
f60e2eb3c5 Merge topic 'vs-improve-options'
e76a0c6071 VS: improve options generation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2044
2018-05-08 08:36:57 -04:00
Vitaly Stakhovsky
e76a0c6071 VS: improve options generation
Make use of the `Elem` and `OptionsHelper` classes; some cleanup
2018-05-05 17:35:37 -04:00
Mark Ingram
5cc195f1f4 VS Generator: Only include default certificate if it was actually copied 2018-05-04 18:10:10 +01:00
Vitaly Stakhovsky
3f315dc128 cmVisualStudio10TargetGenerator: XML refactoring 2018-05-04 10:46:11 -04:00
Vitaly Stakhovsky
4465a27882 cmVisualStudio10TargetGenerator: XML refactoring 2018-04-26 13:45:29 -04:00
Brad King
e52cf1034f Merge topic 'csharp_reference_imported_targets'
de549083e3 cmVisualStudio10TargetGenerator: warn if /clr flag is set manually
59ec7d50bd cmVisualStudio10TargetGenerator: fix for backward compatibility
663f5120f4 cmGlobalVisualStudioGenerator: remove TargetCanBeReferenced()
359544a907 add tests for using target_link_libraries() with imported managed targets
43571073e0 cmVisualStudio10TargetGenerator: store managed reference information in maps
16fec7e2fc cmVisualStudio10TargetGenerator: make some methods config aware
f3c6828876 cmVisualStudio10TargetGenerator: /clr compatible flags for managed tgt
f9042d807d remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1805
2018-04-26 08:55:19 -04:00
Brad King
5858267df6 Merge topic 'vs-refactor-xml'
dfff12c808 VS: Add Elem::Content() helper and usage demo
1f29777798 cmVisualStudio10TargetGenerator: refactoring (continued)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2005
2018-04-26 08:36:44 -04:00
Vitaly Stakhovsky
dfff12c808 VS: Add Elem::Content() helper and usage demo 2018-04-26 08:35:43 -04:00
Vitaly Stakhovsky
1f29777798 cmVisualStudio10TargetGenerator: refactoring (continued) 2018-04-24 12:01:19 -04:00
Michael Stürmer
43571073e0 cmVisualStudio10TargetGenerator: store managed reference information in maps 2018-04-24 07:05:14 +02:00
Michael Stürmer
16fec7e2fc cmVisualStudio10TargetGenerator: make some methods config aware 2018-04-23 07:31:23 +02:00
Fujii Hironori
f59c33a763 VS: Generate a custom command only in the least dependent target
If a custom command is assigned to multiple targets, generate the build
rule only in the least-dependent `.vcxproj` file.  Otherwise MSBuild
will run the command on the first build of a dependent target even if
its dependencies already brought the command up to date (in order to
populates its build log).

Generate targets in least-to-most-dependent order, and assign a custom
command to the least dependent target.

Added cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst to call
cmVisualStudio10TargetGenerator::Generate in least-dependent order.

Moved SourcesVisited from cmVisualStudio10TargetGenerator to
cmLocalVisualStudio10Generator to avoid attaching a custom command to
multiple targets among the local generator.

Fixes: #16767
2018-04-23 13:31:28 +09:00
Fujii Hironori
d58d4daa6b cmVisualStudio10TargetGenerator: Use cmLocalVisualStudio10Generator
Change the type of a member variable `LocalGenerator` from
`cmLocalVisualStudio7Generator` to `cmLocalVisualStudio10Generator`.
2018-04-17 11:03:17 +09:00
Brad King
607b0ac2f3 Merge topic 'minor-cleanups'
acda926a04 Replace some uses of sprintf with std::to_string
418541035f cmCTestCurl: Fix UploadFile declared parameter names
1519628e60 cmVisualStudio10TargetGenerator: Make NsightTegraVersion unsigned
2f87d00803 cmMacroCommand: Fix format string to match type of argument
b0676cc5d4 Add in-class initialization of some members
966dba5b68 cmAlgorithms: Remove unnecessary typename keyword
12a145534a gitignore: Ignore a .vs directory in the source tree

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1932
2018-04-06 10:29:38 -04:00
jrp2014
1519628e60 cmVisualStudio10TargetGenerator: Make NsightTegraVersion unsigned
It's used in unsigned contexts, such as with format strings.
2018-04-05 13:42:49 -04:00
Vitaly Stakhovsky
30bbb4f2ac cmVisualStudio10TargetGenerator: extend DOM-like generation
The local Elem class is extended with more XML-generating functions.
WriteGroups() is rewritten to use these new functions,
avoiding BuildFileStream.
2018-03-30 22:55:30 -04:00