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

CMake: python option #24

Merged
merged 1 commit into from
Oct 1, 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
39 changes: 25 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME hpp_romeo)
set(PROJECT_DESCRIPTION "Python and ros launch files for Romeo robot in hpp.")

set(PROJECT_USE_CMAKE_EXPORT TRUE)
option(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
option(INSTALL_PYTHON_INTERFACE_ONLY "Install *ONLY* the python bindings" OFF)

if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
set(PROJECT_USE_CMAKE_EXPORT TRUE)
endif(NOT INSTALL_PYTHON_INTERFACE_ONLY)

# Check if the submodule cmake have been initialized
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
Expand Down Expand Up @@ -46,23 +51,29 @@ include("${JRL_CMAKE_MODULES}/python.cmake")
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})

findpython()
if(BUILD_PYTHON_INTERFACE)
findpython(REQUIRED)
endif(BUILD_PYTHON_INTERFACE)

add_project_dependency("hpp-corbaserver" REQUIRED)
add_project_dependency("example-robot-data" REQUIRED)

install(FILES src/hpp/corbaserver/romeo/robot.py
src/hpp/corbaserver/romeo/__init__.py
DESTINATION ${PYTHON_SITELIB}/hpp/corbaserver/romeo)
if(BUILD_PYTHON_INTERFACE)
install(FILES src/hpp/corbaserver/romeo/robot.py
src/hpp/corbaserver/romeo/__init__.py
DESTINATION ${PYTHON_SITELIB}/hpp/corbaserver/romeo)

install(FILES src/hpp/corbaserver/manipulation/romeo/robot.py
src/hpp/corbaserver/manipulation/romeo/__init__.py
DESTINATION ${PYTHON_SITELIB}/hpp/corbaserver/manipulation/romeo)
install(FILES src/hpp/corbaserver/manipulation/romeo/robot.py
src/hpp/corbaserver/manipulation/romeo/__init__.py
DESTINATION ${PYTHON_SITELIB}/hpp/corbaserver/manipulation/romeo)
endif()

install(FILES package.xml DESTINATION share/${PROJECT_NAME})
if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
install(FILES package.xml DESTINATION share/${PROJECT_NAME})

add_library(${PROJECT_NAME} INTERFACE)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
add_library(${PROJECT_NAME} INTERFACE)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
endif()
Loading