Commit Graph

26 Commits

Author SHA1 Message Date
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
Sebastian Holtermann
d867e05892 Autogen: Use JSON instead of CMake script for info files
We used to store information for the _autogen target in a CMake script
file AutogenInfo.cmake, which was imported by a temporary cmake instance in
the _autogen target.  This introduced the overhead of creating a temporary
cmake instance and inherited the limitations of the CMake language which
only supports lists.

This patch introduces JSON files to pass information to AUTORCC and
autogen_ targets.  JSON files are more flexible for passing data, e.g. they
support nested lists.

The patch has the side effects that

- AutogenInfo.cmake is renamed to AutogenInfo.json
- AutogenOldSettings.txt is renamed to AutogenUsed.txt
- RCC<qrcBaseName><checksum>Info.cmake is renamed to
  AutoRcc_<qrcBaseName>_<checksum>_Info.json
- RCC<qrcBaseName><checksum>.lock is renamed to
  AutoRcc_<qrcBaseName>_<checksum>_Lock.lock
- RCC<qrcBaseName><checksum>Settings.txt is renamed to
  AutoRcc_<qrcBaseName>_<checksum>_Used.txt
2019-09-25 10:07:09 -04:00
Sebastian Holtermann
881e3cfbf9 Autogen: Variable renames and cleanups 2019-09-25 10:31:06 +02: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
Sebastian Holtermann
1a3f185c1a Autogen: Split JobProbeDepsT job into separate moc and uic jobs
By splitting `JobProbeDepsT` into two independent `JobProbeDepsMocT`,
`JobProbeDepsUicT`, the moc and uic job generation will happen concurrently.
This should improve the execution speed, when both AUTOMOC and AUTOUIC are
enabled.

Parent directory names for moc and uic output files are are collected in
a `std::unordered_set<std::string>` and get created in a batch.
Beforehand we tried to create the parent directory for each output file.
This led to duplications of `MakeDirectory` calls when there were multiple
output files in the same directory (which is the case usually).
2019-09-16 18:18:48 +02:00
Regina Pfeifer
62e5f72289 clang-tidy: Replace typedef with using 2019-09-03 13:21:26 -04:00
Sebastian Holtermann
c797148e85 Autogen: Use cm::string_view for AUTO{MOC,UIC,RCC} generator names
- Store `AUTO{MOC,UIC,RCC}` generator name as `cm::string_view`
- Use `std::initializer_list` instead of `std::array`
2019-08-27 17:31:45 +02:00
Sebastian Holtermann
8586077baa Autogen: Modernize cmQtAutoGen methods using cm::string_view 2019-08-27 17:31:45 +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
Sebastian Holtermann
71d6a1455e Autogen: Evaluate compiler features for the same exectuable only once
To speed up the `AUTOGEN` configuration process, evaluate the compiler
features only once.  The feature evaluation result is stored in the new class
`cmQtAutoGen::CompilerFeatures`, and the instance is shared by using
`std::shared_ptr`.
2019-05-22 12:25:17 +02:00
Sebastian Holtermann
95de172b68 AutoRcc: Make rcc parsing function private
The `.qrc` parsing functions in `cmQtAutoGen` are no longer needed outside
the private implementation of `cmQtAutoGen::RccLister`.  This makes them
private, too.
2019-04-06 16:17:40 +02:00
Sebastian Holtermann
7cbde5c503 AutoRcc: Add cmQtAutoGen::RccLister class
The new `cmQtAutoGen::RccLister` class provides a simple interface to
list files in a `.qrc` resources file by either calling `rcc` with
list options or by parsing the resources file content.
2019-04-06 16:17:19 +02:00
Sebastian Holtermann
b32e18fb88 Autogen: Remove static const generator name strings from cmQtAutoGen 2019-04-02 20:12:43 +02:00
Sebastian Holtermann
63191b169e Autogen: Use more readable variable names for static const AUTO* strings 2019-02-26 19:33:26 +01:00
Sebastian Holtermann
5e36209f71 Autogen: Rename cmQtAutoGen::GeneratorT enum to cmQtAutoGen::GenT 2019-02-21 11:38:30 +01:00
Sebastian Holtermann
14ae19c327 Autogen: cmQtAutoGen: Store generator names in class static const strings 2019-02-21 11:37:51 +01:00
Sebastian Holtermann
f2f1661334 Autogen: Add and use QtAutoGen::Tools method 2019-01-15 09:52:35 +01:00
Sebastian Holtermann
3aa11f31fc Autogen: Use integers to store the Qt version 2018-08-13 18:12:47 +02:00
Craig Scott
8e841a473f Cleanup: Fix typos and grammar in docs and code
No functional changes, just docs, comments and error messages.
2018-04-23 07:48:03 +10:00
Sebastian Holtermann
a8ee7406a7 Autogen: Improved multi-config include scheme
For multi configuration generators AUTOMOC generates the
moc files that are included in `mocs_compilation.cpp`
in `AUTOGEN_BUILD_DIR/include_$<CONFIG>/`. By doing so each
configuration reads different moc files when compiling
`mocs_compilation.cpp`. Since we do not (need to) rewrite
`mocs_compilation.cpp` on a configuration change anymore,
the files also does not need to be recompiled anymore.
Not having to rewrite and recompile `mocs_compilation.cpp`
on a configuration change anymore was the main objective of
this patch.

