Skip to content

Commit

Permalink
avoid repeated copy
Browse files Browse the repository at this point in the history
  • Loading branch information
littlemine committed Sep 27, 2024
1 parent f3d86fa commit f3564aa
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions projects/CUDA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,21 @@ if (ZS_PYTHON_FOUND AND ZENO_WITH_PyZpc)
if (WIN32)
cmake_path(GET ZS_OVERWRITE_PYTHON_EXECUTABLE PARENT_PATH PYTHON_ENV_PATH)
message(STATUS "python3 parent: ${PYTHON_ENV_PATH}")
add_custom_command(
TARGET copy_py
POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${PYTHON_ENV_PATH}/lib ${RESOURCE_BASE_DIR}/lib
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${PYTHON_ENV_PATH}/dlls ${RESOURCE_BASE_DIR}/dlls
COMMAND ${CMAKE_COMMAND}
-DOBJECTS=${PYTHON_ENV_PATH}/Lib
-DOUTPUT=${RESOURCE_BASE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/copy_dir.cmake

COMMAND ${CMAKE_COMMAND}
-DOBJECTS=${PYTHON_ENV_PATH}/DLLs
-DOUTPUT=${RESOURCE_BASE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/copy_dir.cmake
if (NOT EXISTS ${RESOURCE_BASE_DIR}/Lib/site-packages)
add_custom_command(
TARGET copy_py
POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${PYTHON_ENV_PATH}/lib ${RESOURCE_BASE_DIR}/lib
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${PYTHON_ENV_PATH}/dlls ${RESOURCE_BASE_DIR}/dlls
COMMAND ${CMAKE_COMMAND}
-DOBJECTS=${PYTHON_ENV_PATH}/Lib
-DOUTPUT=${RESOURCE_BASE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/copy_dir.cmake

COMMAND ${CMAKE_COMMAND}
-DOBJECTS=${PYTHON_ENV_PATH}/DLLs
-DOUTPUT=${RESOURCE_BASE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/copy_dir.cmake

# COMMAND ${CMAKE_COMMAND}
# -DOBJECTS=${PYTHON_ENV_PATH}/library
Expand All @@ -125,8 +126,9 @@ if (ZS_PYTHON_FOUND AND ZENO_WITH_PyZpc)
# -DOUTPUT=$<TARGET_FILE_DIR:zpc_py_interop>
# -P ${CMAKE_CURRENT_SOURCE_DIR}/copy_dll.cmake

COMMENT "copying python lib directories at ${PYTHON_ENV_PATH} to ${RESOURCE_BASE_DIR}"
)
COMMENT "copying python lib directories at ${PYTHON_ENV_PATH} to ${RESOURCE_BASE_DIR}"
)
endif()
if (EXISTS ${PYTHON_ENV_PATH}/library)
add_custom_command(
TARGET copy_py
Expand Down Expand Up @@ -154,14 +156,16 @@ if (ZS_PYTHON_FOUND AND ZENO_WITH_PyZpc)
cmake_path(GET ZS_OVERWRITE_PYTHON_EXECUTABLE PARENT_PATH PYTHON_ENV_PATH)
cmake_path(GET PYTHON_ENV_PATH PARENT_PATH PYTHON_ENV_PATH)
message(STATUS "python3 parent: ${PYTHON_ENV_PATH}")
add_custom_command(
TARGET copy_py
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PYTHON_ENV_PATH}/bin ${RESOURCE_BASE_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PYTHON_ENV_PATH}/lib ${RESOURCE_BASE_DIR}/lib
if (NOT EXISTS ${RESOURCE_BASE_DIR}/lib/libtinfo.a)
add_custom_command(
TARGET copy_py
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PYTHON_ENV_PATH}/bin ${RESOURCE_BASE_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PYTHON_ENV_PATH}/lib ${RESOURCE_BASE_DIR}/lib

COMMENT "copying python lib directory ${PYTHON_ENV_PATH}/lib to ${RESOURCE_BASE_DIR}/lib"
)
COMMENT "copying python lib directory ${PYTHON_ENV_PATH}/lib to ${RESOURCE_BASE_DIR}/lib"
)
endif()
endif()

# prepare zpc headers for pyzpc
Expand Down

0 comments on commit f3564aa

Please sign in to comment.