Browse mode requires a number of POSIX features to be available.
This commit adds configure-time checks that the 'unistd.h' header is
available and that the `inline.sh` script executes successfully. If the
checks pass then browse mode is enabled.
Previously the script would generate some output and return a zero
error code, even if the calls to `od` or `sed` failed.
This change ensures that:
- If `od` or `sed` fail then the script will fail.
- Output will only be written on success.
Fixes ninja-build/ninja#1822, fixes ninja-build/ninja#1853
Adds support for `ninja -t browse` to CMake builds.
The platform support logic is copied from configure.py, so Windows,
Solaris and AIX are treated as 'unsupported' platforms. All other
platforms are assumed to be supported.
As discussed in #1853, when built via CMake the `ninja` executable
looks for a binary called `python` in the current path, in order to
launch the "browse" mode. The behaviour differs from that of the
configure.py script, which looks for a python executable that has the
*same name* as the python executable that invoked the configure script.
`configure.py` assumes `g++` is present on the system, which is not the case, e.g. for FreeBSD.
`c++` should be used insted, which should be a link to system c++ compiler. This will be `g++` for linux, but `clang++` for FreeBSD.
CMAKE_SOURCE_DIR refer to the full path to the top level of the current
CMake source tree
PROJECT_SOURCE_DIR refer to the source directory of the last call to the
project() command made in the current directory scope or one of its parents
when ninja is use as a subproject, the build fail because of this.
Calling DepsLog/BuildLog::OpenForWrite will now only save the file path.
The actual opening of the file (moved to OpenForWriteIfNeeded) happens
right before the first write attempt.
This is needed so that the files aren't held open when the generator
runs (i.e. RebuildManifest) as it may call tools like recompact which
won't be able to open the file on Windows.
The disadvantage is that now the error reporting happens at a later time
and will be reported as a failed write, not a failed open.
* Added ability to parse escaped colons in GCC Dep files enabling ninja to parse dep files of GCC 10 on Windows
* Added generated depfile_parser.cc
* Addressed formatting
* Added extra tests with real world examples of paths produced by both GCC 10 and Clang and GCC pre 10. Adjusted one test so it doesn't fail
* Adjusted regular expression to not match \: if the character following the : is either EOF or whitespace
* Fixed typo in regex (should be 0x20 for space not 0xa)
* Changed regular expression form using lookahead to instead matching a separate expression. This was needed as re2c pre version 1.17 is broken when using lookaheads. Also added tests for \: followed by whitespace
* Addressed formatting
* Forgot a missing std::
* Fixed formatting for spaces after , as well as respecting column width