In a similar fashion AUTORCC generates a `qrc_BASE_CMAKE.cpp`
file below `AUTOGEN_BUILD_DIR/include_$<CONFIG>/` and
`qrc_BASE.cpp` becomes a mere wrapper that includes this
actuall rcc output file (when using multi configuration
generators).

The template files `Modules/AutoRccInfo.cmake.in` and
`Modules/AutogenInfo.cmake.in` were removed in favor
of writing the info `.cmake` files manually.

Closes #17230
2018-02-02 09:10:40 +01:00
Sebastian Holtermann
a008578dee Autogen: Process files concurrently in AUTOMOC and AUTOUIC
This introduces concurrent thread processing in the `_autogen`
target wich processes AUTOMOC and AUTOUIC.
Source file parsing is distributed among the threads by
using a job queue from which the threads pull new parse jobs.
Each thread might start an independent ``moc`` or ``uic`` process.
Altogether this roughly speeds up the AUTOMOC and AUTOUIC build
process by the number of physical CPUs on the host system.

The exact number of threads to start in  the `_autogen` target
is controlled by the new AUTOGEN_PARALLEL target property which
is initialized by the new CMAKE_AUTOGEN_PARALLEL variable.
If AUTOGEN_PARALLEL is empty or unset (which is the default)
the thread count is set to the number of physical CPUs on
the host system.

The AUTOMOC/AUTOUIC generator and the AUTORCC generator are
refactored to use a libuv loop internally.

Closes #17422.
2018-01-17 17:23:49 +01:00
Sebastian Holtermann
ab9d5896ae Autogen: Detect rcc feature once during configuration
We used to detect the `rcc` features before every `rcc` list invocation
wich resulted in `rcc` be called twice for every listing operation.

Now we detect the `rcc` list capabilities once during configuration and
pass it to the cmake_autorcc target in the info file.
2017-11-19 13:12:42 +01:00
Sebastian Holtermann
f86ba8ee8e Autogen: Reintroduce per-config sources support
Reintroduce per-config sources support in AUTOGEN but disable it by default.
2017-09-25 16:27:38 +02:00
Sebastian Holtermann
5d3bca6485 Autogen: Rename cmQtAutoGen::GeneratorType to cmQtAutogen::Generator 2017-09-25 12:02:35 +02:00
Sebastian Holtermann
d8d064abbc Autogen: Use the same algorithm for RCC and UIC option merging 2017-09-07 17:53:19 +02:00
Sebastian Holtermann
d1e5eb8497 Autogen: Iterate source files only once
This is a large commit that serves multiple purposes

- Iterate source files only once and store all extracted
  information in a cmQtAutogenDigest class that can be reused.
  This is brings speed improvements because several properties
  are only evaluated once. More that that it helps to avoid
  duplication of code with non trivial files property checks.
- Fix the Visual Studio generator to use PRE_BUILD when possible.
- Convert `for( ... )` loops to C++11 range base loops where possible
  (cmQtAutogen*.cxx only).
- String concatenation optimizations.
2017-09-07 17:53:18 +02:00