327 Commits

Author SHA1 Message Date
Brad King
3fa3b7a402 cmGeneratorTarget: Remove default config from Get* methods
Ensure all call sites pass an explicit configuration.
2020-05-18 12:56:56 -04:00
Vitaly Stakhovsky
36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Marc Chevrier
4248bb452a CUDA: Device linking use now link options
properties LINK_OPTIONS and INTERFACE_LINK_OPTIONS are propagated
to the device link step.

To control which options are selected for normal link and device link steps,
the $<DEVICE_LINK> and $<HOST_LINK> generator expressions can be used.

Fixes: #18265
2020-04-19 15:53:11 +02:00
Vitaly Stakhovsky
ef408dd232 cmState::GetTargetTypeName: return type is *cmProp 2020-03-19 08:55:03 -04:00
Kyle Edwards
87819db28d Merge branch 'backport-swift-ninja-multiconfig' into swift-ninja-multiconfig 2020-03-09 09:12:54 -04:00
Saleem Abdulrasool
65b3848de0 Swift: support Ninja Multi-Config
Enable support for multi-configuration builds using Ninja when building
Swift.
2020-03-09 09:11:22 -04:00
Alexandru Croitor
ad3f69c86e Add support for FRAMEWORK_MULTI_CONFIG_POSTFIX_<CONFIG> 2020-03-04 14:30:54 +01:00
Brad King
7da2c8c543 Merge branch 'backport-cuda-non-device-link' 2020-02-24 13:34:13 -05:00
Francisco Facioni
738f3f23aa Ninja: Do not use nvcc response files with non-nvcc tools
Since commit d91b5a72cd (Ninja: Add support for CUDA nvcc response
files, 2019-05-30, v3.15.0-rc1~8^2) we use NVCC's `--options-file`
option to avoid long link command lines via a response file.  However,
for non-device linking the host tools are used and the option does not
make sense.  Update the logic to use `--options-file` only for device
linking.  Linking with the host tools already has its own logic for
response files.

Fixes: #19954
2020-02-24 13:31:33 -05:00
Brad King
451ce7e410 Merge topic 'swift-exe-exports'
1e26d57188 Ninja: properly handle exports from Swift exes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4314
2020-02-04 08:27:49 -05:00
Saleem Abdulrasool
1e26d57188 Ninja: properly handle exports from Swift exes
This adds logic to properly handle Swift executables.  Only executables
marked as exporting symbols will now generate module interfaces for the
executable.
2020-02-01 17:25:57 -08:00
Brad King
afcd9fe669 AIX: Add an option to disable automatic exports from shared libraries
Since commit 0f150b69d3 (AIX: Explicitly compute shared object exports
for both XL and GNU, 2019-07-11, v3.16.0-rc1~418^2~2) we always export
all symbols from shared libraries by default.  Add a new target property
called `AIX_EXPORT_ALL_SYMBOLS` that can be explicitly set to OFF to
suppress this behavior and export no symbols by default.

Fixes: #20290
2020-01-31 09:34:06 -05:00
Kyle Edwards
b7a2baf38c Ninja Multi-Config: Add variable to control configs used in cross-config build 2020-01-23 15:47:12 -05:00
Kyle Edwards
110037369d Refactor: Split Ninja files into impl-<Config>.ninja and build-<Config>.ninja 2020-01-22 10:26:21 -05:00
Robert Maynard
c7ac13e8ed CUDA: Mult-Config Ninja generator now supports CUDA 2020-01-13 12:50:37 -05:00
Brad King
041e58d195 Merge topic 'ninja-cross-build-disable'
e8032e202e Ninja Multi-Config: Make cross-config building opt-in

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4205
2020-01-13 10:34:18 -05:00
Kyle Edwards
e8032e202e Ninja Multi-Config: Make cross-config building opt-in
Many users will want to use the Ninja Multi-Config generator like a
traditional Visual Studio-style multi-config generator, which doesn't
mix configurations - custom commands are built using target executables
of the same configuration the command is for. We do not want to force
these people to generate an N*N build matrix when they only need N*1,
especially if they have lots of targets. Add a new variable,
CMAKE_NINJA_CROSS_CONFIG_ENABLE, to opt-in to the cross-config build
matrix.
2020-01-10 16:31:29 -05:00
Marc Chevrier
968477517e Refactoring: suppress cmEraseIf in favor of cm::erase_if 2020-01-09 11:19:20 +01:00
Marc Chevrier
5444a8095d cmGlobalGenerator: modernize memrory managemenbt 2019-12-30 16:55:39 +01:00
Kyle Edwards
5a8a9f7229 Ninja: Add multi-config variant
Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
2019-12-13 10:51:46 -05:00
Kyle Edwards
3bc63e99e4 Refactor: Prepare Ninja generator for multi-config 2019-12-13 10:51:46 -05:00
Johnny Jazeix
2d0100fac7 replace remove and remove_directory with rm in tests 2019-11-13 18:02:18 -05:00
Cristian Adam
36ded610af PCH: Generate sources during Compute step 2019-10-09 13:50:25 +02:00
Brad King
83c1657ff7 Unity build: Generate sources during Compute step
The unity build sources need to be added for all generators.  Create
them during `cmGlobalGenerator::Compute` to avoid duplicating the calls
in every generator.  We already handle Qt autogen there too.

