1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-19 11:31:30 +08:00

644 Commits

Author SHA1 Message Date
Brad King
bbc1f3642c VS: Fix support for nvcc flags not in our flag table
The change in commit v3.9.0-rc4~3^2 (VS: Improve workaround for CUDA
-Xcompiler placement bug, 2017-06-21) accidentally appended to the
`AdditionalOptions` as if it were a `;`-separated list, but it is
actually a command-line string.  Append with a space instead.

While at it, fix the same problem for the `AdditionalOptions` added to
`CudaLink` by commit v3.9.0-rc3~1^2 (CUDA: When linking device code
suppress CUDA 8.0+ deprecation warnings, 2017-06-09).

Fixes: #17008
2017-06-27 09:08:50 -04:00
Michael Stürmer
ec409a116f Vs: fix CSharp custom command by introducing inline MSBuild <Targets>s
The custom command implementation is based on the Microsoft support article:

https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-extend-the-visual-studio-build-process

Fixes: #16960
2017-06-22 21:40:48 +02:00
Michael Stürmer
dcdab5cf23 Vs: factor out computation of <Link> tag for CSharp source files 2017-06-22 21:39:37 +02:00
Michael Stürmer
0a8f469af9 Vs: refactor WriteCustomRule for preparation of CSharp support 2017-06-22 16:52:37 +02:00
Michael Stürmer
54d42ce728 Vs: disable unnecessary <ItemDefinitionGroups> for CSharp targets 2017-06-22 16:51:44 +02:00
Michael Stürmer
d5f7bf9b2e Vs: change comparison to use .ProjectType member always as first comparator 2017-06-22 16:49:24 +02:00
Brad King
396b618c52 Merge topic 'vs-cuda-fix-flags'
3b754215 VS: Improve workaround for CUDA -Xcompiler placement bug
f2059585 VS: Fix target_compile_options for CUDA

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !996
2017-06-22 10:04:37 -04:00
Brad King
9f3bf3cb9d Merge topic 'vs_csharp_link_to_managed_cxx'
51865fc6 Vs: allow CSharp targets to be linked to CXX targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !993
2017-06-22 09:58:28 -04:00
Brad King
3d99244477 Merge branch 'vs-cuda-fix-flags' into release-3.9 2017-06-21 14:24:23 -04:00
Brad King
3b75421515 VS: Improve workaround for CUDA -Xcompiler placement bug
In commit v3.9.0-rc1~431^2~6 (VS: Place CUDA host compiler options in
proper project file fields, 2017-03-07) we worked around a bug in the
CUDA VS integration by dropping `AdditionalCompilerOptions`.  However,
this silently drops `-Xcompiler=` options given by the user that don't
map to one of CudaCompile's dedicated settings.  Improve the workaround
to instead put the remaining `AdditionalCompilerOptions` into the
`AdditionalOptions` field behind `-Xcompiler=` ourselves.
2017-06-21 14:24:11 -04:00
Brad King
f2059585e6 VS: Fix target_compile_options for CUDA
Fix the VS generator to honor `COMPILE_OPTIONS` for CUDA.  The exclusion
added by commit v3.9.0-rc1~431^2~7 (VS: Do not pass CUDA compile options
to C compiler, 2017-03-07) was correct but we need additional logic to
pass the CUDA compile options to the CUDA compiler.  Also we should
still pass the CXX or C options to MSVC (ClCompile) when those languages
are enabled even if the link language is CUDA.
2017-06-21 14:23:46 -04:00
Michael Stürmer
51865fc67e Vs: allow CSharp targets to be linked to CXX targets
Fixes: #16755
2017-06-21 08:37:15 +02:00
Michael Stürmer
ec7b3af7e7 Vs: remove /nowin32manifest from C# flags to enable default VS behavior
if /nowin32manifest is specified, it will be preferred over any occurring
/win32manifest:<file> parameter

