Skip to content

Commit

Permalink
-e install rcb4 in virtualenv
Browse files Browse the repository at this point in the history
  • Loading branch information
iory committed Jan 13, 2024
1 parent 0677d9e commit 5d2786e
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions ros/kxr_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ endif()
get_filename_component(RCB4_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.." ABSOLUTE)
message(STATUS "RCB4 Directory: ${RCB4_DIR}")

# Command to copy the modified requirements.in to requirements.in.with_rcb4
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/requirements.in ${CMAKE_CURRENT_SOURCE_DIR}/requirements.in.with_rcb4 COPYONLY)
file(APPEND ${CMAKE_CURRENT_SOURCE_DIR}/requirements.in.with_rcb4 "${RCB4_DIR}\n")

find_package(catkin REQUIRED COMPONENTS
catkin_virtualenv
actionlib
Expand Down Expand Up @@ -56,13 +52,29 @@ catkin_package(
)

catkin_generate_virtualenv(
INPUT_REQUIREMENTS requirements.in.with_rcb4
INPUT_REQUIREMENTS requirements.in
PYTHON_INTERPRETER python3
USE_SYSTEM_PACKAGES TRUE
ISOLATE_REQUIREMENTS FALSE
CHECK_VENV FALSE
)

set(_python "${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/venv/bin/python")
set(_venv_setup "${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/venv/bin/activate")

add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/after_venv_script"
COMMAND echo "${_python} -m pip install ${RCB4_DIR}"
COMMAND . ${_venv_setup} && ${_python} -m pip install ${RCB4_DIR}
DEPENDS ${PROJECT_NAME}_generate_virtualenv # ${_venv_setup}
)


add_custom_target(
run_after_venv ALL
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/after_venv_script"
)

include_directories(
include
${catkin_INCLUDE_DIRS}
Expand Down

0 comments on commit 5d2786e

Please sign in to comment.