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

427 Commits

Author SHA1 Message Date
Michael Stürmer
51865fc67e Vs: allow CSharp targets to be linked to CXX targets
Fixes: #16755
2017-06-21 08:37:15 +02:00
Brad King
61c1848cdc Merge branch 'ipo-per-lang' into release-3.9 2017-06-14 15:10:39 -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
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
Brad King
29f07b0867 VS: Do not pass CUDA compile options to C compiler 2017-03-10 10:19:56 -05:00
Brad King
b966f489c1 VS: Do not use absolute paths to CUDA sources
The CUDA Toolkit's VS integration does not properly compute the
intermediate files directory location when the path to the source
file is absolute.
2017-03-10 10:19:56 -05:00
Brad King
b64b4629ea VS: Add basic infrastructure for CUDA generation
Generate the `CudaCompile` elements in `.vcxproj` files.
2017-03-10 10:19:56 -05:00
Brad King
f36eaf6a6e Refactor WINDOWS_EXPORT_ALL_SYMBOLS implementation
Use `cmGeneratorTarget::ModuleDefinitionInfo` to combine the
implementation of `WINDOWS_EXPORT_ALL_SYMBOLS` with that of using a
`.def` file as a source.  Only one of these could be used within a
single target before anyway.
2017-03-09 16:25:15 -05:00
Brad King
25d261efa7 Refactor module definition file selection
Create a `ModuleDefinitionInfo` structure for each configuration of a
target to hold corresponding information about the selected module
definition file (`.def` source).
2017-03-09 16:25:14 -05:00
Brad King
1e0a9ac45d Refactor module definition source enumeration
Add a `cmGeneratorTarget::GetModuleDefinitionSources` method.
2017-03-09 16:24:27 -05:00
Brad King
5d81817b71 Merge topic 'csproj_add_free_source_tags'
506207f9 VS: add test for VS_CSHARP_* source file property
a202749c VS: add CSharpUtilities module
9588d0a2 VS: add VS_CSHARP_<tagname> sourcefile property
2017-03-02 09:26:03 -05:00
Brad King
fce6233d8b Merge branch 'csproj_add_free_source_tags' into release 2017-03-02 08:38:16 -05:00
Michael Stürmer
9588d0a2e2 VS: add VS_CSHARP_<tagname> sourcefile property 2017-03-01 15:31:05 -05:00
Brad King
17c151965d Merge topic 'vcxproj-indentation'
2cb165e8 VS: Fix .vcxproj indentation
2017-02-24 09:31:33 -05:00
Brad King
2cb165e8c0 VS: Fix .vcxproj indentation
In commit v3.8.0-rc1~87^2~1 (VS: added support for C#, 2017-01-09) we
removed what looked like a no-op streaming operation but in fact it
is responsible for applying indentation.  Restore the line.
2017-02-23 13:38:47 -05:00
Brad King
109b8a6fd3 VS: Refactor AdditionalOptions generation
Store unknown flags directly in a flag map entry for `AdditionalOptions`
instead of having a separate member for them.  This avoids duplicating
the output generation logic for the entry.
2017-02-15 10:41:36 -05:00
Brad King
8ba6dc362d VS: Place CMAKE_<LANG>_STANDARD_LIBRARIES after other libraries
Make the VS generator consistent with the Ninja and Makefile generators
that place the libraries listed in this variable after other libraries
on the link command line.  These system libraries never depend on the
project libraries.
2017-02-14 11:21:08 -05:00
Brad King
1d04d2ce36 VS: Refactor parsing of CMAKE_<LANG>_STANDARD_LIBRARIES
Parse the value as a command line string just as the MS CRT would.
This makes the VS generator behavior consistent with how the string
is used by the Ninja and Makefile generators.
2017-02-14 11:15:08 -05:00
Evgeny Fimochkin
5ba2c9e5e0 VS: Add support for ASM_NASM language
Fixes: #16469
2017-02-07 13:20:52 -05:00
Michael Stürmer
4bfb1249ed VS: removed usage of relative paths for C# targets in in-source builds 2017-01-18 15:53:40 +01:00
Michael Stürmer
90cb408323 VS: improve handling of source files with special extensions in .csproj
Mainly <Link> and <DependentUpon> tags are added to connect generated
and manually edited files. Special file extensions that are take care
of are:

 - .Designer.cs
 - .xaml.cs
 - .settings
 - .resx
 - .xaml
2017-01-18 15:51:22 +01:00