summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-2/+4
| | | | | 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.
* Autogen: Refactor json info file reading interfaceSebastian Holtermann2019-09-281-124/+142
|
* Autogen: Use JSON instead of CMake script for info filesSebastian Holtermann2019-09-251-38/+222
| | | | | | | | | | | | | | | | | | | | | | | 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
* cmstd: Modernize CMake system headersMarc Chevrier2019-09-201-1/+2
| | | | | | | | | | | | | | 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
* Autogen: Abbreviate file paths in messagesSebastian Holtermann2019-09-161-16/+15
| | | | | | | | | | | This introduces the `cmQtAutoGenerator::MessagePath` method, that abbreviates paths by placing a - "SRC:" prefix in place of the project source directory - "BIN:" prefix in place of the project binary directory The method is used in `AUTO{MOC,UIC,RCC}` when paths are displayed in messages. This makes the messages generated by `AUTO{MOC,UIC,RCC}` shorter and improves their readability.
* clang-tidy: Replace typedef with usingRegina Pfeifer2019-09-031-1/+1
|
* Autogen: Let cmQtAutoGenerator::Logger methods accept cm::string_viewSebastian Holtermann2019-08-271-51/+26
|
* Autogen: Use cm::string_view for AUTO{MOC,UIC,RCC} generator namesSebastian Holtermann2019-08-271-3/+3
| | | | | - Store `AUTO{MOC,UIC,RCC}` generator name as `cm::string_view` - Use `std::initializer_list` instead of `std::array`
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is generated by a python script that uses regular expressions to search for string concatenation patterns of the kind ``` std::string str = <ARG0>; str += <ARG1>; str += <ARG2>; ... ``` and replaces them with a single `cmStrCat` call ``` std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...); ``` If any `<ARGX>` is itself a concatenated string of the kind ``` a + b + c + ...; ``` then `<ARGX>` is split into multiple arguments for the `cmStrCat` call. If there's a sequence of literals in the `<ARGX>`, then all literals in the sequence are concatenated and merged into a single literal argument for the `cmStrCat` call. Single character strings are converted to single char arguments for the `cmStrCat` call. `std::to_string(...)` wrappings are removed from `cmStrCat` arguments, because it supports numeric types as well as string types. `arg.substr(x)` arguments to `cmStrCat` are replaced with `cm::string_view(arg).substr(x)`
* Source sweep: Use cmIsOn instead of cmSystemTools::IsOnSebastian Holtermann2019-08-171-2/+2
| | | | | | | | | This replaces invocations of - `cmSystemTools::IsInternallyOn` with `cmIsInternallyOn` - `cmSystemTools::IsNOTFOUND` with `cmIsNOTFOUND` - `cmSystemTools::IsOn` with `cmIsOn` - `cmSystemTools::IsOff` with `cmIsOff`
* cmStringAlgorithms: Add cmStrToLong and cmStrToULongSebastian Holtermann2019-08-101-2/+2
| | | | | | | | This adds the following functions to cmStringAlgorithms: - `cmStrToLong`: moved from `cmSystemTools::StringToLong` - `cmStrToULong`: moved from `cmSystemTools::StringToULong` Overloads of the given functions for `std::string` are added as well.
* Autogen: Modernize to use cmStrCat for string concatenationSebastian Holtermann2019-08-071-29/+10
|
* Introduce memory management helper: cm_memory.hxxMarc Chevrier2019-07-141-3/+2
|
* IWYU: Fix handling of <memory> standard headerBrad King2019-07-101-0/+2
| | | | | | | | 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.
* Autogen: A missing info file is a critical errorSebastian Holtermann2019-05-111-1/+2
|
* Autogen: Refactor AUTOMOC and AUTOUIC and add source file parse data cachingSebastian Holtermann2019-05-071-176/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New features ------------ CMake's `AUTOMOC` and `AUTOUIC` now cache information extracted when parsing source files in `CMakeFiles/<ORIGIN>_autogen.dir/ParseCache.txt`. This leads to faster `<ORIGIN>_autogen` target rebuilds, because source files will be parsed again only if they're newer than the `ParseCache.txt` file. The parse cache will be recomputed if it is older than the CMake executable. `AUTOMOC` and `AUTOUIC` now check if `moc` or `uic` output files are older than the `moc` or `uic` executable. If an output file is older than the compiler, it will be regenerated. Therefore if a new `moc` or `uic` version is installed, all output files will be regenerated. `AUTOMOC` and `AUTOUIC` error and warning messages are more detailed. Internal changes ---------------- `moc` and `uic` output file names are not computed in the `_autogen` target anymore but in `cmQtAutoGenInitializer`. This makes the available at the configuration stage for improved dependency computations (to be done). In `AutogenInfo.cmake`, equally sized lists for "source file names", "source file flags" and "compiler output file names" are passed to the `_autogen` target. This replaces the separate file lists for `AUTOMOC` and `AUTOUIC`. Files times are read from the file system only once by using `cmFileTime` instances instead of `cmQtAutoGenerator::FileSystem::FileIsOlderThan` calls. All calls to not thread safe file system functions are moved to non concurrent fence jobs (see `cmWorkerPool::JobT::IsFence()`). This renders the `cmQtAutoGenerator::FileSystem` wrapper class obsolete and it is removed. Instead of composing a single large settings string that is fed to the `cmCryptoHash`, now all setting sub strings are fed one by one to the `cmCryptoHash` and the finalized result is stored. The `std::mutex` in `cmQtAutoGenerator::Logger` is tagged `mutable` and most `cmQtAutoGenerator::Logger` methods become `const`. Outlook ------- This patch provides the framework required to - extract dependencies from `.ui` files in `AUTOUIC`. These will help to address issue #15420 "AUTOUIC: Track uic external inputs". - generate adaptive `make` and `ninja` files in the `_autogen` target. These will help to address issue #16776 "AUTOUIC: Ninja needs two passes to correctly build Qt project". - generate (possibly empty) `moc` and `uic` files for all headers instead of a `mocs_compilation.cpp` file. This will help to address issue #17277 "AUTOMOC: Provide a option to allow AUTOMOC to compile individual " "moc_x.cxx instead of including all in mocs_compilation.cxx"
* Autogen: Factor out concurrency framework to cmWorkerPool classSebastian Holtermann2019-04-151-232/+0
| | | | | | | | | | | | | | | This factors out the concurrency framework in `cmQtAutoGeneratorMocUic` to a dedicated class `cmWorkerPool` which might be reused in other places. `cmWorkerPool` supports fence jobs that require that - all other jobs before in the queue have been processed before the fence job processing gets started, - no jobs later in the queue will be processed before the fence job processing has been completed. Fence jobs are needed where the completion of all previous jobs in the queue is a requirement for further processing. E.g. in `cmQtAutoGeneratorMocUic` the generation of `mocs_compilation.cpp` requires that all previous source file parse jobs have been completed.
* Autogen: Move libuv loop from cmQtAutoGenerator to cmQtAutoGeneratorMocUicSebastian Holtermann2019-04-061-15/+2
| | | | | | | | `cmQtAutoGenerator` automatically started a libuv loop in the constructor. The loop is needed in `cmQtAutoGeneratorMocUic`, but not in `cmQtAutoGeneratorRcc` (anymore). To avoid starting the loop in `cmQtAutoGeneratorRcc`, this patch moves the loop variables and startup code from `cmQtAutoGenerator` to `cmQtAutoGeneratorMocUic`.
* Autogen: Make cmQtAutoGenerator::FileSystem Logger freeSebastian Holtermann2019-04-061-44/+4
| | | | | | | | | | | | `cmQtAutoGenerator::FileSystem` used to have a reference to a `cmQtAutoGenerator::Logger` instances. This was used for utility methods that automatically generated an error message on demand. Unfortunately this resulted in double error messages in some places. To fix these and with the additional purpose of removing the dependency of `cmQtAutoGenerator::FileSystem` to `cmQtAutoGenerator::Logger`, this patch removes the `Logger` reference in `cmQtAutoGenerator::FileSystem`. In the process some silent error conditions gained error messages and some existing error messages were extended.
* Autogen: Move Logger and FileSystem member variables to generator classesSebastian Holtermann2019-04-061-24/+28
| | | | | | | `cmQtAutoGenerator` automatically added `cmQtAutoGenerator::Logger` and `cmQtAutoGenerator::FileSystem` member variables to all inherited classes. This patch moves these members variable declarations to the inherited classes, where needed.
* AutoRcc: Don't use cmQtAutoGenerator::FileSystem methodsSebastian Holtermann2019-04-061-61/+87
| | | | | | `cmQtAutoGenerator::FileSystem` is only required for concurrent file system access, but `cmQtAutoGeneratorRcc` isn't concurrent. Therefore this patch replaces all `cmQtAutoGenerator::FileSystem` uses in `cmQtAutoGeneratorRcc`.
* Autogen: Fix deadlock when uv_spawn() fails while trying to run mocAlexandru Croitor2019-03-251-2/+12
| | | | | | | | | | | | If by some chance the moc executable does not exist while running AUTOMOC, instead of showing an error, the CMake Autogen invocation hangs indefinitely. This happens because UVProcessFinished() is not called if the process does not launch correctly. Make sure to call UVProcessFinished() even if the process launch fails, and also report the error returned by libuv.
* Replace use of CollapseCombinedPath with CollapseFullPathBrad King2019-03-191-3/+3
| | | | | | | | | | | `CollapseCombinedPath` was introduced by commit 551d3343cd (cmDependsC: Collapse relative include paths, 2013-06-19, v2.8.12~237^2) where the existing `CollapseFullPath` should have been used instead. Then its use proliferated slightly. Since `CollapseCombinedPath` is less widely used and less robust (see issue #19049), use `CollapseFullPath` everywhere instead. Issue: #19050
* Autogen: Rename cmQtAutoGen::GeneratorT enum to cmQtAutoGen::GenTSebastian Holtermann2019-02-211-12/+10
|
* Prefer front/back/data over dereferencing begin/rbegin iterArtur Ryt2019-02-061-3/+3
| | | | Changed for sequenced containers: vector, list, string and array
* cmSystemTools: Stdout(),Stderr() accept std::string argumentVitaly Stakhovsky2019-01-201-4/+4
|
* Properties: Add CMAKE_ROLE global propertyKyle Edwards2019-01-171-1/+2
| | | | | This property allows scripts to determine whether they're in project mode, script mode, find-package mode, CTest, or CPack.
* IWYU: Update CMake code for IWYU built with Clang 6Brad King2019-01-151-0/+1
| | | | | IWYU now correctly requires `<utility>` for `std::move`. It also requires a container header when used via a range-based for loop.
* Remove unnecessary c_str() callsVitaly Stakhovsky2018-09-051-2/+2
| | | | Use the new IsOn(),IsOff() overloads.
* Autogen: Add CMAKE_AUTOGEN_VERBOSE variable supportSebastian Holtermann2018-06-211-3/+19
| | | | | Setting CMAKE_AUTOGEN_VERBOSE enables verbose output during AUTOMOC, AUTOUIC and AUTORCC generation.
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-1/+1
| | | | | | | | | | | | 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.
* Autogen: Add lock file to AUTORCC commandsSebastian Holtermann2018-05-301-2/+3
| | | | | By using a per .qrc lock file in AUTORCC, the same `cmake -E cmake_autorcc ...` command can be called concurrently.
* Merge topic 'autogen-protect-cmsys-calls'Brad King2018-04-041-21/+90
|\ | | | | | | | | | | | | | | | | | | | | | | | | b11e2c80b1 Autogen: Print moc/uic/rcc output to stdout 1d2c9d8c6d Autogen: Use std::istreambuf_iterator for file so string reading ccc38fa509 Autogen: Protected calls to cmFilePathChecksum 719b24c872 Autogen: Protected calls to cmQtAutoGen::SubDirPrefix 9a73615815 Autogen: Protected calls to cmSystemTools::GetFilenameWithoutLastExtension 65203ce407 Autogen: Protected calls to cmSystemTools::Split/JoinPath 14a86c9ea7 Autogen: Protected calls to cmSystemTools::CollapseCombinedPath Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1918
| * Autogen: Use std::istreambuf_iterator for file so string readingSebastian Holtermann2018-04-031-20/+29
| | | | | | | | | | | | | | This adds a dedicated mutex for file reading and writing to cmQtAutoGenerator::FileSystem. The purpose of the change is to avoid that long files reads block cmsys based path computations, which are protected by an other mutex.
| * Autogen: Protected calls to cmFilePathChecksumSebastian Holtermann2018-04-031-0/+16
| | | | | | | | | | Closes #17861 Closes #17862
| * Autogen: Protected calls to cmQtAutoGen::SubDirPrefixSebastian Holtermann2018-04-031-0/+7
| |
| * Autogen: Protected calls to cmSystemTools::GetFilenameWithoutLastExtensionSebastian Holtermann2018-04-031-0/+7
| |
| * Autogen: Protected calls to cmSystemTools::Split/JoinPathSebastian Holtermann2018-04-031-0/+23
| |
| * Autogen: Protected calls to cmSystemTools::CollapseCombinedPathSebastian Holtermann2018-04-031-1/+8
| |
* | cmake_minimum_required: Optionally set policies with version rangeBrad King2018-03-211-1/+1
|/ | | | | | | | Teach `cmake_minimum_required` and `cmake_policy(VERSION)` to support a version range of the form `<min>[...<max>]`. Define this to mean that version `<min>` is required, but known policies up to those introduced by `<max>` will be set to `NEW`. This will allow projects to easily specify a range of versions for which they have been updated.
* Autogen: Check if a file is empty before reading itSebastian Holtermann2018-03-061-11/+18
| | | | | | | | | | | Calling `std::string::front()` on an empty string results in an undefined behavior by the C++ standard. In gcc8 it causes an assertion to fail. This adds a check to `AUTOGEN` if a file to read is empty and in case avoids the use of an empty `std::string` buffer. Closes #17793
* Autogen: Process files concurrently in AUTOMOC and AUTOUICSebastian Holtermann2018-01-171-179/+490
| | | | | | | | | | | | | | | | | | | | | | 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.
* Autogen: Fix for problematic nested lists separatorSebastian Holtermann2017-12-181-0/+3
| | | | | | | | | | | | | | | In the AutogenInfo.cmake file the separator for nested lists was `@LSEP@` which led to a speed regression because the `@` character triggered an (unsuccessful) expression evaluation. By setting the policy version of the CMake instance in the `_autogen` target to 3.9, the OLD `@` evaluating behavior controlled by policy CMP0053 is disabled. Also the nested lists separator string is changed to `<<<S>>>`, which solves the problem twofold. Closes #17570
* Autogen: Add and use cmQtAutoGenerator base classSebastian Holtermann2017-11-191-0/+320
Adds the new base class `cmQtAutoGenerator` which contains common variables and methods used by `cmQtAutoGeneratorMocUic` and `cmQtAutoGeneratorRcc`.