-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #997 from dkrupp/cross-fix
Improve compiler parameter auto-detection
- Loading branch information
Showing
10 changed files
with
199 additions
and
93 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Build Logger | ||
|
||
This tool can capture the build process and generate a | ||
[JSON Compilation Database](https://clang.llvm.org/docs/JSONCompilationDatabase.html) | ||
|
||
## Compilation | ||
|
||
To build the project execute | ||
~~~~~~~ | ||
cd vendor/build-logger | ||
make -f Makefile.manual | ||
~~~~~~~ | ||
|
||
## Usage | ||
|
||
Set the following environment variables: | ||
~~~~~~~ | ||
export LD_PRELOAD=ldlogger.so | ||
export LD_LIBRARY_PATH=`pwd`/build/lib:$LD_LIBRARY_PATH | ||
export CC_LOGGER_GCC_LIKE="gcc:g++:clang" | ||
#The output compilation JSON file | ||
export CC_LOGGER_FILE=`pwd`/compilation.json | ||
~~~~~~~ | ||
|
||
then when you call `gcc` from a sub-shell (e.g. as a part of a Make build process), | ||
`compilation.json` will be created. | ||
For example: | ||
`bash -c "gcc -c something.c"` | ||
will create | ||
~~~~~~~ | ||
compilation.json: | ||
[ | ||
{ | ||
"directory": "/home/john_doe/", | ||
"command": "/usr/bin/gcc-4.8 -c /home/john_doe/something.c", | ||
"file": "/home/john_doe/something.c" | ||
} | ||
] | ||
~~~~~~~ | ||
|
||
|
||
|
||
## Environment Variables | ||
|
||
### `CC_LOGGER_GCC_LIKE` | ||
You can change the compilers that should be logged. | ||
Set `CC_LOGGER_GCC_LIKE` environment variable to a colon separated list. | ||
|
||
For example (default): | ||
|
||
```export CC_LOGGER_GCC_LIKE="gcc:g++:clang"``` | ||
|
||
The logger will match any compilers with `gcc`,`g++` or `clang` in their filenames. | ||
|
||
|
||
### `CC_LOGGER_FILE` | ||
Output file to generate compilation database into. | ||
This can be a relative or absolute path. | ||
|
||
### `CC_LOGGER_JAVAC_LIKE` | ||
You can specify the `javac` like | ||
compilers that should be logged as a colon separated string list. | ||
|
||
### `CC_LOGGER_DEF_DIRS` | ||
If the environment variable is defined, | ||
the logger will extend the compiler argument list in the compilation | ||
database with the pre-configured include paths of the logged compiler. | ||
|
||
|
Oops, something went wrong.