Commit Graph

31128 Commits

Author SHA1 Message Date
Alex Turbov
4de2a4a46d Refactor: Opt-out do+while loops and reduce nesting level in handlers
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-08-03 10:55:45 -04:00
Alex Turbov
78fcbb20cd Refactor: Remove reducible flag from handleLevelN() functions
The indicator that smth has been done is the `newArgs` size get
differ after an iteration.

Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-08-03 10:55:45 -04:00
Alex Turbov
b0d6596399 Refactor: Make cmConditionEvaluator::IsTrue a bit more compact
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-08-03 10:55:30 -04:00
Alex Turbov
18bd6c98ea Refactor: Generalize policy checking in HandleLevel1
Also, move OLD policy checking out of the loop to evaluate it once.
2021-07-26 23:40:18 +03:00
Alex Turbov
8bc4a740d6 Refactor: When handle predicates, there is no need to check 2nd arg
Introduce an overload for `IncrementArguments()` w/ one iterator
and use it in the handler level 1.
2021-07-26 23:40:18 +03:00
Alex Turbov
9946ff6848 Refactor: Initialize args vector from iterators instead of copy
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 23:40:18 +03:00
Alex Turbov
bf2fe90372 Refactor: Speedup predicates and binary operation
Before predicates and binary ops reducers use series of `if ()` blocks
to match the keywords. However, if matched the currect `arg` get replaced
with evaluation result, so further `if (<match-another-keyword>)`
is just wasting time/resources.

This patch introduce a chain of `if` → `else if` → ..., so after
first match the loop restarts w/ the next argument.
2021-07-26 23:40:18 +03:00
Alex Turbov
7bec39dc10 Style: Add empty lines to increase readability
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 23:40:18 +03:00
Alex Turbov
314538703a Refactor: Deduplicate code for AND and OR handling in if() command
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 23:40:18 +03:00
Alex Turbov
95fc27cedd Refactor: Rewrite parenthesis scanner to avoid ifs
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 23:40:18 +03:00
Alex Turbov
135c37bdd7 Refactor: Make HandleBinaryOp and HandlePredicate free functions 2021-07-26 23:40:18 +03:00
Alex Turbov
498c8c7773 Refactor: More auto and constness
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 23:40:18 +03:00
Alex Turbov
961df6cde6 Refactor: Make IncrementArguments() the free function
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 23:40:18 +03:00
Alex Turbov
0f65d0cd83 Refactor: Turn the innter while loop in HandleLevelN() into for
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 23:40:18 +03:00
Alex Turbov
24cbfb8d96 Refactor: Turn reducible flag into boolean
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 23:40:18 +03:00
Alex Turbov
c26f15c66d Refactor: Use cm::string_view for static const literals
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 23:40:14 +03:00
Alex Turbov
fab3890025 Refactor: Opt-out if stataments to select 1st param
... for some calls to `cmExpandedCommandArgument`.

Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 21:20:27 +03:00
Alex Turbov
4b4e603075 Refactor: Add constness
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 21:20:18 +03:00
Alex Turbov
bebb3a1f5a Refactor: Use anonymous namespace instead of static keyword for consts
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2021-07-26 21:20:05 +03:00
Brad King
0d987bbd88 Merge topic 'refactor-target-export'
e8e19ed8f2 Refactor export file generator inteface
55e4753bbb Refactor cmTargetExport removing InterfaceIncludeDirecories

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6370
2021-07-26 09:44:15 -04:00
Brad King
00cbc4cff7 Merge topic 'autouic-header-depends'
e5ec0e52f4 AUTOUIC: Fix generating of dependency rules for UI header files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6380
2021-07-26 09:34:52 -04:00
Kitware Robot
ffbd3bb42f CMake Nightly Date Stamp 2021-07-26 00:01:14 -04:00
Kitware Robot
a87c54aba3 CMake Nightly Date Stamp 2021-07-25 00:01:08 -04:00
Kitware Robot
acb068b0f0 CMake Nightly Date Stamp 2021-07-24 00:01:12 -04:00
Brad King
ca2c63f423 Merge topic 'nmc-target-objects'
cb777dd81e Ninja Multi-Config: Restore TARGET_OBJECTS support in cross-configs
83c8272280 cmGeneratorExpressionNode: Factor out local variable for global generator

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6371
2021-07-23 09:39:26 -04:00
Alexey Edelev
e5ec0e52f4 AUTOUIC: Fix generating of dependency rules for UI header files
We could not rely on .ui files when generating the ninja rules
for the generated UI header files. .ui files might be added to the
target sources but never processed by AUTOUIC afterward, since UI
header files are never included in a source code. Instead of adding
dependency rules based on the .ui files, this approach scans
non-generated source files for includes of the UI header files,
as AUTOUIC does. This gives the consistent set of UI header files
at configure time, that could be used to generate byproducts rules
for the AUTOUIC. Also, the path to the generated UI header file depends
not on the .ui file location but on the include line is used in source
files.