Issue: #19789
2019-10-03 14:55:22 -04:00
Brad King
4891f0f966 Ninja: Ensure shared library version symlinks are created for dependents
When linking to a shared library target that has version symlinks, add
an order-only dependency on the build statement that creates the links.
This ensures that the links exist for use at runtime.

Fixes: #19774
2019-10-01 14:34:03 -04:00
Marc Chevrier
c688b401d3 cmstd: Modernize CMake system headers
Provide a standardized way to handle the C++ "standard" headers
customized to be used with current CMake C++ standard constraints.
Offer under directory `cm` headers which can be used as direct
replacements of the standard ones.  For example:

    #include <cm/string_view>

can be used safely for CMake development in place of the `<string_view>`
standard header.

Fixes: #19491
2019-09-20 10:01:37 -04:00
Regina Pfeifer
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Brad King
ac4d6d4a9d Merge topic 'unity-build'
7786a05c70 Unity build: Add XCode support
1353802af3 Unity build: Add unit tests
8dfeb5d278 Unity build: Add support for Visual Studio generator
7114c141e2 Unity build: Add support for Ninja and Makefile generators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Stanislav Ershov <digital.stream.of.mind@gmail.com>
Acked-by: Evgeniy Dushistov <dushistov@mail.ru>
Acked-by: Viktor Kirilov <vik.kirilov@gmail.com>
Merge-request: !3611
2019-09-05 08:36:06 -04:00
Brad King
4684e64c84 Merge topic 'clang-ipo-support'
dca9c33abc Tests: Remove old IPO test
c856d4556b bindexplib: supporting llvm bitcode formats using llvm-nm
079b8e2916 Clang: prefer lld-link over link.exe
6e3655db2c Clang: add LTO support for GNU-command line clang on windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3527
2019-09-03 09:39:03 -04:00
Zsolt Parragi
c856d4556b bindexplib: supporting llvm bitcode formats using llvm-nm 2019-08-30 11:30:38 -04:00
Cristian Adam
7114c141e2 Unity build: Add support for Ninja and Makefile generators 2019-08-29 16:44:09 +02:00
Brad King
fa36e2151d Merge topic 'precompile-headers'
8da78d4efe Precompile headers: Update documentation
5772930164 Precompile headers: Add unit tests
519606704e Precompile headers: Add support for Visual Studio generators
28be170fbc Precompile headers: Add support for Xcode generator
b8626261e9 Precompile headers: Add methods to generate PCH sources
375d01c680 PCH: add example/test
9b6797e71d PCH: add target_precompile_headers command
0467a2f91b PCH: add PRECOMPILE_HEADERS to special properties

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Acked-by: Ivan171 <heavenandhell171@gmail.com>
Acked-by: Stanislav Ershov <digital.stream.of.mind@gmail.com>
Acked-by: Steve Mokris <smokris@softpixel.com>
Acked-by: Evgeniy Dushistov <dushistov@mail.ru>
Acked-by: Danila Malyutin <flashmozzg@gmail.com>
Acked-by: Viktor Kirilov <vik.kirilov@gmail.com>
Acked-by: Lucas Zhao <zhaopf6@163.com>
Merge-request: !3553
2019-08-29 09:38:21 -04:00
Cristian Adam
b8626261e9 Precompile headers: Add methods to generate PCH sources
Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
2019-08-28 11:47:40 -04:00
Brad King
2a2c4cc722 Merge topic 'ninja_additional_clean_files_custom_target'
d040f3f1ee Tests: Extend MakeClean test to test various target types
3ed8cffe73 Ninja: Add support for ADDITIONAL_CLEAN_FILES in custom targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3739
2019-08-27 10:16:05 -04:00
Sebastian Holtermann
3ed8cffe73 Ninja: Add support for ADDITIONAL_CLEAN_FILES in custom targets
This enables the support for `ADDITIONAL_CLEAN_FILES` in custom targets
using the ninja generator.

