1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-07-23 00:01:11 +08:00

675 Commits

Author SHA1 Message Date
Brad King
1dda570edc Merge topic 'vs-fix-csharp-recompile'
91754b4e60 VS: When not referencing output assembly do not try to copy it either

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2037
2018-05-11 09:20:49 -04:00
Brad King
a170a59a58 VS: Link CUDA binaries with the device runtime library 'cudadevrt'
According to https://docs.nvidia.com/cuda/nvrtc/index.html there are
some cases where a CUDA binary "...must be linked against the CUDA
device runtime (cudadevrt) library".  When `nvcc` drives linking it
automatically links to runtime libraries as follows:

* -cudart=none: None
* -cudart=shared: -lcudadevrt -lcudart
* -cudart=static: -lcudadevrt -lcudart_static

The `cudadevrt` library is the cuda device runtime library.  It is
always static so passing it to the linker when not necessary does
not hurt anything.

With Ninja and Makefile generators, we detect `cudadevrt` and either
`cudart` or `cudart_static` libraries implied by `nvcc` and then add
them to link lines driven by a host compiler.  However, this does not
work with the VS generator because the CUDA Toolkit Visual Studio
integration does not use `nvcc` to link binaries and instead uses
`link.exe` directly.

Visual Studio project files (`.vcxproj`) for CUDA are expected to
explicitly list the needed runtime libraries.  Our VS generator already
adds `cudart.lib` or `cudart_static.lib` based on the `-cudart=` flag.
Update it to also add `cudadevrt.lib` as nvcc does.

Fixes: #17988
2018-05-11 08:49:10 -04:00
Andreas Schönle
91754b4e60 VS: When not referencing output assembly do not try to copy it either
When generating a `ProjectReference` with `ReferenceOutputAssembly` set
to `false`, also set `CopyToOutputDirectory` to `Never`.  Otherwise
MSBuild might report a diagnostic like

    Project '<name>' is not up to date.
    CopyLocal reference '...\ZERO_CHECK' is missing from output location.

and rebuild the referencing project unnecessarily.
2018-05-09 08:17:42 -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
d3292d2d10 Merge topic 'vs-refactor-xml'
0bd1d1fcc4 VS: Fix regression in XML generation for CUDA

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2053
2018-05-09 07:44:28 -04:00
Brad King
0bd1d1fcc4 VS: Fix regression in XML generation for CUDA
Refactoring in commit 3f315dc128 (cmVisualStudio10TargetGenerator: XML
refactoring, 2018-05-02) accidentally left the `<Import>` element for
the CUDA build customizations unclosed.
2018-05-08 10:29:22 -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
Brad King
42d198744b Merge topic 'deprecate_static_managed_targets'
b7c2b2cd78 cmVisualStudio10TargetGenerator: add handling of static C# targets
d244f2cad3 cmVisualStudio10TargetGenerator: add handling of manual /clr setting
1e5a8f882f cmVisualStudio10TargetGenerator: fix checking for managed target
8d7ffed048 cmVisualStudio10TargetGenerator: issue warning when adding static C# lib
73ee599a82 cmGeneratorTarget: make GetManagedType() return 'Native' for static targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2014
2018-05-08 08:36:20 -04:00
Michael Stürmer
b7c2b2cd78 cmVisualStudio10TargetGenerator: add handling of static C# targets 2018-05-07 07:21:12 +02:00
Michael Stürmer
d244f2cad3 cmVisualStudio10TargetGenerator: add handling of manual /clr setting 2018-05-07 07:21:10 +02:00
Michael Stürmer
1e5a8f882f cmVisualStudio10TargetGenerator: fix checking for managed target 2018-05-07 07:21:08 +02:00
Michael Stürmer
8d7ffed048 cmVisualStudio10TargetGenerator: issue warning when adding static C# lib 2018-05-07 07:20:46 +02: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
Brad King
36d7f8ca10 Merge topic 'vs-shader-generator-expressions'
83ed65cdde Add generator expressions for VS_SHADER_ source file properties.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2000
2018-04-30 09:18:02 -04:00
Brad King
0036966c0b Merge topic 'vs-refactor-xml'
4465a27882 cmVisualStudio10TargetGenerator: XML refactoring

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2012
2018-04-27 08:24:51 -04:00
Brad King
ea8189ee55 Merge topic 'vs-managed-fastlink'
27b28c001f VS: Don't turn on /DEBUG:FASTLINK for managed C++ targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2011
2018-04-27 08:24:06 -04:00
Jeremiah van Oosten
83ed65cdde Add generator expressions for VS_SHADER_ source file properties. 2018-04-26 23:00:10 +02:00
Vitaly Stakhovsky
4465a27882 cmVisualStudio10TargetGenerator: XML refactoring 2018-04-26 13:45:29 -04:00
Calum Robinson
27b28c001f VS: Don't turn on /DEBUG:FASTLINK for managed C++ targets
FastLink is only supported for native C++ targets. Turning it off avoids
a warning when building managed C++.
2018-04-26 15:36:59 +01: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
7d407b438d cmVisualStudioGeneratorOptions: specify indentation with integer 2018-04-25 11:01:37 -04:00
Brad King
5a6c629289 Merge topic 'vs-dedup-custom-commands'
f59c33a763 VS: Generate a custom command only in the least dependent target
d58d4daa6b cmVisualStudio10TargetGenerator: Use cmLocalVisualStudio10Generator

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1889
2018-04-25 08:56:16 -04:00
Vitaly Stakhovsky
1f29777798 cmVisualStudio10TargetGenerator: refactoring (continued) 2018-04-24 12:01:19 -04:00
Jeremiah van Oosten
8d1ccbc693 VS: Add VS_SHADER_OBJECT_FILE_NAME source file property 2018-04-24 11:29:16 -04:00
Michael Stürmer
de549083e3 cmVisualStudio10TargetGenerator: warn if /clr flag is set manually 2018-04-24 07:05:19 +02:00
Michael Stürmer
59ec7d50bd cmVisualStudio10TargetGenerator: fix for backward compatibility 2018-04-24 07:05:18 +02:00
Michael Stürmer
663f5120f4 cmGlobalVisualStudioGenerator: remove TargetCanBeReferenced() 2018-04-24 07:05:17 +02: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
Michael Stürmer
f3c6828876 cmVisualStudio10TargetGenerator: /clr compatible flags for managed tgt 2018-04-23 07:31:22 +02:00
Michael Stürmer
f9042d807d remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget 2018-04-23 07:31:21 +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
Brad King
fe0082875a Merge topic 'vs-sdk-dirs'
6ec3e880e7 VS: Add variables to set SDK directories in vcxproj files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1965
2018-04-20 07:52:02 -04:00
Bastien Schatt
6ec3e880e7 VS: Add variables to set SDK directories in vcxproj files
Create `CMAKE_VS_SDK_*_DIRECTORIES` variables to tell the VS generator
how to populate fields in `.vcxproj` files that specify SDK directories.

