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

348 Commits

Author SHA1 Message Date
Francisco Facioni
d91b5a72cd Ninja: Add support for CUDA nvcc response files 2019-06-03 11:53:27 -04:00
Sebastian Holtermann
c79b666c43 Ninja: Use cmNinjaBuild class for WriteBuild 2019-05-30 18:38:20 +02:00
Sebastian Holtermann
477f9e3095 Ninja: Use cmNinjaBuild class for WriteBuild 2019-05-30 18:38:20 +02:00
Sebastian Holtermann
fc451f130d Ninja: Use cmNinjaBuild class for WriteBuild 2019-05-30 18:38:20 +02:00
Sebastian Holtermann
df72f06182 Ninja: Use cmNinjaBuild instead of WritePhonyBuild 2019-05-30 18:21:40 +02:00
Sebastian Holtermann
0eed548d3f Ninja: Use cmNinjaBuild instead of WritePhonyBuild 2019-05-30 18:21:40 +02:00
Sebastian Holtermann
b6dc977ff1 Ninja: Embrace temporary objects in scopes 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
Sebastian Holtermann
006229278b Use cmAppend to append ranges to std::vector instances 2019-05-23 16:19:49 +02:00
Brad King
8ee6584a99 Ninja,Makefile: Fix <LANG>_COMPILER_LAUNCHER shell command syntax
The first entry in the compiler launcher command argument list is
the command itself and should be converted to the shell's native
command syntax (e.g. backslashes on Windows).

Without this, the `RunCMake.CompilerLauncher` test fails on Windows
when there are *no* spaces in the path to `cmake.exe`.
2019-05-22 10:47:15 -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
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
7d7f31161d Ninja: add support for Swift's output-file-map.json
Add an emitter for the Swift's output-map-file.json to emit the
requisite support files for Swift compilation.  This additionally
prevents the build rules for the object file emission as well to
properly support the Swift build semantics.
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
Sebastian Holtermann
30a550d6ad Ninja: In cmNinjaTargetGenerator use std::unique_ptr to manage new instances 2019-05-13 17:20:27 +02:00
Sebastian Holtermann
0024356f8e Ninja: In cmNinjaTargetGenerator optimize string composition 2019-05-13 17:20:23 +02:00
Sebastian Holtermann
8691b3cf91 Ninja: Inline range loop range arguments 2019-05-12 18:56:53 +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
Ben Boeckel
76e6e01c6c cmNinjaTargetGenerator: use a different depfile for preprocessing
If the compile rule also needs a depfile, the names now no longer
collide.
2019-03-12 15:37:07 -04:00
Ben Boeckel
f22c18b1c1 ninja: name dyndep internal files using the object file
Now that preprocessing outputs are not necessarily used all the way
through, the output name is a better base name to use for these files.
2019-02-25 10:14:11 -05:00
Ben Boeckel
7c78adca8e cmNinjaTargetGenerator: remove "preprocessed" mentions in dyndep
Not all languages compile the preprocessed source (or even have
preprocessed sources at all).
2019-02-25 10:14:11 -05:00
Ben Boeckel
933dd91642 ninja: do not assume explicit preprocessing uses that output
In Fortran, this is OK, but for C++, compiling preprocessed source
generally results in poorer diagnostic messages and can also be
ill-formed anyways.
2019-02-25 10:14:11 -05:00
Ben Boeckel
2c0a7bc770 ninja: pass language to cmake_ninja_depends 2019-02-25 10:14:09 -05:00
Ben Boeckel
72f9bb2993 ninja: make dyndep generation language aware
A target may have multiple languages with dyndep rules, separate `.dd`
files should be generated.
2019-02-25 10:06:20 -05:00
Saleem Abdulrasool
c048cb75fc Ninja: add properties for Swift partial module and doc
When building a swift object, we emit a partial swiftmodule and swiftdoc
that must be merged at the end.  However, in order to do that, we need
to enumerate the swiftmodules and swiftdocs.  As a result, the path must
be known to CMake.  Rather than hardcoding the rules into CMake, create
a source property that we can query.  This will allow us to create a
final placeholder to emit the merge rule.

