mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -182,7 +182,7 @@ KNOWN_SETTINGS=(
|
||||
darwin-toolchain-installer-package "" "The path to installer pkg"
|
||||
build-jobs "" "The number of parallel build jobs to use"
|
||||
darwin-toolchain-alias "swift" "Swift alias for toolchain"
|
||||
|
||||
export-compile-commands "" "set to generate JSON compilation databases for each build product"
|
||||
)
|
||||
|
||||
function toupper() {
|
||||
@@ -1035,6 +1035,13 @@ if [[ "${ENABLE_ASAN}" ]] ; then
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ "${EXPORT_COMPILE_COMMANDS}" ]] ; then
|
||||
COMMON_CMAKE_OPTIONS=(
|
||||
"${COMMON_CMAKE_OPTIONS[@]}"
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
)
|
||||
fi
|
||||
|
||||
if [ -z "${HOST_CC}" ] ; then
|
||||
if [ "$(uname -s)" == "Darwin" ] ; then
|
||||
HOST_CC="$(xcrun_find_tool clang)"
|
||||
|
||||
Reference in New Issue
Block a user