[PATCH] D101139: Create install targets for scan-build-py.

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 6 13:41:21 PDT 2021


phosek added a comment.

Looking at `libear/__init__.py`, it's basically replicating CMake build to the point where it even emulates CMake template expansion, see https://github.com/llvm/llvm-project/blob/a3a8a1a15b524d91b5308db68e9d293b34cd88dd/clang/tools/scan-build-py/libear/__init__.py#L204. Given that we already use CMake, I think we should just build libear with CMake and ship libear as shared library and then modify https://github.com/llvm/llvm-project/blob/a3a8a1a15b524d91b5308db68e9d293b34cd88dd/clang/tools/scan-build-py/libscanbuild/intercept.py#L113 to use the prebuilt version instead of building it every time. However, given that this change is already pretty large, I'm also fine if we do it in a follow up change.



================
Comment at: clang/tools/scan-build-py/CMakeLists.txt:1-7
+set (bin
+     "bin/analyze-build"
+     "bin/analyze-c++"
+     "bin/analyze-cc"
+     "bin/intercept-build"
+     "bin/intercept-c++"
+     "bin/intercept-cc")
----------------
I'd prefer to install all of these into `libexec` to match Perl `scan-build`.


================
Comment at: clang/tools/scan-build-py/CMakeLists.txt:27
+# Need to rename analyze-build to analyze-build-py to prevent overwriting
+# scan-build peral implementation.
+install (PROGRAMS "bin/scan-build"
----------------



================
Comment at: clang/tools/scan-build-py/CMakeLists.txt:28
+# scan-build peral implementation.
+install (PROGRAMS "bin/scan-build"
+  DESTINATION bin
----------------
A property we're trying to keep is that the build layout matches the installation layout, so in addition to installing files, we also need a custom target to copy these files into the build output directory. This is what Perl scan-build does as well, see https://github.com/llvm/llvm-project/blob/a3a8a1a15b524d91b5308db68e9d293b34cd88dd/clang/tools/scan-build/CMakeLists.txt#L41


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101139/new/

https://reviews.llvm.org/D101139



More information about the cfe-commits mailing list