Fixes: #16969, #16970
2017-06-16 09:33:06 +02:00
Brad King
f3ffd18ab6 Merge topic 'vs_csharp_prop_for_all_extensions'
c90630c5 Vs: add support for VS_CSHARP_* target property for additional file extensions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !961
2017-06-15 10:22:12 -04:00
Brad King
d3b981ab3e Merge topic 'ipo-per-lang'
ba247cca IPO: Consider support for each language separately

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !964
2017-06-15 10:05:02 -04:00
Brad King
61c1848cdc Merge branch 'ipo-per-lang' into release-3.9 2017-06-14 15:10:39 -04:00
Brad King
c8b4da5838 Merge topic 'vs-dotnet-custom-reference-tags'
07ec212a VS: add target property VS_DOTNET_REFERENCEPROP_<refname>_TAG_<tagname>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !960
2017-06-14 12:43:34 -04:00
Brad King
ba247ccaba IPO: Consider support for each language separately
We only define `INTERPROCEDURAL_OPTIMIZATION` behavior for C, CXX, and
Fortran languages.  Do not try to enable support for other languages.
Furthermore, each language builds with a different compiler, so check
for support by CMake and the compiler for each language independently.

Fixes: #16944
2017-06-14 10:36:57 -04:00
Michael Stürmer
07ec212ae8 VS: add target property VS_DOTNET_REFERENCEPROP_<refname>_TAG_<tagname>
Fixes: #16689
2017-06-13 10:46:31 -04:00
Michael Stürmer
c90630c501 Vs: add support for VS_CSHARP_* target property for additional file extensions
Fixes: #16726
2017-06-13 16:04:22 +02:00
Robert Maynard
7368ade250 CUDA: When linking device code suppress CUDA 8.0+ deprecation warnings
The CUDA compiler automatic deprecation warnings are pure noise when
doing device linking, and should be suppressed to reduce the amount of
confusion from users.
2017-06-13 09:15:19 -04:00
Brad King
b398e716f9 cmVisualStudio10TargetGenerator: Remove shadowing local variable 2017-05-30 13:27:31 -04:00
Brad King
30675ec49b VS: Fix indentation of .vcxproj files
Patch-by: vvs31415 on gitlab.kitware.com
2017-05-24 11:07:53 -04:00
Brad King
b520b18c73 VS: Write UseOfMfc tag only if CMAKE_MFC_FLAG is present
Don't bother writing `UseOfMfc` to `.vcxproj` files when the value is
just the default of `0`.  This keeps the files cleaner.

Patch-by: vvs31415 on gitlab.kitware.com
2017-05-22 13:17:47 -04:00
Brad King
776929b3c4 VS: Fix .vcxproj ProjectGuid element case
The `.vcxproj` file format expects `ProjectGuid`, not `ProjectGUID`.
The latter is expected by `.vcproj` files from VS 2008, so this was
likely a typo when the VS 2010 generator was first introduced.

Fixes: #11968
2017-05-09 10:12:12 -04:00
Peter Ivanyi
ea6bb8293f VS: Use tool-specific flag table for COMPILE_FLAGS parsing
Fixes: #14710
2017-05-03 12:48:53 -04:00
Robert Maynard
493671a521 CUDA: Static libraries can now explicitly resolve device symbols
If a static library has the property CUDA_RESOLVE_DEVICE_SYMBOLS enabled
it will now perform the device link step. The normal behavior is
to delay calling device link until the static library is consumed by
a shared library or an executable.
2017-04-26 16:18:25 -04:00
Robert Maynard
a36fb229ba CUDA: Visual Studio now properly delays device linking 2017-04-26 11:41:22 -04:00
Brad King
1d8f0f9181 Merge topic 'enable_ptx_compilation'
23691d78 CUDA: Allow sources to be compiled to .ptx files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !725
2017-04-21 08:57:59 -04:00
Brad King
59f07efd59 Merge topic 'fix-vs2017-guid-braces'
fd7e8f33 VS: Fix project reference inspection in VS IDE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !727
2017-04-21 08:54:38 -04:00
Robert Maynard
23691d789e CUDA: Allow sources to be compiled to .ptx files
When the target property `CUDA_PTX_COMPILATION` is enabled CUDA OBJECT
libraries will generate ptx files instead of object files.
2017-04-20 13:25:38 -04:00
Richard Walters
fd7e8f339a VS: Fix project reference inspection in VS IDE
The braces around project reference GUIDs for vcxproj projects were
apparently optional in the past, but Visual Studio 2017 is more strict,
displaying a warning, and not displaying project reference properties
unless the braces are present.

