You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Returns clang or gcc, if you have one of them on your path."""
289
-
ifshutil.which('clang'):
290
-
return'clang'
291
-
elifshutil.which('gcc'):
292
-
return'gcc'
293
-
else:
294
-
returnNone
295
-
296
-
297
286
defwindows_list2cmdline(seq):
298
287
"""
299
288
Copied from list2cmdline in https://github.com/python/cpython/blob/main/Lib/subprocess.py because we need it but it's not exported as part of the public API.
# Emscripten is tricky. There isn't an easy way to make it emcc run without lots of environment variables.
571
-
# So...rather than doing our usual script unwrapping, we just swap in clang/gcc and use that to get headers, knowing that they'll accept the same argument format.
572
-
# You can unwrap emcc.sh to emcc.py via next(pathlib.Path('external').glob('emscripten_bin_*/emscripten/emcc.py')).as_posix()
573
-
# But then the underlying emcc needs a configuration file that itself depends on lots of environment variables.
574
-
# If we ever pick this back up, note that you can supply that config via compile_args += ["--em-config", "external/emsdk/emscripten_toolchain/emscripten_config"]
"""De-Bazel the command into something clangd can parse.
750
+
751
+
This function has fixes specific to Emscripten platforms, but you should call it on all platforms. It'll determine whether the fixes should be applied or not
Copy file name to clipboardExpand all lines: refresh_compile_commands.bzl
+3
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,7 @@ def refresh_compile_commands(
98
98
version_checker_script_name,
99
99
script_name,
100
100
],
101
+
data= ["@hedron_compile_commands//:print_args"],
101
102
imports= [''], # Allows binary to import templated script, even if this macro is being called inside a sub package. See https://github.com/hedronvision/bazel-compile-commands-extractor/issues/137
" {windows_default_include_paths}": "\n".join([" %r,"%pathforpathinfind_cpp_toolchain(ctx).built_in_include_directories]), # find_cpp_toolchain is from https://docs.bazel.build/versions/main/integrating-with-rules-cc.html
# For Windows INCLUDE. If this were eliminated, for example by the resolution of https://github.com/clangd/clangd/issues/123, we'd be able to just use a macro and skylib's expand_template rule: https://github.com/bazelbuild/bazel-skylib/pull/330
129
132
# Once https://github.com/bazelbuild/bazel/pull/17108 is widely released, we should be able to eliminate this and get INCLUDE directly. Perhaps for 7.0? Should be released in the sucessor to 6.0
0 commit comments