aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/CMakeLists.txt3
-rw-r--r--clang/tools/libclang/CMakeLists.txt19
2 files changed, 22 insertions, 0 deletions
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 52b881939499..7e2762b6d5f1 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -279,6 +279,9 @@ endif()
set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
"Vendor-specific uti.")
+set(CLANG_PYTHON_BINDINGS_VERSIONS "" CACHE STRING
+ "Python versions to install libclang python bindings for")
+
# The libdir suffix must exactly match whatever LLVM's configuration used.
set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}")
diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index e539c8308e75..729d5560b658 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -151,3 +151,22 @@ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
add_llvm_install_targets(install-libclang-headers
COMPONENT libclang-headers)
endif()
+
+# Create a target to install the python bindings to make them easier to
+# distribute. Since the bindings are over libclang, which is installed
+# unbundled to the clang version, follow suit.
+foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
+ install(DIRECTORY
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../bindings/python/clang
+ COMPONENT
+ libclang-python-bindings
+ DESTINATION
+ "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+endforeach()
+if(NOT CMAKE_CONFIGURATION_TYPES)
+ add_custom_target(libclang-python-bindings)
+ add_llvm_install_targets(install-libclang-python-bindings
+ COMPONENT
+ libclang-python-bindings)
+endif()
+