1. 04 Dec, 2022 1 commit
    • Jason Haslam's avatar
      automoc: Remove existing output file before invoking moc · 318ec075
      Jason Haslam authored
      Remove the output file before invoking moc in case the case of source file has
      changed on disk. Recent versions of clang warn when the case of the include
      directive (which does change) doesn't match the case of the file on disk.
      318ec075
  2. 07 Sep, 2022 1 commit
    • Brad King's avatar
      automoc: revert attempts to silence linker warning on macos · e08d34ed
      Brad King authored
      We've made several attempts to add a dummy symbol to `mocs_compilation.cpp`
      when there are no automoc sources:
      
      * commit 4a9daae4 (automoc: silence linker warning on macos,
                           2022-05-25, v3.24.0-rc1~55^2)
      * commit 844244cc (automoc: avoid compiler warnings in linker-warning-
                           silencing code, 2022-08-10, v3.24.1~6^2)
      * commit fc862838 (automoc: avoid more compiler warnings in linker-
                           warning-silencing code, 2022-08-29)
      
      The last attempt derives a symbol name from the path to the source
      file, but that breaks reproducible builds because it is not stable
      w.r.t. the location of the build tree.  Revert all these attempts
      for the 3.24 release series, and return to what 3.23 and below did.
      Further investigation will be needed to resolve the original issue.
      
      Fixes: #23937
      Issue: #23551, #23823, #23823
      e08d34ed
  3. 30 Aug, 2022 1 commit
  4. 10 Aug, 2022 1 commit
  5. 13 Jun, 2022 1 commit
  6. 01 Jun, 2022 1 commit
    • Tim Blechmann's avatar
      automoc: silence linker warning on macos · 4a9daae4
      Tim Blechmann authored
      when an empty `mocs_compilation.cpp` is included in a static library,
      the macos linker emits a warning:
      ```
      /Applications/Xcode13.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
      file: path/To/Library.a(mocs_compilation.cpp.o) has no symbols
      ```
      
      we therefore generate a globally visible weak symbol in the form of a
      virtual function table
      4a9daae4
  7. 26 Apr, 2022 1 commit
  8. 05 Oct, 2021 1 commit
    • Craig Scott's avatar
      AUTOUIC: Fix merging of --blah options not being detected for Qt6 · 2a311679
      Craig Scott authored
      When merging a new set of uic options with a base set of options,
      such as when a source file has a non-empty AUTOUIC_OPTIONS
      property, the test for whether to support options starting with
      two hyphens was only testing if the Qt major version was exactly
      5 rather than at least 5. That had the effect of preventing such
      options from being merged correctly when using Qt6, so new and
      base options would both be present instead of the single merged
      option from the source file properties. Update the version check
      and rename function arguments to avoid misrepresenting what
      they mean.
      
      Note that uic accepts long option names with a single hyphen too.
      See Qt docs for QCommandLineParser::ParseAsLongOptions
      for confirmation.
      2a311679
  9. 28 Sep, 2021 1 commit
  10. 19 Aug, 2021 1 commit
  11. 23 Jul, 2021 1 commit
    • Alexey Edelev's avatar
      AUTOUIC: Fix generating of dependency rules for UI header files · e5ec0e52
      Alexey Edelev authored
      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
      e5ec0e52
  12. 19 Jul, 2021 1 commit
    • Alexey Edelev's avatar
      AUTOUIC: Fix cyclic dependency between generated UI headers and timestamp · 9cebdbec
      Alexey Edelev authored and Brad King's avatar Brad King committed
      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 1265c65b (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
      9cebdbec
  13. 28 Apr, 2021 1 commit
  14. 15 Apr, 2021 1 commit
    • Kyle Edwards's avatar
      autogen: fix race in depfile parsing · 53d523f2
      Kyle Edwards authored
      cmReadGccDepfile() calls cmSystemTools::CollapseFullPath(), which
      is not thread safe due to internal caching. Serialize calls to
      cmReadGccDepfile() in autogen to avoid thread safety issues.
      
      Fixes: #22014
      53d523f2
  15. 29 Mar, 2021 1 commit
  16. 22 Feb, 2021 1 commit
    • Craig Scott's avatar
      Autogen: Don't change the order of HEADERS array in AutogenInfo.json · a3df25c6
      Craig Scott authored
      Qt6 reads our internal AutogenInfo.json file. In 92d7b456
      (Autogen: Add support for per-config sources, 2020-10-20), the
      ordering of the HEADERS array elements was changed and this
      broke their cmake_automoc_parser. We don't need to change the
      order of the array elements, we can append to the existing ones
      instead. Do this to allow their cmake_automoc_parser to continue
      to work.
      
      Fixes: #21823
      a3df25c6
  17. 15 Feb, 2021 1 commit
    • Alexey Edelev's avatar
      AUTOUIC: Fix missed ui files in Ninja deps · 4f577d9f
      Alexey Edelev authored
      This fixes the issue when two .ui files have the same name,
      but different locations. In this case, Ninja deps file only
      contains .ui file that was found first. So <src>/xxx/yyy.ui
      and <src>/yyy.ui were processed as a same file by AUTOUIC.
      4f577d9f
  18. 27 Jan, 2021 3 commits
  19. 06 Jan, 2021 1 commit
    • Jörg Bornemann's avatar
      AutoMoc: Re-run after adding Q_OBJECT macro · 8cb8dd6d
      Jörg Bornemann authored
      Consider a Qt project with a header file that does not contain the
      Q_OBJECT macro. Adding the Q_OBJECT macro is supposed to trigger a run
      of moc.
      
      When using Qt >= 5.15 and the Ninja generator, re-running AutoMoc is
      controlled by the contents of a Ninja depfile.  In the situation above,
      AutoMoc would not re-run, because the header/source files without
      Q_OBJECT macro are not contained in the depfile.
      
      Add the relevant source files of the project to the merged depfile to
      re-run AutoMoc whenever a source file changes.
      
      Fixes: #21620
      8cb8dd6d
  20. 05 Jan, 2021 1 commit
  21. 16 Dec, 2020 1 commit
  22. 13 Oct, 2020 1 commit
  23. 09 Sep, 2020 1 commit
    • Jörg Bornemann's avatar
      AutoMoc: Re-run moc if a dependency is missing · 9ac3503d
      Jörg Bornemann authored
      AutoMoc uses the moc-emitted dependency file of Qt 5.15 to track
      dependencies. Such a dependency may well live outside the project and
      can vanish, for example when installing a new compiler version.
      
      This situation was detected before, but merely a warning was issued.
      Now, we're considering a generated file as out of date if a dependency
      is missing and re-generate it.
      
      We also have to remove the missing dependency from the ParseCache.
      Otherwise the AUTOMOC target for all generators other than Ninja will
      always be out of date.
      
      The ParseCacheChanged flag had to be made atomic, because we're
      potentially accessing it from multiple threads. The dependencies vector
      itself is not vulnerable in this regard, because there's one vector per
      file, and we're accessing exactly one ParseCacheT::FileHandleT per thread.
      
      Fixes: #21136
      9ac3503d
  24. 31 Aug, 2020 1 commit
    • Jörg Bornemann's avatar
      AutoMoc: Restore support for re-running after project file changes · 6b20bbd2
      Jörg Bornemann authored and Brad King's avatar Brad King committed
      For Qt >= 5.15.0 and Ninja generators AutoMoc creates a depfile to let
      Ninja decide when to run AutoMoc.  This was introduced by commit aebfbcaa
      (AutoGen: Use depfiles for the XXX_autogen ninja targets, 2020-01-14,
      v3.17.0-rc1~58^2).
      
      However, AutoMoc was not triggered after adding a new moc-able file to
      the project. This patch adds the project file (and potentially included
      files) to the dependencies in the depfile.
      
      Now, a re-run of AutoMoc is triggered if the project file changes.
      
      Fixes: #21127
      6b20bbd2
  25. 03 Aug, 2020 1 commit
    • alcroito's avatar
      AutoGen: Fix over-specified direct dependencies of custom command · a79056bb
      alcroito authored
      The AutoMoc timestamp creating custom command explicitly depended
      on all dependencies of the origin target (associated to the AutoGen
      target).
      
      When an origin target depended on a shared library 'libfoo.so',
      if it was re-linked, the AutoMoc custom command would touch its
      output timestamp file, and thus cause needless rebuilding of sources,
      despite the shared library not having any influence on the AutoMoc
      generated files.
      
      Introduce a new '<target>_autogen_timestamp_deps' utility target,
      which will serve as an 'order-only' dependency for the custom command.
      
      This will prevent needless rebuilding, because touching 'libfoo.so'
      will not cause the custom command to be re-executed.
      
      The new AutoMoc dependency tree looks like:
          '_autogen_timestamp_deps (serves as order-only dep)'
       <- '<target_autogen>/timestamp' file ( + moc deps file)
       <- '<target>_autogen' target.
      
      Fixes: #21020
      a79056bb
  26. 07 May, 2020 1 commit
  27. 24 Mar, 2020 1 commit
    • Alex Turbov's avatar
      Refactor: Avoid `std::endl` where it's not necessary (part 2) · 1e4b5c7d
      Alex Turbov authored
      The `std::endl` manipulator, except inserting `\n` character, also
      performs `os.flush()`, which may lead to undesired effects (like
      disk I/O in the middle of forming data strings). For the
      `std::stringstream` it also has no meaning.
      
      * replace multiple `operator<<` calls on a string literal w/
        the only call and the only (bigger) string literal;
      * replace one character string literal used in `operator<<`
        w/ a char literal.
      1e4b5c7d
  28. 28 Jan, 2020 2 commits
    • Jörg Bornemann's avatar
      AutoGen: Use depfiles for the XXX_autogen ninja targets · aebfbcaa
      Jörg Bornemann authored and Brad King's avatar Brad King committed
      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
      aebfbcaa
    • Jörg Bornemann's avatar
      AutoGen: Use moc's feature to output dependencies · f765fdea
      Jörg Bornemann authored and Brad King's avatar Brad King committed
      In Qt version 5.15.0 moc learned to output the dependencies
      of the generated file.
      
      This commit enhances JobCompileMocT to read the dependency file
      written by moc. The dependencies are stored in the same cache that's
      used for the dependencies determined by dependency filters.
      
      The dependency filter functionality is turned off if moc's dependency
      output feature is used.
      
      Fixes: #17750
      Fixes: #19058
      f765fdea
  29. 17 Dec, 2019 1 commit
  30. 30 Oct, 2019 1 commit
  31. 01 Oct, 2019 1 commit
  32. 28 Sep, 2019 2 commits
  33. 25 Sep, 2019 1 commit
    • Sebastian Holtermann's avatar
      Autogen: Use JSON instead of CMake script for info files · d867e058
      Sebastian Holtermann authored and Brad King's avatar Brad King committed
      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
      d867e058
  34. 20 Sep, 2019 1 commit
    • Marc Chevrier's avatar
      cmstd: Modernize CMake system headers · c688b401
      Marc Chevrier authored and Brad King's avatar Brad King committed
      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
      c688b401
  35. 16 Sep, 2019 2 commits
    • Sebastian Holtermann's avatar
      Autogen: Add moc path prefix generation (AUTOMOC_PATH_PREFIX) · d018d27c
      Sebastian Holtermann authored
      The new `AUTOMOC_PATH_PREFIX` boolean target property enables automatic
      generation of the path prefix `-p` option for `moc`.
      `AUTOMOC_PATH_PREFIX` is initialized from the variable
      `CMAKE_AUTOMOC_PATH_PREFIX`, which is ON by default.
      
      When `AUTOMOC_PATH_PREFIX` is enabled, CMake tests if a `moc`ed header file is
      in one of the include directories.  If so, then the `-p` option, with the
      relative path of the header parent directory to the respective include
      directory, is added to the `moc` command.  If the header file is not in an
      include directory, the `-p` option is omitted.
      
      Closes: #18815 "AUTOMOC: generated files include full relative path,
                      breaking certain reproducible builds"
      d018d27c
    • Sebastian Holtermann's avatar
      77983c81