Commit Graph

169 Commits

Author SHA1 Message Date
Kyle Edwards
9590c3a400 Generator: Don't allow Ninja Multi-Config variables on other generators
We may want to enable these variables later on with specific
semantics. To avoid breaking backwards compatibility, make it an
error to use them for now.
2020-02-27 09:23:08 -05:00
Kyle Edwards
46c836644d Ninja Multi-Config: Fix issue with "all" in CMAKE_NMC_DEFAULT_CONFIGS
Prior to this fix, CMAKE_NMC_DEFAULT_CONFIGS would inherit "all" from
the union of CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG and
CMAKE_NMC_CROSS_CONFIGS. This is inconsistent with the behavior of the
"all" target signifying CMAKE_NMC_CROSS_CONFIGS. Update "all" in
CMAKE_NMC_DEFAULT_CONFIGS to inherit only from CMAKE_NMC_CROSS_CONFIGS.
2020-02-11 10:49:54 -05:00
Kyle Edwards
67102d3252 Ninja Multi-Config: Add support for DEPFILE option in add_custom_command()
And give other generators a path forward to add support in the future.
2020-02-07 14:18:54 -05:00
Kyle Edwards
16a4ba5b31 Ninja Multi-Config: Use build.ninja if cmake --build has no --config
If cmake --build is called with no --config argument, and a
build.ninja file is available, use that instead of defaulting to the
Debug config.
2020-02-04 14:13:07 -05:00
Kyle Edwards
b966f86d86 Ninja Multi-Config: Shuffle variables around
Remove redundant variable CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE.
Rename other variables. Document and improve handling of error
conditions.
2020-02-03 13:27:51 -05:00
Brad King
b12b013028 Ninja: Factor metadata cleanup into dedicated method 2020-01-27 15:39:04 -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
8337ed0d73 Ninja Multi-Config: Add variable to control aliases in build.ninja 2020-01-22 10:26:21 -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
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
Brad King
2ee6baef4f Merge topic 'ninja-postgen-commands'
fb18215904 Ninja: clean ninja metadata once generated

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Jan Niklas Hasse <jhasse@bixense.com>
Merge-request: !3316
2020-01-10 13:30:35 -05:00
Marc Chevrier
a00960288b GlobalGenerator family: modernize memory management 2020-01-07 11:03:11 +01:00
Ben Boeckel
fb18215904 Ninja: clean ninja metadata once generated
Fixes: #15830
2020-01-06 11:57:08 -05: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
Marc Chevrier
36c8cae2e8 cmLocalGenerator: modernize memory management 2019-12-10 00:24:06 +01:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Brad King
a75586c775 Ninja: Simplify top-level "all" target generation
Remove its dedicated implementation and update the per-directory "all"
target generation to work for the top-level directory too.
2019-09-30 10:30:28 -04:00
Brad King
4a92df8667 cmGlobalNinjaGenerator: Remove unused AddDependencyToAll overload 2019-09-30 10:30:28 -04:00
Brad King
dce58afd30 Merge branch 'backport-3.15-fix-EXCLUDE_FROM_ALL-subdir-all'
Resolve conflicts with changes since the 3.15 series:

* Convert `cmSystemTools::IsOn` => `cmIsOn`.
* Move one "EXCLUDE_FROM_ALL" target property logic fix to
  its new location in `cmMakefile::AddNewUtilityTarget`.
2019-09-30 09:34:57 -04:00
Brad King
05d7ca14e9 Merge branch 'backport-3.14-fix-EXCLUDE_FROM_ALL-subdir-all' 2019-09-30 09:19:21 -04:00
Brad King
b3b1c7bf3a Restore "all" target in subdirectories marked EXCLUDE_FROM_ALL
The "all" target in each directory is supposed to have targets from that
directory even if the directory itself is marked `EXCLUDE_FROM_ALL` in
its parent.  This was broken by commit dc6888573d (Pass EXCLUDE_FROM_ALL
from directory to targets, 2019-01-15, v3.14.0-rc1~83^2) which made the
participation of a target in "all" independent of context.  Revert much
of the logic change from that commit to restore the old behavior.  Then
re-implement the behavior intended by the commit to keep its test
working.  Extend the test to cover the old behavior too.

Fixes: #19753
2019-09-30 09:18:20 -04:00
Regina Pfeifer
d63c1e4e6e clang-tidy: modernize-return-braced-init-list 2019-09-06 22:27:39 +02:00
Regina Pfeifer
a1ddf2d0ba clang-tidy: Replace typedef with using
Automate the conversion with

  perl -i -0pe 's/typedef ([^;]*) ([^ ]+);/using $2 = $1;/g'

