summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Ninja
Commit message (Collapse)AuthorAgeFilesLines
* Ninja: Restore detection of msvc-wine showIncludes prefixBrad King2023-05-154-0/+8
| | | | | | | | | | | | | | | Since commit 8f82e755f3 (Ninja: Fix detection of MSVC showIncludes prefix in Italian, 2023-01-26, v3.26.0-rc1~20^2) our regex no longer matches the output from `msvc-wine`, which uses forward slashes: Note: including file: /path/to/foo.h `cl /showIncludes` under Wine prints paths of the form `Z:\path\to\file`, but the `msvc-wine` wrapper converts them to the form `/path/to/file` so that native Ninja can be used. Update our regex to match the prefix followed by a path with a leading forward slash. Fixes: #24908
* Ninja: Restore detection of clang-cl showIncludes prefixYR Chen2023-03-204-0/+8
| | | | | | | | | | | | | | | Since commit 8f82e755f3 (Ninja: Fix detection of MSVC showIncludes prefix in Italian, 2023-01-26, v3.26.0-rc1~20^2) our regex no longer matches the output from `clang-cl`, which uses a relative path, forward slashes, and is always in English [1]: Note: including file: ./foo.h Update the regex to match that too. [1] https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0/clang/lib/Frontend/HeaderIncludeGen.cpp#L102 Co-authored-by: Brad King <brad.king@kitware.com>
* Ninja: Fix detection of MSVC showIncludes prefix in ItalianBrad King2023-01-284-0/+8
| | | | | | The prefix does not have two colons. Update our regex. Fixes: #24357
* Tests: Extend RunCMake.Ninja ShowIncludes cases to cover more languagesBrad King2023-01-2819-0/+50
| | | | Add cases for English, French, German, and Japanese.
* Tests: Generalize RunCMake.Ninja ShowIncludes test infrastructureBrad King2023-01-289-3/+9
| | | | Prepare to add support for more languages.
* Tests: Extend RunCMake.Ninja ShowIncludes case with sample pathBrad King2023-01-274-4/+4
| | | | Verify that the prefix is separated from the path.
* Ninja: Match showIncludes dependencies using console output code pageBrad King2022-10-3010-0/+67
| | | | | | | | | Generalize the fix from commit 37a279f8d1 (Ninja: Write msvc_deps_prefix as UTF-8 when console codepage is UTF-8, 2020-07-31, v3.19.0-rc1~349^2). `cl /showIncludes` output is encoded using the console output code page, so this is the byte sequence that Ninja must use to match its lines. Fixes: #24068
* Merge topic 'ninja-intl-paths' into release-3.25Brad King2022-10-274-0/+22
|\ | | | | | | | | | | | | | | a12050666c Tests: Add case for ninja with non-ascii chars 02a04dd9c7 Ninja: Restore support for non-ascii paths on Windows with ninja<=1.10 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7833
| * Tests: Add case for ninja with non-ascii charsBrad King2022-10-264-0/+22
| | | | | | | | Issue: #24089
* | AUTOMOC: Skip PCH when all sources files skip the PCH file tooCristian Adam2022-10-062-0/+33
|/ | | | Fixes: #23464
* Tests: Add support for testing Qt6Craig Scott2021-10-046-31/+44
| | | | | | | | | | | | The minimum CMake version for Qt6 is 3.16, so all the calls to cmake_minimum_required() are updated here to enforce that minimum. This will avoid any CMake version-related warnings from Qt. Avoid hard-coding Qt5 where the tests could now be using Qt5 or Qt6. Fixes: #22188
* Tests/RunCMake/Ninja.*: Sanitize NINJA_STATUS since we expect default behaviorNAKAMURA Takumi2021-06-281-0/+3
| | | | FYI, NINJA_STATUS is "[%f/%t] " by default.
* Ninja: Always compile sources using absolute pathsBrad King2021-05-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Ninja generator traditionally referenced source files and include directories using paths relative to the build directory if they could be expressed without a `../` sequence that leaves the build and source directories. For example, when using a `build/` directory inside the source tree, sources would be compiled as `-c ../src.c` and include directories would be referenced as `-I ../include`. This approach matches the traditional Ninja convention of using relative paths whenever possible, but has undesirable side effects such as: * Compiler diagnostic messages may not use absolute paths, making it harder for IDEs/editors to find the referenced sources or headers. * Debug symbols may not use absolute paths, making it harder for debuggers to find the referenced sources or headers. * Different results depending on the path to the build tree relative to the source tree. * Inconsistent with the Makefile generators, which use absolute paths. Switch to always using absolute paths to reference source files and include directories on compiler command lines. While alternative solutions for diagnostic messages and debug symbols may exist with specific tooling, this is the simplest and most consistent approach. Note that a previous attempt to do this in commit 955c2a630a (Ninja: Use full path for all source files, 2016-08-05, v3.7.0-rc1~275^2) was reverted by commit 666ad1df2d (Revert "Ninja: Use full path for all source files", 2017-02-24, v3.8.0-rc2~9^2) due to problems hooking up depfile dependencies on generated files. This time, the changes in commit 2725ecff38 (Ninja: Handle depfiles with absolute paths to generated files, 2021-05-19) should avoid those problems. Fixes: #13894, #17450
* Genex: add_custom_command: DEPFILE supports genexMarc Chevrier2021-04-123-3/+19
| | | | | | This facility is very useful for 'Ninja Multi-Config' and required as well for future support of DEPFILE in 'Xcode' and 'Visual Studio' generators (#20286).
* Tests: Add test for Ninja automoc dependency cyleKyle Edwards2021-03-295-14/+45
|
* Merge topic 'autogen-cmp0116-fix' into release-3.20Brad King2021-02-242-0/+3
|\ | | | | | | | | | | | | | | | | | | | | 339dbc901f Help: Note that CMP0116 is recorded at the time of CC creation e3740e020e Tests: Test Qt autogen target with CMP0116 set to WARN cf34011ce7 Tests: Test per-CC behavior of CMP0116 3a95503512 Ninja: Use CMP0116 status recorded at time of custom command's creation f01f10e8fb cmCustomCommand: Record value of CMP0116 at time of creation Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5848
| * Tests: Test Qt autogen target with CMP0116 set to WARNKyle Edwards2021-02-232-0/+3
| |
* | Merge topic 'ninja-status-stderr' into release-3.20Brad King2021-02-241-0/+2
|\ \ | |/ |/| | | | | | | | | d33c2c93d8 Tests: Update for upstream ninja change to write status on stderr Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5850
| * Tests: Update for upstream ninja change to write status on stderrBrad King2021-02-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Upstream ninja commit `ad3d29fb53` (Put builder output through status interface) from ninja PR 1899 changed the status output from stdout to stderr. In particular, `ninja: no work to do` is now printed on stderr. Update our RunCMake tests to accept this difference. A few RunCMake test cases check for `ninja: no work to do`. For those, move the message to stdout using `RunCMake_TEST_OUTPUT_MERGE`. The rest of the test cases do not care about the message, so remove it from the actual stderr content before comparing against that expected.
* | AutoGen: Account for CMP0116 in the depfileKyle Edwards2020-12-084-2/+22
| | | | | | | | Fixes: #21467
* | GENERATED prop: Set CMP0118 to NEW for some (unrelated) testsDeniz Bahadir2020-11-241-1/+1
| | | | | | | | | | | | * Adjusting the (unrelated) RunCMake.Ninja test to set CMP0118 to `NEW`. * Adjusting the (unrelated) RunCMake.FileAPI test to set CMP0118 to `NEW`.
* | GENERATED prop: Check CMP0118 policy and warn in certain situationsDeniz Bahadir2020-11-241-0/+1
|/ | | | | | | | | | | | | | * Adding tests for CMP0118 being unset (aka set to `WARN`). * Adjusting the (unrelated) RunCMake.CMP0026 test to set CMP0118 to `NEW`, * Adjusting the (unrelated) RunCMake.Ninja test to set CMP0118 to `OLD`. * Adjusting the (unrelated) RunCMake.FileAPI test to set CMP0118 to `OLD`. Note: Setting CMP0118 to `NEW` and modifying the `GENERATED` property with `set_property` or `set_source_files_properties` will currently NOT set that property because the implementation is still to come.
* Tests: Pass additional Qt information to Ninja and NMC testsKyle Edwards2020-09-011-0/+1
|
* Merge branch 'backport-3.17-automoc_timestamp_deps'Brad King2020-08-055-0/+53
|\
| * AutoGen: Add test to check for correct AutoMoc dependenciesAlexandru Croitor2020-08-035-0/+53
| | | | | | | | | | | | When using Qt 5.15.0 or above together with Ninja, check that touching a source file of a dependency does not needlessly re-run AUTOMOC for the dependee target.
* | Merge branch 'master' into ninja-order-only-fixKyle Edwards2020-04-239-0/+30
|\ \ | |/ |/|
| * Ninja: On Windows, select the compiler occurring first in PATHBrad King2020-04-229-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Windows, toolchains like MSVC require a set of environment variables to be configured for the compiler to work correctly. The scripts that prepare these environments typically put the compiler's directory ahead of others in the `PATH`. Teach the Ninja generators to use this as a heuristic to select the compiler when none is explicitly specified. This is not necessary with Makefile generators because each toolchain's environment comes with its own make tool variant, and the corresponding Makefile generator (e.g. "NMake Makefiles") automatically implies the matching compiler. Fixes: #20585
* | Ninja: Remove config suffix from order-only targetKyle Edwards2020-04-232-0/+21
|/ | | | Fixes: #20621
* Tests: Fix RunCMake.Ninja test for Ninja 1.10Brad King2020-01-271-0/+1
| | | | | | | With Ninja 1.10 we run the cleandead and recompact tools after generation. These require that `build.ninja` be loadable. Update the `CustomCommandJobPool` case to define the referenced job pools to make `build.ninja` loadable.
* Ninja: Add multi-config variantKyle Edwards2019-12-131-0/+3
| | | | Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
* Tests: fix failures with gnu mode clang on windowsZsolt Parragi2019-05-242-0/+2
| | | | | | | | | Root causes were: * Using incorrect conditions (assuming MSVC-like command line mode) * Trying to compile the MSVC STL in C++11 mode, when parts of it require C++14 or enabling MS extensions in clang. * Missing flush in a testcase using stdout in a dll and a main part with static crt
* Support job pools in custom commands and targetsRosen Matev2019-05-146-0/+39
| | | | | | | | | | Provide a way for custom commands and targets to set the pool variable of the ninja build statement. Setting `JOB_POOL` is not compatible with `USES_TERMINAL`, which implies the `console` pool. The option is silently ignored with other generators. Closes: #18483
* cmake: Add tests for verbose output to --build modeRobert Maynard2019-01-284-0/+14
|
* configure_file: canonicalize input and output path in dependenciesFrank Benkstein2018-11-133-0/+13
| | | | | | | | | | | | | | | | Represent the input file path internally in canonical form. Otherwise multiple `configure_file` calls that share the same input file but specify it relative to different directories (e.g. via `../`) result in multiple copies of the dependency on the rule to re-run CMake. This causes the Ninja generator to emit duplicate phony build statements for these dependencies, which generates an error with `-w dupbuild=err`, which will be default in Ninja 1.9. Also canonicalize the output path for consistency. Add a test case. Fixes: #18584
* Add deprecation warnings for policies CMP0063 and belowBrad King2018-09-172-0/+20
| | | | | | The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for some policies to encourage projects to port away from setting policies to OLD.
* Tests: Extend RunCMake.Ninja filesystem delaysBrad King2018-09-121-4/+5
| | | | | | On filesystems with 1s resolution the `run_sub_cmake` cases fail occasionally when the 1 second sleep does not cause files to have a different time. Use 3 seconds instead.
* Ninja: Fix dupbuild error skipping alias with conflicting custom commandJean-Christophe Fillion-Robin2018-08-092-0/+48
| | | | | | See-also: https://issues.slicer.org/view.php?id=4595 Reported-by: Isaiah Norton <inorton@bwh.harvard.edu>
* Ninja: Avoid empty phony edges for target orderingBrad King2018-04-263-0/+12
| | | | | | | | | | | | | | | | Since commit v3.9.0-rc1~230^2~2 (ninja: break unnecessary target dependencies, 2017-04-17) we unconditionally generate a phony edge for target ordering. It is needed in case a later target depends on it. However, if the phony edge has no inputs then `ninja -d explain` prints: ninja explain: output ... of phony edge with no inputs doesn't exist Furthermore the phony edge's output is considered dirty and can cause dependents to be incorrectly considered dirty. Avoid this by always generating at least one input to the target ordering phony edges. If we have no real dependencies just use a path that always exists. Fixes: #17942
* Ninja: Fix Fortran support with response filesBrad King2018-04-054-0/+12
| | | | | | | | | | The Ninja generator splits preprocessing and compilation steps for Fortran. Fix this logic to work when using response files for compilation so that it works for the preprocessing step too. This fixes behavior under `CMAKE_NINJA_FORCE_RESPONSE_FILE`. Issue: #17877
* Ninja: Fix command concatenation on WindowsBernhard Burgermeister2017-05-092-0/+24
| | | | | | | | | | | Put commands that contain `||` into brackets to avoid early abort of execution by `cmd.exe` because `||` has higher precedence than `&&` in `cmd.exe`. Add test to check for command execution after `||` as part of a parameter and as command separator. Fixes: #16850
* RunCMake.Ninja: add a test for assumed sourcesBen Boeckel2017-04-212-0/+36
| | | | | This is a dark corner of the Ninja generator. It should be fixed in the future, but add a test which shows its behaviors.
* ninja: break unnecessary target dependenciesBen Boeckel2017-04-214-0/+54
| | | | | | | | | | | | | | | | | | Previously, given two libraries, X and Y where X depends on Y, all object compilations of X would require the Y library to have been linked before being compiled. This is not necessary and can instead be loosened such that object compilations of X only depend on the order-only dependencies of Y to be completed. This is to ensure that generated sources, headers, custom commands, etc. are completed before X starts to compile its objects. This should help build performance in projects with many libraries which cause a deep library dependency chain. Previously, a library at the bottom would not start compilation until after all other libraries completed, but now only its link step needs to wait and its compilation jobs can be run in parallel with other tasks. Fixes: #15555
* RunCMake.Ninja: support passing arguments when running ninjaBen Boeckel2017-04-211-1/+1
|
* Ninja: Use binary dir for `$subdir/all` targetsAlexis Murzeau2016-10-246-0/+19
| | | | | | | | | | The targets added by commit v3.6.0-rc1~240^2~2 (Ninja: Add `$subdir/all` targets, 2016-03-11) use as `$subdir` the relative path from the top of the source tree to the current source directory. This is not correct when using `add_subdirectory(test test_bin)`. Instead we need to use the relative path from the top of the binary tree to the current binary directory as was done for related targets by commit v3.7.0-rc1~268^2 (Ninja: Add `$subdir/{test,install,package}` targets, 2016-08-05).
* Ninja: Fail early on when ninja build tool does not runBrad King2016-10-204-0/+13
| | | | | | | | Diagnose failure to run `ninja --version` and abort early. Otherwise we end up aborting with a confusing message about ninja version "" being too old. Closes: #16378
* add_custom_command: Add DEPFILE option for NinjaKulla Christoph2016-08-303-0/+18
| | | | | | | | Provide a way for custom commands to inform the ninja build tool about their implicit dependencies. For now simply make use of the option an error on other generators. Closes: #15479
* Ninja: Add `$subdir/{test,install,package}` targetsBrad King2016-08-095-0/+17
| | | | | | | | | | | | | With the Makefile generator one can use `cd $subdir; make install` to build and install targets associated with a given subdirectory. This is not possible to do with the Ninja generator since there is only one `build.ninja` file at the top of the build tree. However, we can approximate it by allowing one to run `ninja $subdir/install` at the top of the tree to build the targets in the corresponding subdirectory and install them. This also makes sense for `test`, `package`, and other GLOBAL_TARGET targets. It was already done for `all` by commit v3.6.0-rc1~240^2~2 (Ninja: Add `$subdir/all` targets, 2016-03-11).
* Tests: Select RunCMake.Ninja test cases based on ninja versionBrad King2016-05-181-0/+20
| | | | | Some test cases need features not available in Ninja < 1.6, so check the version before running them.
* Ninja: Support embedding of CMake as subninja projectNicolas Despres2016-05-1721-0/+308
| | | | | | Add a `CMAKE_NINJA_OUTPUT_PATH_PREFIX` variable. When it is set, CMake generates a `build.ninja` file suitable for embedding into another ninja project potentially generated by an alien generator.
* Ninja: Add test for `$subdir/all` targetsBrad King2016-03-224-0/+21
|