Fixes: #17908
2018-04-19 09:39:34 -04:00
Brad King
d41e767f2b Merge topic 'vs-conditional-reference-assembly'
c8e98974d8 VS: Disallow ReferenceOutputAssembly in ProjectReference if not possible

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1956
2018-04-17 07:32:11 -04: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
5099af044f Merge topic 'vs-cuda-pdb'
134e795fa9 VS: Add workaround for CUDA compiler PDB location

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1960
2018-04-16 09:14:05 -04:00
Bastien Schatt
c8e98974d8 VS: Disallow ReferenceOutputAssembly in ProjectReference if not possible
Explicitly turn off `ReferenceOutputAssembly` in `ProjectReference`
elements naming other project files whose types do not produce
assemblies.  We already do this for `C#` but it makes sense for other
languages too.

Fixes: #17906
2018-04-13 13:11:09 -04:00
Brad King
134e795fa9 VS: Add workaround for CUDA compiler PDB location
The CUDA Toolkit Visual Studio Integration does not honor the
`ClCompile.ProgramDataBaseFileName` field when telling `nvcc` how to
invoke `cl`.  Work around this problem by passing `-Xcompiler=-Fd...`
ourselves through `AdditionalOptions`.

Fixes: #17647
2018-04-13 12:56:36 -04:00
Brad King
0a122393d7 Merge branch 'backport-fix-explicit-CMakeLists.txt' 2018-04-13 09:46:54 -04:00
Brad King
8480c2afc0 Restore support for explicitly referenced CMakeLists.txt sources
Since commit v3.11.0-rc1~467^2 (VS,Xcode: Add CMakeLists.txt sources
without mutating targets, 2017-10-18) we do not add `CMakeLists.txt` to
target sources but instead generate references to them directly.  This
broke projects that explicitly specify their `CMakeLists.txt` file as a
source file because the explicit entry is no longer consolidated with
the generated one.

Teach the relevant generators to avoid duplicating `CMakeLists.txt`
source references and add test cases.

Fixes: #17828
2018-04-13 09:41:06 -04:00
Brad King
498be66fd7 Merge topic 'add_support_for_clr_targets'
312527de47 document COMMON_LANGUAGE_RUNTIME target properties
4b7a82b4ed cmVisualStudio10TargetGenerator: set /clr compiler flag from property
20e31fb4c9 cmExportFileGenerator: add target property for managed targets
411a22706a cmGeneratorTarget: add handling of managed assemblies to HasImportLibrary()
fb433ff283 cmGeneratorTarget: Make import library checks config-aware
4c1f33961f cmGeneratorTarget: add GetManagedType() and CheckManagedType() methods
6c517a9f8d cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1916
2018-04-12 11:36:28 -04:00
Brad King
aa5bedc52b Merge topic 'attr-escape'
ff18dce5ed cmVisualStudio10TargetGenerator: Properly escape attributes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1937
2018-04-12 11:29:24 -04: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
Vitaly Stakhovsky
ff18dce5ed cmVisualStudio10TargetGenerator: Properly escape attributes
In addition to common XML escape characters, attributes require escaping
the double quote character. A new function, cmVS10EscapeAttr is added and
used where appropriate.
2018-04-05 21:20:16 -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