Fixes: #19641
2019-08-26 09:31:03 -04:00
Sebastian Holtermann
9b334397f5 Source sweep: Use cmStrCat for string concatenation
This patch is generated by a python script that uses regular expressions to
search for string concatenation patterns of the kind

```
std::string str = <ARG0>;
str += <ARG1>;
str += <ARG2>;
...
```

and replaces them with a single `cmStrCat` call

```
std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...);
```

If any `<ARGX>` is itself a concatenated string of the kind

```
a + b + c + ...;
```

then `<ARGX>` is split into multiple arguments for the `cmStrCat` call.

If there's a sequence of literals in the `<ARGX>`, then all literals in the
sequence are concatenated and merged into a single literal argument for
the `cmStrCat` call.

Single character strings are converted to single char arguments for
the `cmStrCat` call.

`std::to_string(...)` wrappings are removed from `cmStrCat` arguments,
because it supports numeric types as well as string types.

`arg.substr(x)` arguments to `cmStrCat` are replaced with
`cm::string_view(arg).substr(x)`
2019-08-22 16:38:10 +02:00
Regina Pfeifer
d331021255 clang-tidy: isolate declarations for readability 2019-08-21 00:20:49 +02:00
Sebastian Holtermann
f4f3c68926 Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgument 2019-08-14 16:33:20 +02:00
Sebastian Holtermann
18b0330b86 clang-tidy: Enable performance-inefficient-string-concatenation
Enables the clang-tidy test performance-inefficient-string-concatenation
and replaces all inefficient string concatenations with `cmStrCat`.

Closes: #19555
2019-08-05 17:21:00 +02:00
Sebastian Holtermann
f71f7ce3f0 cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.h
This adds the `cmStringAlgorithms.h` header and moves all string functions
from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
2019-07-29 21:13:56 +02:00
Marc Chevrier
d9b2c7dae2 Introduce memory management helper: cm_memory.hxx 2019-07-14 15:37:30 +02:00
Brad King
71fbebd1dc IWYU: Fix handling of <memory> standard header
An old workaround for `std::allocator_traits<>::value_type` lints from
IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`.
Convert the workaround to use the same approach we already use for a
workaround of `std::__decay_and_strip<>::::__type` lints.  Then update
the `<memory>` inclusions to follow the now-correct IWYU lints.
2019-07-10 11:48:56 -04:00
Francisco Facioni
eda4c43879 Ninja: Fix CUDA device linking when using response files
Fix the logic added by commit d91b5a72cd (Ninja: Add support for CUDA
nvcc response files, 2019-05-30, v3.15.0-rc1~8^2) to always use the CUDA
compiler response file flag for response files during device linking.
2019-06-25 14:30:36 -04:00
Francisco Facioni
d91b5a72cd Ninja: Add support for CUDA nvcc response files 2019-06-03 11:53:27 -04:00
Francisco Facioni
5efac09bed Ninja: Compute linker response file flag earlier 2019-06-03 11:52:28 -04:00
Sebastian Holtermann
465d6d7f9b Ninja: Use cmNinjaBuild class for WriteBuild 2019-05-30 18:38:20 +02:00
Sebastian Holtermann
4c9e99e1f9 Ninja: Use cmNinjaBuild class for WriteBuild 2019-05-30 18:38:20 +02:00
Sebastian Holtermann
cba8584517 Ninja: Use cmNinjaBuild class for WriteBuild 2019-05-30 18:38:20 +02:00
Sebastian Holtermann
dff42d4812 Ninja: Use cmNinjaBuild instead of WritePhonyBuild 2019-05-30 18:21:40 +02:00
Sebastian Holtermann
6136ab5e17 Ninja: Use cmNinjaRule as sole parameter in the WriteRule and AddRule methods
Instead of passing multiple strings to the `WriteRule` and `AddRule` methods
of `cmGlobalNinjaGenerator`, pass only a `cmNinjaRule` instance reference,
that is set up beforehand.

Adapt calls to `WriteRule` and `AddRule` in multiple places.
2019-05-29 13:04:52 +02:00