CMake: Do not generate .isystem files for libtooling interface generator

The generated `compile_commands.json` contains everything that the interface
generator needs.

PiperOrigin-RevId: 439800377
Change-Id: I5b364edc20eaae9554ce10a96caa3559fb780210
This commit is contained in:
Christian Blichmann 2022-04-06 04:47:21 -07:00 committed by Copybara-Service
parent c5afd39cc4
commit eb20966666

View File

@ -145,7 +145,6 @@ function(add_sapi_library)
set(_sapi_embed_name "${_sapi_NAME}")
endif()
set(_sapi_isystem "${_sapi_NAME}.isystem")
list(APPEND _sapi_generator_args
"--sapi_name=${_sapi_LIBRARY_NAME}"
"--sapi_out=${_sapi_gen_header}"
@ -153,7 +152,6 @@ function(add_sapi_library)
"--sapi_embed_name=${_sapi_embed_name}"
"--sapi_functions=${_sapi_funcs}"
"--sapi_ns=${_sapi_NAMESPACE}"
"--sapi_isystem=${_sapi_isystem}"
)
if(SAPI_ENABLE_GENERATOR)
list(APPEND _sapi_generator_command
@ -162,26 +160,35 @@ function(add_sapi_library)
${_sapi_generator_args}
${_sapi_full_inputs}
)
add_custom_command(
OUTPUT "${_sapi_gen_header}"
COMMAND ${_sapi_generator_command}
COMMENT "Generating interface"
DEPENDS ${_sapi_INPUTS}
VERBATIM
)
else()
set(_sapi_isystem "${_sapi_NAME}.isystem")
list(JOIN _sapi_full_inputs "," _sapi_full_inputs)
list(APPEND _sapi_generator_command
"${SAPI_PYTHON3_EXECUTABLE}" -B
"${SAPI_SOURCE_DIR}/sandboxed_api/tools/generator2/sapi_generator.py"
${_sapi_generator_args}
"--sapi_isystem=${_sapi_isystem}"
"--sapi_in=${_sapi_full_inputs}"
)
add_custom_command(
OUTPUT "${_sapi_gen_header}" "${_sapi_isystem}"
COMMAND sh -c
"${CMAKE_CXX_COMPILER} -E -x c++ -v /dev/null 2>&1 | \
awk '/> search starts here:/{f=1;next}/^End of search/{f=0}f{print $1}' \
> \"${_sapi_isystem}\""
COMMAND ${_sapi_generator_command}
COMMENT "Generating interface"
DEPENDS ${_sapi_INPUTS}
VERBATIM
)
endif()
add_custom_command(
OUTPUT "${_sapi_gen_header}" "${_sapi_isystem}"
COMMAND sh -c
"${CMAKE_CXX_COMPILER} -E -x c++ -v /dev/null 2>&1 | \
awk '/> search starts here:/{f=1;next}/^End of search/{f=0}f{print $1}' \
> \"${_sapi_isystem}\""
COMMAND ${_sapi_generator_command}
COMMENT "Generating interface"
DEPENDS ${_sapi_INPUTS}
VERBATIM
)
# Library with the interface
if(NOT _sapi_SOURCES)