Issue: #18800
2019-02-18 11:15:47 -08:00
Brad King
f2dc10d55c Merge topic 'ninja-swift-library-name'
157570b5a2 Add placeholder for Swift's library name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2902
2019-02-15 10:00:21 -05:00
Brad King
0069825f50 Merge topic 'fortran-submodule-names'
d80ecba5c2 Fortran: Fix submodule file names across compilers
72057d9c15 Fortran: Thread compiler id through to internal Fortran parser
7ae329e2ed Fortran: Factor out .mod and .smod file name construction

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Michael Hirsch, Ph.D. <michael@scivision.co>
Merge-request: !2958
2019-02-14 10:25:15 -05:00
Brad King
d80ecba5c2 Fortran: Fix submodule file names across compilers
The naming convention for submodule files varies across compilers.  Add
a table to the compiler information modules and thread the information
through to the Fortran module dependency parser.  Fill out the table for
compiler ids known to support Fortran submodules.

Fixes: #18746
2019-02-14 10:23:02 -05:00
Saleem Abdulrasool
157570b5a2 Add placeholder for Swift's library name
This allows us to set the proper link name for the Swift library
(soname).  Because this needs to be passed to the object being compiled,
we need to create a new placeholder so that it can be sent along to the
frontend.  Default to the target name unless it is explicitly provided.
2019-02-13 09:25:29 -08:00
Vitaly Stakhovsky
00ba28ffd0 cmMakefile::GetRequiredDefinition: return const std::string& 2019-02-07 07:35:16 -05:00
Sebastian Holtermann
6d407ae439 Use cmSourceFile::GetIsGenerated 2019-02-01 17:02:53 +01:00
Brad King
a624a3e1b3 Ninja: Use deps=gcc for Intel Compiler on Windows
Ninja 1.9 supports the depfile format generated by this compiler.
Use `deps = gcc` when the version of Ninja is new enough.

Unfortunately the Intel Compiler for Windows does not properly
escape spaces in paths written to a depfile so if there is a
space in the path we must still fall back to `deps = msvc`.

Fixes: #18855
2019-01-30 14:59:23 -05:00
Brad King
699cd03212 Ninja: Drop unnecessary deptype customization infrastructure
Do not pass `CMAKE_NINJA_DEPTYPE_<LANG>` in place of `deps = gcc`.
If Ninja ever introduces a new dependency type we will likely need
to update CMake for it anyway.
2019-01-30 14:54:35 -05:00
Saleem Abdulrasool
de13c55d74 Ninja: support SWIFT_MODULE_NAME property
Add a new `SWIFT_MODULE_NAME` property that defaults to the target name.
This can be adjusted via `set_target_properties`.  This is needed as
otherwise, the first source file determines the module name.

Issue: #18800
2019-01-23 21:21:07 -08:00
Saleem Abdulrasool
0ffe8f8844 Ninja: support SWIFT_MODULE_NAME property
Add a new `SWIFT_MODULE_NAME` property that defaults to the target name.
This is needed as otherwise, the first source file determines the module
name.

Issue: #18800
2019-01-18 07:52:17 -05:00
Saleem Abdulrasool
b90e6134a7 Ninja: add new placeholder SWIFT_AUXILIARY_SOURCES
The swift compilation model requires all sources for the module to be
listed for the compiler to type check across them.  Provide a
placeholder to allow enumerating the remainder of the swift sources in a
target for the language compile rule.