Fixes: #16776
2021-07-23 15:37:31 +02:00
Kitware Robot
f7a3031b7d CMake Nightly Date Stamp 2021-07-23 00:01:08 -04:00
Eugene Shalygin
e8e19ed8f2 Refactor export file generator inteface
Replace cmTargetExport with const cmGeneratorTarget to allow recursive
processing of exported targets and their link dependencies.
2021-07-22 13:08:58 +02:00
Eugene Shalygin
55e4753bbb Refactor cmTargetExport removing InterfaceIncludeDirecories
Because of this property in the cmTargetExport struct, exporting targets
is not uniform: top-level ones have to be dealt with via the
cmTargetExport objects, while all linked ones are cmGeneratorTarget
objects. Let's pass this additional includedirectories via a special
target property making handling exported targets uniform.
2021-07-22 13:08:58 +02:00
Kitware Robot
26a76cf46d CMake Nightly Date Stamp 2021-07-22 00:01:11 -04:00
Brad King
cb777dd81e Ninja Multi-Config: Restore TARGET_OBJECTS support in cross-configs
Since commit 2ae72ef74b (Xcode: Enable multi-arch TARGET_OBJECTS genex
in [INTERFACE_]LINK_LIBRARIES, 2021-05-26, v3.21.0-rc1~126^2) the
TARGET_OBJECTS genex, when referenced for linking, is now evaluated with
EvaluateForBuildsystem enabled.  This causes the object file paths to be
computed with a buildsystem-specific placeholder for the configuration.

This is normally fine because the placeholder will be evaluated by the
native buildsystem tool using the proper configuration.  However, the
Ninja Multi-Config generator's `${CONFIGURATION}` placeholder may not
have the correct value for cross-config object files.  Switch back to
using the per-config location of each object file for this generator.

Fixes: #22436
2021-07-21 11:46:15 -04:00
Brad King
b8021454ce Merge topic 'message-color'
c7a8c9c811 cmMessenger: Revert to non-color messages on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6369
2021-07-21 11:34:05 -04:00
Brad King
e98bfa484f Merge topic 'message-color' into release-3.21
c7a8c9c811 cmMessenger: Revert to non-color messages on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6369
2021-07-21 11:34:04 -04:00
Brad King
797aa4c410 Merge topic 'toolchain-CMP0126' into release-3.21
144be54dd3 try_compile: Propagate CMP0126 to the generated test project

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6366
2021-07-21 11:31:29 -04:00
Brad King
992467c30c Merge topic 'toolchain-CMP0126'
144be54dd3 try_compile: Propagate CMP0126 to the generated test project

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6366
2021-07-21 11:31:29 -04:00
Kitware Robot
dee0b88e77 CMake Nightly Date Stamp 2021-07-21 00:01:11 -04:00
Brad King
83c8272280 cmGeneratorExpressionNode: Factor out local variable for global generator 2021-07-20 14:52:01 -04:00
Brad King
c7a8c9c811 cmMessenger: Revert to non-color messages on Windows
Since commit 0a0a0f8a74 (cmMessenger: Color messages to terminal by
type, 2021-05-18, v3.21.0-rc1~146^2) the message output no longer goes
through our custom streambuf on Windows that converts output encoding.
This can cause messages to be printed with the wrong encoding in a
Windows Console.  It also causes messages to have a mix of LF and CRLF
newlines because `stderr` converts LF to CRLF but our custom streambuf
does not.

