summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenInitializer.h
Commit message (Collapse)AuthorAgeFilesLines
* AutoGen: Retrieve Qt version from moc as fallbackJoerg Bornemann2021-04-231-2/+4
| | | | | | | | | | | | Consider the case where the find_package call for QtCore is wrapped in a function call. Then AutoGen cannot determine the Qt version, because it only looks at variables and directory properties. The former don't leave the function scope and the latter are not set by default. As a fallback, locate the moc executable via its target and call it with the --version argument to determine the Qt version. Issue: #22028
* Autogen: Add detection of UI file changes to the pre-build VS caseDuncan Barber2021-04-101-0/+1
| | | | | | | This is achieved by adding a rule file which carries the UI files as dependencies but performs no meaningful command. Its output path points to a timestamp file which is instead touched by the pre-build command that runs autogen. The rule file therefore triggers the build if any of the files have been changed more recently than the last autogen run. Fixes: #17959 Fixes: #18741
* Autogen: Move duplicated filename generation code into a functionDuncan Barber2021-04-101-0/+2
|
* Autogen: Rename the variable for UI files with UIC optionsDuncan Barber2021-04-101-1/+1
| | | | Monitoring for UI file changes in the target sources will require keeping track of the files without options as well so this will improve clarity.
* AUTOUIC: Collect ui header files for Ninja generatorAlexey Edelev2021-02-231-0/+2
| | | | | | | | | | | | | | | | The '<user target>_autogen/timestamp' target supposed to generate ui header files using the 'uic'. Ninja must have information about these header files as a result of generating. The fix collects .ui files of the user target and generates a list of the ui headers that need to be added to the generating results of the '<user target>_autogen/timestamp' target. The case when the .ui files are not specified and collected by AUTOUIC from the include directives of the project source files is not covered in this patch. Fixes: #16776
* clang-tidy: fix `readability-redundant-access-specifiers` warningsBen Boeckel2021-01-271-2/+0
|
* Autogen: Add support for per-config sourcesBrad King2020-12-161-1/+6
| | | | Fixes: #20682
* Modernize: Use #pragma once in all header filesKitware Robot2020-09-031-4/+1
| | | | | | | | | | | | | | | | #pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6 enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
* AutoGen: Use depfiles for the XXX_autogen ninja targetsJoerg Bornemann2020-01-281-0/+2
| | | | | | | | | | | | | | | The XXX_autogen targets are implemented as utility commands, which means they always run, even if there weren't any changes. For the Ninja generator and Qt >= 5.15 we're taking a different approach: This commit adds custom commands that create XXX_autogen/timestamp files. Those custom commands have a depfile assigned that is generated from the depfiles that were created by moc. The XXX_autogen targets merely wrap the XXX_autogen/timestamp custom commands. Fixes: #18749
* Merge topic 'autogen_rcc_skip_unity'Brad King2020-01-201-4/+5
|\ | | | | | | | | | | | | | | 086d9b2bab Autogen: Enable SKIP_UNITY_BUILD_INCLUSION on AUTORCC generated files Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Cristian Adam <cristian.adam@gmail.com> Merge-request: !4237
| * Autogen: Enable SKIP_UNITY_BUILD_INCLUSION on AUTORCC generated filesSebastian Holtermann2020-01-171-4/+5
| | | | | | | | | | | | | | | | | | | | `rcc` generated files are not compatible with unity builds, because they contain classes in anonymous namespaces and static data with identical names. This patch sets the source file property `SKIP_UNITY_BUILD_INCLUSION` to `On` on all `AUTORCC` generated files to exclude them from unity build files. Fixes: #20191 "QT5: Exclude resource files from unity build"
* | Autogen: Process .hh headers based on new policy CMP0100 settingsSebastian Holtermann2020-01-041-0/+3
|/ | | | | | | Reintroduces .hh header processing in AUTOMOC and AUTOUIC based on the new policy CMP0100 setting. Fixes: #13904 CMAKE_AUTOMOC misses headers with ".hh" extension
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-4/+5
| | | | | 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: Use JSON instead of CMake script for info filesSebastian Holtermann2019-09-251-58/+56
| | | | | | | | | | | | | | | | | | | | | | | 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
* Autogen: Variable renames and cleanupsSebastian Holtermann2019-09-251-30/+29
|
* 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: Use CollapseFullPath instead of RealPath to support symbolic linksSebastian Holtermann2019-09-161-1/+1
|
* Autogen: Compute and store generator pointers once in initializer constructorSebastian Holtermann2019-09-161-5/+11
|
* clang-tidy: Replace typedef with usingRegina Pfeifer2019-09-031-1/+1
|
* Autogen: Use cm::string_view for AUTO{MOC,UIC,RCC} generator namesSebastian Holtermann2019-08-271-2/+2
| | | | | - Store `AUTO{MOC,UIC,RCC}` generator name as `cm::string_view` - Use `std::initializer_list` instead of `std::array`
* Autogen: Modernize code to use cm::string_view for the info writerSebastian Holtermann2019-08-071-8/+9
|
* IWYU: Fix handling of <memory> standard headerBrad King2019-07-101-1/+1
| | | | | | | | 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: Evaluate compiler features for the same exectuable only onceSebastian Holtermann2019-05-221-3/+2
| | | | | | | 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`.
* Autogen: Use ADDITIONAL_CLEAN_FILES target property for file cleaningSebastian Holtermann2019-05-151-0/+1
| | | | | | | | | | The `ADDITIONAL_CLEAN_FILES` target property works on multiple generators to remove addition files at the clean target. In `AUTOGEN` use it instead of the deprecated and limited `ADDITIONAL_MAKE_CLEAN_FILES` directory property to remove `AUTOGEN` generated files. Fixes: #17074 "Autogen: clean target with ninja generator doesn’t clean autogen files"
* Autogen: Refactor AUTOMOC and AUTOUIC and add source file parse data cachingSebastian Holtermann2019-05-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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"
* AutoRcc: Use cmQtAutoGen::RccLister in initializer and generatorSebastian Holtermann2019-04-061-4/+0
| | | | | | | Both classes `cmQtAutoGenInitializer` and `cmQtAutoGeneratorRcc` had different implementations for reading the files list from a `.qrc` resources file. This patch replaces both implementations with the common simple `cmQtAutoGen::RccLister` implementation.
* Autogen: Remove lowercase generator name from generator variables classSebastian Holtermann2019-04-021-11/+5
| | | | | The lowercase `Auto*` generator name in `cmQtAutoGenInitializer::GenVarsT` is never user. Remove it from the class.
* Autogen: Fallback on internal qrc parser when RCC isn't built yetAlexandru Croitor2019-03-041-0/+1
| | | | | | | | | | | When building a Qt project, the AUTORCC functionality, by default, uses the rcc binary to get the contents of a qrc file for dependency information. This is done at CMake "generate" time. The problem is that while configuring Qt itself, the rcc binary is not built yet. In that case, to get the contents of the qrc file, fall back to the code branch which uses an ifstream instead of the rcc binary.
* Autogen: Use more readable variable names for static const AUTO* stringsSebastian Holtermann2019-02-261-6/+6
|
* Autogen: Refactor file lists computationSebastian Holtermann2019-02-251-6/+28
| | | | | | | In AUTOGEN this replaces simple file name lists with two list (for headers and sources) of structs with file name and file flags. The file name lists that are passed to the _autogen target via AutogenInfo.cmake are filtered from these two lists.
* Autogen: Refactor cmQtAutoGenInitializer::AddGeneratedSource methodSebastian Holtermann2019-02-211-1/+4
| | | | | In AUTOGEN pass the abstract cmQtAutoGenInitializer::GenVarsT to methods to identify the generator (moc/uic/rcc).
* Autogen: Refactor Qt executable name computationSebastian Holtermann2019-02-211-17/+42
| | | | | | In AUTOGEN a common new base class cmQtAutoGenInitializer::GenVarsT for mo/uic/rcc generator variables allows to generalize variable computation functions.
* Autogen: Rename cmQtAutoGen::GeneratorT enum to cmQtAutoGen::GenTSebastian Holtermann2019-02-211-1/+1
|
* Autogen: Use output caching GetExecutableTestOutputSebastian Holtermann2019-02-191-0/+4
| | | | | | | Use the output caching cmQtAutoGenGlobalInitializer::GetExecutableTestOutput method to avoid identical calls to moc, uic and rcc. Closes #18947
* cleanup: Prefer compiler provided special member functionsRegina Pfeifer2019-01-251-3/+0
|
* clang-tidy: Use `= default`Regina Pfeifer2019-01-251-1/+1
| | | | | | Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and `Source/cmUVHandlePtr.h` where a few older compilers require a user-defined default constructor (with `{}`).
* Autogen: Prepend instead of append `mocs_compilation.cpp` to the sources listSebastian Holtermann2019-01-181-1/+2
| | | | | | | | | | | | | | `mocs_compilation.cpp` easily takes a long time to compile when it contains multiple `moc` files. When it was appended like before we ran into the situation that all smaller sources were already compiled when `mocs_compilation.cpp` got compiled at last. In that case a single core was busy but all remaining cores stayed idle. To optimize CPU core utilization we now prepend `mocs_compilation.cpp` to the sources list instead of appending it. This allows smaller source files to get compiled *while* the long lasting `mocs_compilation.cpp` gets compiled. Closes #18793
* Autogen: Adaptive missing Qt warningSebastian Holtermann2019-01-151-1/+4
| | | | | This makes the warning message for a missing Qt use the requested Qt version in the message text.
* clang-tidy: Use default member initializationRegina Pfeifer2018-12-151-7/+3
|
* Mark operator bool explicitRegina Pfeifer2018-11-191-1/+1
|
* Autogen: Add and use cmQtAutoGenInitializer::InfoWriter classSebastian Holtermann2018-11-141-6/+41
| | | | | | | | | The new ``cmQtAutoGenInitializer::InfoWriter`` class provides an interface to write strings/vectors/sets/maps in CMake format into a file. Its use replaces various `cmJoin` calls that failed to address escaping of semicolons in list elements. Closes #18554
* Autogen: Add support for global ``autogen`` and ``autorcc`` targetsSebastian Holtermann2018-11-111-2/+8
| | | | | | | | | | | | | | This teaches CMake the variables - CMAKE_GLOBAL_AUTOGEN_TARGET - CMAKE_GLOBAL_AUTOGEN_TARGET_NAME - CMAKE_GLOBAL_AUTORCC_TARGET - CMAKE_GLOBAL_AUTORCC_TARGET_NAME which control the generation of global ``autogen`` and ``autorcc`` targets. Closes #17721
* Autogen: Add (CMAKE_)AUTOGEN_ORIGIN_DEPENDS supportSebastian Holtermann2018-11-031-0/+1
| | | | | | | | | | | | | | | This adds - the variable ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` which initializes - the target property ``AUTOGEN_ORIGIN_DEPENDS`` which controls whether or not the origin target dependencies should be forwarded to the corresponding ``_autogen`` target. The default value of ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` is ``ON`` which corresponds to the behavior that is in place since CMake 3.9. Closes: #18493
* Autogen: Use integers to store the Qt versionSebastian Holtermann2018-08-131-12/+4
|
* Autogen: Initializer: Group variables in structsSebastian Holtermann2018-08-131-23/+35
|
* Autogen: Split initializer main methodSebastian Holtermann2018-07-301-6/+21
|
* Autogen: Compute variables in Init stage instead of Setup stageSebastian Holtermann2018-07-301-6/+8
|
* Autogen: Move info file write code into methodsSebastian Holtermann2018-07-301-0/+3
|
* Autogen: Pass absolute include path in info fileSebastian Holtermann2018-07-301-0/+2
|
* Autogen: Wrap moc/uic/rcc related variables in structsSebastian Holtermann2018-07-111-20/+29
|