Fixes: #16820
2017-04-20 10:30:21 -04:00
Gregor Jasny
cf320f7cd7 Replace boolean implib parameters with enum
Named enumeration values are much clearer at call sites and add more
type safety.
2017-04-20 10:22:33 -04:00
Brad King
3ab4681efa cmGeneratorTarget: Drop default GetLinkerLanguage config argument
Update one remaining call site to avoid using the default.
2017-04-17 10:54:00 -04:00
Brad King
97cc29c766 VS: Teach generators how to mark per-config source files
Add internal infrastructure for looping over all sources for all
configurations and generating each source with exclusion marks
for configurations in which they do not participate.  This does
not yet make per-config sources available in general but does
set up some of the needed infrastructure.

Unfortunately doing this cleanly will require major refactoring of both
the VS 7-9 generators and the VS 10+ generators (for separate reasons).
Instead add some extra internal structures to carry information where we
need it.
2017-04-13 16:10:32 -04:00
Brad King
8456ec833a Merge topic 'include-style'
1d829c86 Use quotes for non-system includes
26ee9e42 CPack: drop CPack prefix for includes
5afac50f cmConfigure: Ensure separate include block in headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !691
2017-04-13 08:12:40 -04:00
Daniel Pfeifer
1d829c862c Use quotes for non-system includes
Automate with:

git grep -l '#include <cm_' -- Source \
  | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g'

git grep -l '#include <cmsys/' -- Source \
  | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g'

git grep -l '#include <cm[A-Z]' -- Source \
  | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
2017-04-11 22:35:21 +02:00
Brad King
a77158b25f VS: Refactor loop over classified sources
Loop over all sources at once instead of looking up and looping
over each kind of source separately.
2017-04-11 13:36:31 -04:00
Brad King
f4af14add4 VS: Simplify logic collecting object library files as sources
Object library files are already included by `GetExternalObjects`
and `GetConfigCommonSourceFiles` so we don't need to call
`UseObjectLibraries` to get them.
2017-04-11 10:10:28 -04:00
Brad King
8772fc81c4 Merge topic 'ipo-policy-CMP0069'
dfa8263f Implement interprocedural optimization for GNU compilers
1588a577 Add policy CMP0069 to enforce INTERPROCEDURAL_OPTIMIZATION
a7575700 Refactoring: s,GetFeatureAsBool,IsIPOEnabled,
e05835c3 CheckIPOSupported: Visual Studio and Xcode generators do not support IPO

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Brad King <brad.king@kitware.com>
Reviewed-by: Nils Gladitz <nilsgladitz@gmail.com>
Merge-request: !568
2017-03-31 10:38:08 -04:00
Ruslan Baratov
1588a577d1 Add policy CMP0069 to enforce INTERPROCEDURAL_OPTIMIZATION
Previously the `INTERPROCEDURAL_OPTIMIZATION` target property was
honored only for the Intel compiler on Linux and otherwise ignored.  In
order to add support for more compilers incrementally without changing
behavior in the future, add a new policy whose NEW behavior enforces the
`INTERPROCEDURAL_OPTIMIZATION` property.  Add flags for supported
compilers and otherwise produce an error.
2017-03-30 14:56:46 -04:00
Brad King
6dc7262bf7 Merge topic 'vs-rc-defines'
fff34934 MSVC: Restore _DEBUG preprocessor definition in RC debug builds
79a91538 RC: Add missing CMAKE_RC_FLAGS_<CONFIG> entries to cache
c77194ec VS: Honor preprocessor definitions in RC flags
1449f6f6 cmVisualStudio10TargetGenerator: De-duplicate preprocessor defs
8a619e8c cmIDEOptions: Add GetDefines method

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !640
2017-03-29 09:14:54 -04:00
Brad King
c77194ec47 VS: Honor preprocessor definitions in RC flags
The VS generators use the C (or CXX) preprocessor definitions for
the Windows Resource Compiler tool.  This causes definitions parsed
out of `CMAKE_RC_FLAGS[_<CONFIG>]` variables to be dropped.  Fix
the implementation to preserve both.