Revert to using just `cerr` for messages on Windows.  Another approach
will be needed to achieve color output on Windows later.

Fixes: #22444
2021-07-20 13:30:11 -04:00
Brad King
c9d440fcaa Merge topic 'find_library_usable_from_script_mode'
aa3ab3eb92 find_library: Infer library prefix and suffix when in script mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6338
2021-07-20 11:48:17 -04:00
Brad King
6cd0908072 Merge topic 'autogen-ui-header-depends'
9cebdbec77 AUTOUIC: Fix cyclic dependency between generated UI headers and timestamp

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6359
2021-07-20 11:46:01 -04:00
Brad King
144be54dd3 try_compile: Propagate CMP0126 to the generated test project
Set policy CMP0126 to the value used in the calling project.
It may affect toolchain file behavior.
2021-07-20 09:47:02 -04:00
Kitware Robot
6521cededd CMake Nightly Date Stamp 2021-07-20 00:01:10 -04:00
Alexey Edelev
9cebdbec77 AUTOUIC: Fix cyclic dependency between generated UI headers and timestamp
Once the generated UI headers are created by UIC they also are involved
into processing in next run on ninja.  Autogen adds `ui_*.h` files to
the deps file `ui_*.h` and this cause timestamp start depend on `ui_*.h`.
Meanwhile `ui_*.h` depend on timestamp because of the explicit rules
added by commit 1265c65b33 (AUTOUIC: Collect ui header files for Ninja
generator, 2021-02-18, v3.21.0-rc1~600^2).  Avoid adding `ui_*.h` to
deps file at second ninja run.

Fixes: #16776
2021-07-19 13:28:16 -04:00
Brad King
4ff651eb52 Merge topic 'cmake-presets-no-binary-dir-no-s' into release-3.21
aa874dc609 CMakePresets.json: Fix expansion issue with empty binaryDir

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6358
2021-07-19 12:59:01 -04:00
Brad King
a9900c8364 Merge topic 'cmake-presets-no-binary-dir-no-s'
aa874dc609 CMakePresets.json: Fix expansion issue with empty binaryDir

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6358
2021-07-19 12:59:01 -04:00
Robert Maynard
aa3ab3eb92 find_library: Infer library prefix and suffix when in script mode
This aligns `find_library` with the documentation that states it
can be called from script mode. This is done by infering the
proper prefix and suffix values when `find_library` is called
when the `CMAKE_FIND_LIBRARY*` are not set. This also means that
`find_library` won't produce obscure error messages about unset
definitions.

Fixes: #22027
2021-07-19 12:55:18 -04:00
Brad King
1f6e1a2d78 Merge topic 'vs2022'
0c7f918fb1 VS: Update Visual Studio 17 2022 generator for Preview 2
1ac1436b25 VS: Fix `/sourceDependencies` flag table entries for v143
919fc7fd5f VS: Remove broken EnableASAN entry from flag table for v143
3f19847b28 VS: Remove empty ExternalWarningLevel entry from flag table for v143
ccb6083cbe VS: Remove empty LanguageStandard entries from flag table for v143
c167de7e70 VS: Remove empty ConformanceMode entry from flag table for v143
993d706a17 VS: Populate `/JMC-` flag table entry for v143
a070d87e08 VS: Populate `-Qspectre-` flag table entry for v143
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Egor Pugin <egor.pugin@gmail.com>
Merge-request: !6350
2021-07-19 12:41:20 -04:00
Kitware Robot
fabbb69e69 CMake Nightly Date Stamp 2021-07-19 00:01:13 -04:00
Kitware Robot
0094d12ead CMake Nightly Date Stamp 2021-07-18 00:01:07 -04:00
Kitware Robot
7f7e7485f3 CMake Nightly Date Stamp 2021-07-17 00:01:10 -04:00