Issue: #18800
2019-01-15 09:13:33 -08:00
Brad King
cd0881be61 IWYU: Update CMake code for IWYU built with Clang 6
IWYU now correctly requires `<utility>` for `std::move`.  It also
requires a container header when used via a range-based for loop.
2019-01-15 10:00:50 -05:00
Regina Pfeifer
32cb564bea clang-tidy: Remove redundant member initializations 2018-12-15 10:51:47 +01:00
Vitaly Stakhovsky
f4ff60a803 cmMakefile: Make GetSafeDefinition return std::string const& 2018-09-18 11:16:46 -04:00
Brad King
1b57f49586 genex: Simplify cmGeneratorExpressionInterpreter
All callers were constructing with a non-empty target name using the
target whose pointer was passed anyway.  Drop this argument.  Simplify
logic accordingly.  Re-order constructor arguments to match the
cmCompiledGeneratorExpression::Evaluate arguments.

Also remove unnecessary getters.
2018-09-07 09:23:43 -04:00
Sebastian Holtermann
b6802cd506 cmGeneratedFileStream: clang-tidy applied to remove redundant `c_str` calls
After changing the ``cmGeneratedFileStream`` methods to accept
``std::string const&`` instead of ``const char*`` we don't
need to call ``std::string::c_str`` anymore when passing
a ``std::string`` to a ``cmGeneratedFileStream`` method.

This patch removes all redundant ``std::string::c_str``
calls when passing a string to a ``cmGeneratedFileStream`` method.

It was generated by building CMake with clang-tidy enabled using
the following options:

-DCMAKE_CXX_CLANG_TIDY=/usr/bin/clang-tidy-4.0;-checks=-*,readability-redundant-string-cstr;-fix;-fix-errors
2018-08-07 17:02:39 +02:00
Marc Chevrier
cc9f88af53 LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDS
Fixes: #17997
2018-06-27 18:38:36 +02:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2018-06-01 09:53:42 -04:00
Brad King
625b8f9076 Ninja: Avoid empty phony edges for target ordering
Since commit v3.9.0-rc1~230^2~2 (ninja: break unnecessary target
dependencies, 2017-04-17) we unconditionally generate a phony edge for
target ordering.  It is needed in case a later target depends on it.
However, if the phony edge has no inputs then `ninja -d explain` prints:

    ninja explain: output ... of phony edge with no inputs doesn't exist

Furthermore the phony edge's output is considered dirty and can cause
dependents to be incorrectly considered dirty.  Avoid this by always
generating at least one input to the target ordering phony edges.
If we have no real dependencies just use a path that always exists.

Fixes: #17942
2018-04-26 08:40:57 -04:00
Brad King
ae6722483e Merge branch 'backport-ninja-issue-17942' into ninja-issue-17942 2018-04-26 08:40:49 -04:00
Brad King
0826c20128 Ninja: Do not add empty custom command for file(GENERATE) outputs
Internally we mark `file(GENERATE)` outputs as `GENERATED` in order
to tell custom command dependency tracing logic not to expect the
files to exist on disk yet.  This is because we do not generate the
files until after that tracing is done.

The Ninja generator also interprets the `GENERATED` property to mean
that it is expected that some build rule will generate the file if
another build rule depends on it.  If the generator does not know of a
custom command that generates the file then it adds an empty one so that
the `ninja` build tool does not complain about a dependency on a file
that does not exist and has no rule to generate it.  However, this step
is not necessary for `file(GENERATE)` outputs because there is no build
rule to generate them and they will exist before `ninja` runs.

Add an additional `__CMAKE_GENERATED_BY_CMAKE` property internally to
tell the Ninja generator that a `GENERATED` file will exist before the
build starts and is not expected to have a build rule producing it.

Fixes: #17942
2018-04-26 08:39:44 -04:00
Brad King
d6390ce26e Ninja: Fix Fortran support with response files
The Ninja generator splits preprocessing and compilation steps for
Fortran.  Fix this logic to work when using response files for
compilation so that it works for the preprocessing step too.

This fixes behavior under `CMAKE_NINJA_FORCE_RESPONSE_FILE`.

Issue: #17877
2018-04-05 13:02:27 -04:00
Brad King
8592c6326b cmNinjaTargetGenerator: Move force-rspfile check to earlier 2018-04-05 12:51:21 -04:00