then manually fix a few places.
2019-09-04 18:03:01 +02:00
Brad King
c81a86ee6d Ninja: Record dyndep support by Ninja 1.10
Upstream Ninja 1.10 and above support the `dyndep` feature we need
for Fortran.
2019-07-30 13:53:44 -04:00
Brad King
83368b4dd5 Ninja: Drop unused dyndep version check
Our dyndep support version 1 has been merged to upstream Ninja.
We never developed a second dyndep version, so simply drop our
checks for different versions.
2019-07-30 13:53:41 -04:00
Brad King
fd58bb83e6 Ninja: Use in-class initialization of global generator members 2019-07-30 13:53:34 -04: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
Sebastian Holtermann
7d9e66a405 Ninja: Remove non cmNinjaBuild based WriteBuild method 2019-05-30 18:38:21 +02:00
Sebastian Holtermann
2dc483476c Ninja: Remove WritePhonyBuild method 2019-05-30 18:38:20 +02:00
Sebastian Holtermann
846b4b1062 Ninja: Make WriteCustomCommandBuild method use cmNinjaBuild internally 2019-05-30 18:21:36 +02:00
Sebastian Holtermann
8a46a07c8b Ninja: Make WriteMacOSXContentBuild use cmNinjaBuild internally 2019-05-30 16:44:30 +02:00
Sebastian Holtermann
15c644437a Ninja: Add cmNinjaBuild based WriteBuild (wrapper) method 2019-05-30 16:44:30 +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
Brad King
66efdbd21a Merge topic 'additional_clean_files'
b5bf369ec6 Release notes: Add release notes for ADDITIONAL_CLEAN_FILES properties
4e2ce0a67a Doc: Update and deprecate ADDITIONAL_MAKE_CLEAN_FILES directory property
338994d65d Doc: Add documentation for ADDITIONAL_CLEAN_FILES properties
c11f089d73 Tests: Extend MakeClean test to cover ADDITIONAL_CLEAN_FILES
012d599e26 Ninja: Add support for ADDITIONAL_CLEAN_FILES target property
890a1b9dc3 Ninja: Add support for ADDITIONAL_CLEAN_FILES directory property
7b23001f20 Ninja: Add support for additional clean files
d745df4b01 Makefiles: Add support for ADDITIONAL_CLEAN_FILES target property
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3318
2019-05-15 09:22:18 -04:00
Brad King
0064edf417 Merge topic 'ninja-pool-custom-command'
9f76961de8 Support job pools in custom commands and targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3308
2019-05-15 09:21:08 -04:00
Sebastian Holtermann
7b23001f20 Ninja: Add support for additional clean files
Additional clean files for the Ninja generator can be registered
via the new method `cmGlobalNinjaGenerator::AddAdditionalCleanFile`.
If there are additional clean files, a new rule `CLEAN_ADDITIONAL` and
a new build target `CMakeFiles/clean.additional` get generated.
The `clean` target will depend on `CMakeFiles/clean.additional`, if the target
exists.
2019-05-14 17:50:14 +02:00
Rosen Matev
9f76961de8 Support job pools in custom commands and targets
Provide a way for custom commands and targets to set the pool variable
of the ninja build statement. Setting `JOB_POOL` is not compatible with
`USES_TERMINAL`, which implies the `console` pool.

The option is silently ignored with other generators.

Closes: #18483
2019-05-14 15:58:00 +02:00
Sebastian Holtermann
054954d855 Ninja: Use clean target instead of clean tool in cmake --target clean calls
A convenience `clean` target for the Ninja generator exists since commit
3bd41f2eb5.  It's safe to call `ninja clean` instead of `ninja -t clean`.
This removes the exception mapping of the `clean` target in
`cmake --build ... --target clean` calls to the Ninja `-t clean` tool.
2019-05-13 17:20:28 +02:00
Sebastian Holtermann
47da9859e8 Ninja: In cmGlobalNinjaGenerator use std::unique_ptr to manage output streams 2019-05-11 15:51:30 +02:00
Sebastian Holtermann
9902702134 Ninja: Add and use cmGlobalNinjaGenerator::CMakeCmd method 2019-05-10 20:22:26 +02:00
Sebastian Holtermann
02293841e7 Ninja: Simplify cmGlobalNinjaGenerator::AddRule and HasRule methods
- Use `std::unordered_set` for the emitted rule register
- Use `std::unordered_map` for command length register
2019-05-10 20:22:26 +02:00
Bartosz Kosiorek
324d18bb34 cmake: Teach --build mode to support multiple targets
Fixes: #16136
2019-03-05 08:55:28 -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
Brad King
f4f3b6b9af Ninja: Detect when ninja is new enough to support a multi-line depfile
Ninja 1.9 supports the multi-line depfile format generated by the
Intel Compiler for Windows.  Teach the global generator to detect
when the version is new enough to support this.
2019-01-30 14:58:21 -05:00
Brad King
d75fec5a88 Merge topic 'tidy-use-equals-default'
094f01d0f0 cleanup: Prefer compiler provided special member functions
55671b41d2 clang-tidy: Use `= default`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Brad King <brad.king@kitware.com>
Merge-request: !2841
2019-01-29 14:07:24 -05:00
Brad King
9620cb935a Merge topic 'add_consistent_verbose_build_flag'
66801f4d40 cmake: Add tests for verbose output to --build mode
439fe2e253 cmake: Add options for verbose output to --build mode
638667efa2 cmake: cmcmd.cxx fix "The arguments are" comments
3ca4402966 ctest: Fix --build-and-test without --build-target on Xcode
cb6c233ecc cmake: Add -hideShellScriptEnvironment xcodebuild option
1a45266cb5 cmGlobalGenerator: Add a class that represent the build command

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2708
2019-01-29 09:19:39 -05:00
Robert Maynard
1a45266cb5 cmGlobalGenerator: Add a class that represent the build command
This refactors a std::vector<std::string> into a class so that
we can extend the features to represent things such as multiple
chained commands in the future.
2019-01-25 08:20:02 -05:00
Regina Pfeifer
094f01d0f0 cleanup: Prefer compiler provided special member functions 2019-01-25 06:45:00 -05:00