[build-script] Add flag to export compile commands

CMake supports generation of compilation databases. These have many uses, not
least of which is in supporting code-completion engines like
https://github.com/Valloric/YouCompleteMe.

Add the `--export-compile-commands` flag to `utils/build-script`.
Setting this flag passes `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to CMake,
which results in a `compile_commands.json` file being generated along
with built products like `cmark`, `llvm`, and `swift`.
This commit is contained in:
Brian Gesiak
2015-12-13 23:04:43 -05:00
parent 7f08c9d785
commit adf6fef8d2
2 changed files with 17 additions and 2 deletions

View File

@@ -295,10 +295,13 @@ details of the setups of other systems or automated environments.""")
dest="build_foundation")
extra_actions_group = parser.add_argument_group(
title="Extra actions to perform before building")
title="Extra actions to perform before or in addition to building")
extra_actions_group.add_argument("-c", "--clean",
help="do a clean build",
action="store_true")
extra_actions_group.add_argument("--export-compile-commands",
help="generate compilation databases in addition to building",
action="store_true")
build_variant_group = parser.add_mutually_exclusive_group(required=False)
build_variant_group.add_argument("-d", "--debug",
@@ -559,6 +562,11 @@ the number of parallel build jobs to use""",
build_script_impl_inferred_args = []
if args.export_compile_commands:
build_script_impl_inferred_args += [
"--export-compile-commands"
]
if args.cmake_generator == "XcodeIDEOnly":
args.cmake_generator = "Xcode"
build_script_impl_inferred_args += [