Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-e install rcb4 in virtualenv #17

Merged
merged 2 commits into from
Jan 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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} ${_python}
)


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

include_directories(
include
${catkin_INCLUDE_DIRS}
Expand Down
Loading