Issue: #16745
2017-03-28 13:10:55 -04:00
Brad King
989484d51f Merge topic 'module-def-and-WINDOWS_EXPORT_ALL_SYMBOLS'
075f6454 Support WINDOWS_EXPORT_ALL_SYMBOLS with `.def` files
21c4ec4f cmGlobalVisualStudioGenerator: Simplify __create_def command generation
24361a45 bindexplib: Add support for parsing and integrating `.def` files
845c4824 bindexplib: Add method for parsing and integrating `.def` files
4f90e793 bindexplib: Revise coding style of CMake-specific methods

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !581
2017-03-22 08:49:09 -04:00
Brad King
075f645409 Support WINDOWS_EXPORT_ALL_SYMBOLS with .def files
The `WINDOWS_EXPORT_ALL_SYMBOLS` target property exports all symbols
found in object files explicitly given to the linker.  However, the
linker may also find additional symbols in dependencies and copy them
into the linked binary (e.g. from `msvcrt.lib`).  Provide a way to
export an explicit list of such symbols by adding a `.def` file as a
source file.

Fixes: #16473
2017-03-21 10:02:34 -04:00
Brad King
b46fa35824 Merge topic 'cuda-vs'
65481a60 CUDA: Work around VS limitation in CudaOnly.WithDefs test
8cae24a1 VS: Add more CUDA flag table entries
6ca4f222 VS: Add support for the CUDA_SEPARABLE_COMPILATION property
94255511 VS: Select CUDA code generation architectures
253594d0 VS: Select the CUDA runtime library
4def02a3 VS: Place CUDA host compiler options in proper project file fields
29f07b08 VS: Do not pass CUDA compile options to C compiler
b966f489 VS: Do not use absolute paths to CUDA sources
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !566
2017-03-13 08:57:57 -04:00
Brad King
6ca4f22292 VS: Add support for the CUDA_SEPARABLE_COMPILATION property 2017-03-10 10:19:57 -05:00
Brad King
94255511a6 VS: Select CUDA code generation architectures
Parse the `-gencode=`, `-arch`, and `-code` flags and generate a
`CodeGeneration` field in the project file.
2017-03-10 10:19:57 -05:00
Brad King
253594d0ae VS: Select the CUDA runtime library
Parse the `-cudart=` option and add a corresponding `CudaRuntime`
field to the generated project file.  Also add a matching `.lib`
to the list of libraries linked.
2017-03-10 10:19:57 -05:00
Brad King
4def02a385 VS: Place CUDA host compiler options in proper project file fields
The CUDA Toolkit's VS integration provides abstractions for host
compiler options for `nvcc` to pass through `-Xcompiler` to the host
MSVC.  Populate our secondary flag table and use it to remove flags from
the `AdditionalCompilerOptions` in favor of their abstractions.

Unfortunately a bug in the CUDA 8.0 VS integration prevents us from
passing anything in `AdditionalCompilerOptions` reliably.  After taking
out the flags that have dedicated abstractions, drop the rest.
2017-03-10 10:19:56 -05:00