4332131d Convert: Make variables a bit more clear
5aca066c Convert: Remove UNCHANGED enum value
146bf926 Convert: Remove 'FULL' conversion
58ba87f8 Convert: Replace Convert(FULL) with equivalent
e80314d7 Ninja: Replace ternary with if()
563ac22a Convert: Replace trivial conversion with new method
08be47cf Convert: Replace UNCHANGED conversions with new API call
564d3a1d Convert: Extract ConvertToRelativePath from Convert()
95a659f1 Convert: Replace FULL conversions with equivalent
a8c7ccb1 VS: Replace FULL/UNCHANGED conversion with equivalent
5ad25ef4 Convert: Remove NONE conversion
ac463841 Convert: Replace uses of Convert(NONE)
998d9ee9 VS: Replace variable with an if()
ee49f006 Makefiles: Replace ternaries with if()s
51f7dcb0 Makefiles: Inline MakeLauncher into only caller
ba4ba7c3 Makefiles: Simplify MakeLauncher return value
...
Provide a way for custom commands to inform the ninja build tool about
their implicit dependencies. For now simply make use of the option an
error on other generators.
Closes: #15479
Custom command dependencies are followed for each target's source files
and add their transitive closure to the corresponding target. This
means that when a custom command in one target has a dependency on a
custom command in another target, both will appear in the dependent
target's sources. For the Makefile, VS IDE, and Xcode generators this
is not a problem because each target gets its own independent build
system that is evaluated in target dependency order. By the time the
dependent target is built the custom command that belongs to one of its
dependencies will already have been brought up to date.
For the Ninja generator we need to generate a monolithic build system
covering all targets so we can have only one copy of a custom command.
This means that we need to reconcile the target-level ordering
dependencies from its appearance in multiple targets to include only the
least-dependent common set. This is done by computing the set
intersection of the dependencies of all the targets containing a custom
command. However, we previously included only the direct dependencies
so any target-level dependency not directly added to all targets into
which a custom command propagates was discarded.
Fix this by computing the transitive closure of dependencies for each
target and then intersecting those sets. That will get the common set
of dependencies. Also add a test to cover a case in which the
incorrectly dropped target ordering dependencies would fail.
5784747d Improve string find: prefer character overloads.
5cec953e Use std::replace for replacing chars in strings.
2a1a2033 cmExtraEclipseCDT4Generator: use std::replace.
34bc6e1f cmCTestScriptHandler: don't call find repeatedly.
All paths generated on Ninja-invoked command lines should be passed
through ConvertToNinjaPath. Fix ConvertToLinkReference to call this
instead of partially duplicating its implementation.
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* 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.
Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first). First
run `clang-format` with the config file:
---
SortIncludes: false
...
Commit the result temporarily. Then run `clang-format` again with:
---
SortIncludes: true
IncludeCategories:
- Regex: 'sys/types.h'
Priority: -1
...
Commit the result temporarily. Start a new branch and cherry-pick the
second commit. Manually resolve conflicts to preserve indentation of
re-ordered includes. This cleans up the include ordering without
changing any other style.
Use the following command to run `clang-format`:
$ git ls-files -z -- \
'*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
egrep -z -v '^Source/cm_sha2' |
egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
egrep -z -v '^Utilities/(KW|cm).*/' |
egrep -z -v '^Tests/Module/GenerateExportHeader' |
egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
xargs -0 clang-format -i
This selects source files that do not come from a third-party.
Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
The change in commit v3.5.0-rc1~198^2 (Ninja: Always re-run custom
commands that have symbolic dependencies, 2015-11-19) broke the
byproducts feature added by commit v3.2.0-rc1~340^2~2 (Add an option for
explicit BYPRODUCTS of custom commands, 2014-11-13) when SYMBOLIC
outputs also appear. This case occurs with AUTORCC-generated custom
targets because the output is SYMBOLIC (to always run) and the generated
file is a byproduct (for restat so dependents do not run unnecessarily).
The two use cases conflict because Ninja does not support per-output
restat. Favor restat whenever byproducts are present because it is
required for byproducts to work correctly. In use cases where we want
an always-run chain we simply will not be able to also use byproducts.
Fix logic introduced by commit v3.5.0-rc1~198^2 (Ninja: Always re-run
custom commands that have symbolic dependencies, 2015-11-19) to not
consider only the last output. We need to know if any output is
SYMBOLIC, so stop checking as soon as one is found.
Generate custom command build statements in the order we encounter
source files specifying them. Do not depend on pointer values of
internally allocated structures for ordering.
If a custom command has a SYMBOLIC output (that is never actually
created) then do not mark the custom command build statement as
'restat'. Otherwise other custom commands that depend on the symbolic
output may not always re-run because after running the first custom
command Ninja 'restat' will detect that the output timestamp did not
change and skip its dependents.
This was observed with the ExternalProject BUILD_ALWAYS option where
Ninja would not re-run the 'install' step each time 'build' re-runs.
55474e61 cmState: Move GetTargetTypeName from cmTarget.
38df5c36 Remove now-obsolete casts.
4ee2b267 cmGeneratorTarget: Use enum for GetType.
eac15298 cmState: Move TargetType enum from cmTarget.
482b3811 cmTarget: Move link type enum out.
2ee1cb85 cmTarget: Move ImportInfoMap out of internal class.
a48bcabd cmTarget: Move backtrace member out of internal class.
6694d993 cmTarget: Remove unneeded constructors.
983c00f8 Generators: Use GetType from the cmGeneratorTarget.
In the Ninja generator we run all build rules from the top of the build
tree rather than changing into each subdirectory. Therefore we convert
all paths relative to the HOME_OUTPUT directory. However, the Convert
method on cmLocalGenerator restricts relative path conversions to avoid
leaving the build tree with a "../" sequence. Therefore conversions
performed for "subdirectories" that are outside the top of the build
tree always use full paths while conversions performed for
subdirectories that are inside the top of the build tree may use
relative paths to refer to the same files.
Since Ninja always runs rules from the top of the build tree we should
convert them using only the top-level cmLocalGenerator in order to
remain consistent. Also extend the test suite with a case that fails
without this fix.