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

358 Commits

Author SHA1 Message Date
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
Saleem Abdulrasool
9e5457d3b4 Ninja,Swift: correct response file handling
The response file was being written but not used due to the wrong
variable being configured for Swift.  Swift does compile+link in a
single phase and does not use the `<OBJECTS>` placeholder.  Use the
`<SWIFT_SOURCES>` placeholder instead for the response file substitution
which serves the same purpose.
2019-05-23 14:05:37 -07:00
Brad King
79c6a573f4 Merge topic 'swift-flags'
02c14b7fcd Ninja,Swift: pass along DEFINES/FLAGS/INCLUDES

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3355
2019-05-23 08:55:16 -04:00
Brad King
fc4cbbc2a5 Merge topic 'remove_unneeded_device_link_calls'
81b4d10d8f CUDA: More exhaustive checks to determine when to do device linking
3205c7c950 cmNinjaLinkLineDeviceComputer now lives in the correct source file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3320
2019-05-22 10:30:00 -04:00
Brad King
aefd424b6b Merge topic 'swift-debug-variant'
62381effba Ninja,Swift: reuse `SWIFT_MODULE_NAME` for `SWIFT_MODULE`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3343
2019-05-22 10:28:00 -04:00
Brad King
021c61408c Merge topic 'ninja-lib-symlink-space'
13c92b4a30 Ninja: Fix creation of library symlinks in folders with spaces

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3341
2019-05-22 10:24:46 -04:00
Saleem Abdulrasool
02c14b7fcd Ninja,Swift: pass along DEFINES/FLAGS/INCLUDES
Since the Swift model does a single compile/link phase, we would not
get the compile definitions, includes, and options past along to the
build of the module.  Compute these for the target when constructing
the main command.
2019-05-21 08:53:50 -07:00
Robert Maynard
81b4d10d8f CUDA: More exhaustive checks to determine when to do device linking
Previously CMake used fairly naive logic to determine when to do
device linking which caused unnecessary device linking to occur
frequently. We now use a more exhaustive algorithm to determine
when we have a need for device linking.

Fixes: #19238
2019-05-21 11:40:07 -04:00
Saleem Abdulrasool
62381effba Ninja,Swift: reuse SWIFT_MODULE_NAME for SWIFT_MODULE
Rather than compute the value of `SWIFT_MODULE`, use the computed value
of `SWIFT_MODULE_NAME`.  This is helpful strictly for Windows where you
have multiple configuration variants with differing ABIs that need must
co-exist.  In particular, this re-use permits the use of
`CMAKE_DEBUG_POSTFIX` to have the import library and the DLL be named
with the trailing suffix but have the same import name for the swift
module and interface.
2019-05-20 09:28:35 -07:00
Robert Maynard
3205c7c950 cmNinjaLinkLineDeviceComputer now lives in the correct source file 2019-05-20 11:05:16 -04:00
Brad King
a9fb9a8774 Merge topic 'ninja-swift'
a9180ccf9a Tests: add a check for the Swift compiler
d745551fb6 Help: add some initial documentation for Swift support
9a182c9e5b Auxiliary: update vim syntax highlighting
e9b0063e8e Modules: add build rules for Swift Ninja support
b6412e3e38 Ninja: add placeholders to support Swift build
7d7f31161d Ninja: add support for Swift's output-file-map.json
d688c4c19d Swift: remove unnecessary unreleased Ninja infrastructure
0723582208 Swift: Detect compiler version
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3297
2019-05-20 10:55:27 -04:00
Eike Ziller
13c92b4a30 Ninja: Fix creation of library symlinks in folders with spaces
The arguments to 'cmake -E cmake_symlink_library' must be properly
quoted.
2019-05-20 14:36:42 +02:00
Brad King
3020354f7c Merge topic 'string-cleanup'
23e8364aed Source: std::string related cleanup

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sebastian Holtermann <sebholt@web.de>
Merge-request: !3324
2019-05-17 09:26:05 -04:00
Saleem Abdulrasool
b6412e3e38 Ninja: add placeholders to support Swift build
Add the placeholders needed to support compiling Swift code.
2019-05-16 14:41:05 -04:00
Saleem Abdulrasool
d688c4c19d Swift: remove unnecessary unreleased Ninja infrastructure
This cleans up the new options that were added to support Swift.  This
was not released, and the proper support approach that we settled upon
does not require as much specialised support.
2019-05-16 14:41:05 -04:00
Vitaly Stakhovsky
23e8364aed Source: std::string related cleanup 2019-05-15 10:20:05 -04:00
Sebastian Holtermann
012d599e26 Ninja: Add support for ADDITIONAL_CLEAN_FILES target property 2019-05-14 17:50:14 +02:00
Brad King
1628e4677a Merge topic 'touch-after-ranlib'
f83e4359f2 Apple: Preserve high resolution mtime for static libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3283
2019-05-07 11:12:38 -04:00
Gregor Jasny
f83e4359f2 Apple: Preserve high resolution mtime for static libraries
On macOS ranlib truncates the fractional part of the static achive
file modification time.  If the archive and at least one contained
object file were created within the same second this will make look
the archive older than the object file.  On subsequent ninja runs
this leads to re-achiving and updating dependent targets.

As a work-around we touch the archive after ranlib.

Closes: #19222
2019-05-05 16:14:28 +02:00
Saleem Abdulrasool
9ecb3f8d5c Ninja,Makefile: use unique_ptr for memory management
Use a `unique_ptr` to manage the lifetime of the `MacOSXContentGenerator`
and 'OSXBundleGenerator` rather than manually handling the lifetime.
2019-04-18 11:05:25 -04:00