]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: install rook-client-python using ExternalProject 39118/head
authorKefu Chai <kchai@redhat.com>
Thu, 28 Jan 2021 12:35:36 +0000 (20:35 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 28 Jan 2021 12:35:39 +0000 (20:35 +0800)
so we don't need to rerun the generate_rook_ceph_client.sh script
everytime when building the script. cmake creates a stamp file for
tracking the dependencies and the time of modification of dependencies.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/rook/CMakeLists.txt

index 15ba4c149385555cde8f8b8fc3981055fe7aa0e1..206e165e6890beced152309e59a583d937f5a960 100644 (file)
@@ -1,12 +1,15 @@
-add_custom_command(
-  OUTPUT rook_client/__init__.py
-  COMMAND ./generate_rook_ceph_client.sh
-  COMMENT "generating mgr/rook/rook_client"
-  WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src/pybind/mgr/rook")
+include(ExternalProject)
 
-add_custom_target(mgr-rook-client
-  DEPENDS rook_client/__init__.py
-  WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src/pybind/mgr/rook"
-)
+ExternalProject_Add(mgr-rook-client
+  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rook-client-python/rook_client"
+  # use INSTALL_DIR for destination dir
+  INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rook_client"
+  CONFIGURE_COMMAND ""
+  BUILD_COMMAND ${CMAKE_COMMAND} -E make_directory <INSTALL_DIR>
+  COMMAND       ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/ceph <INSTALL_DIR>/ceph
+  COMMAND       ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/__init__.py <INSTALL_DIR>
+  COMMAND       ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/_helper.py <INSTALL_DIR>
+  BUILD_BYPRODUCTS "<INSTALL_DIR>/__init__.py"
+  INSTALL_COMMAND "")
 
 add_dependencies(ceph-mgr mgr-rook-client)