Unverified Commit f13b8ebf authored by Guilhem Saurel's avatar Guilhem Saurel Committed by GitHub
Browse files

Merge pull request #60 from nim65s/devel

CMake: fix for eigenpy 2.7.10
parents dab3c137 b22941f3
......@@ -8,6 +8,7 @@ set(PROJECT_URL https://github.com/${PROJECT_NAMESPACE}/${PROJECT_NAME})
# Project options
option(BUILD_PYTHON_INTERFACE "Build the python binding" ON)
option(BUILD_PY2CPP_INTERFACE "Build the py2cpp library" OFF)
option(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
# Project configuration
......@@ -30,7 +31,6 @@ ENDIF()
# JRL-cmakemodule setup
include("${JRL_CMAKE_MODULES}/base.cmake")
include("${JRL_CMAKE_MODULES}/boost.cmake")
include("${JRL_CMAKE_MODULES}/python.cmake")
# Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
......@@ -39,17 +39,16 @@ project(${PROJECT_NAME} ${PROJECT_ARGS})
ADD_COMPILE_OPTIONS(-Wno-error)
# Project dependencies
ADD_PROJECT_DEPENDENCY(ndcurves REQUIRED)
ADD_PROJECT_DEPENDENCY(crocoddyl REQUIRED)
ADD_PROJECT_DEPENDENCY(yaml-cpp REQUIRED)
if(BUILD_PYTHON_INTERFACE)
FINDPYTHON()
ADD_PROJECT_DEPENDENCY(eigenpy 2.7.10 REQUIRED)
string(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
set(${PY_NAME}_INSTALL_DIR ${PYTHON_SITELIB}/${PY_NAME})
SEARCH_FOR_BOOST_PYTHON()
endif()
ADD_PROJECT_DEPENDENCY(ndcurves REQUIRED)
ADD_PROJECT_DEPENDENCY(crocoddyl REQUIRED)
ADD_PROJECT_DEPENDENCY(yaml-cpp REQUIRED)
# Main Library
set(${PROJECT_NAME}_HEADERS
include/${PROJECT_NAME}/flexibility_compensation.hpp
......@@ -119,16 +118,18 @@ endif()
# Python Bindings
if(BUILD_PYTHON_INTERFACE)
add_library(${PROJECT_NAME}_py2cpp SHARED src/py2cpp.cpp include/${PROJECT_NAME}/py2cpp.hpp)
if(SUFFIX_SO_VERSION)
set_target_properties(${PROJECT_NAME}_py2cpp PROPERTIES SOVERSION ${PROJECT_VERSION})
if(BUILD_PY2CPP_INTERFACE)
add_library(${PROJECT_NAME}_py2cpp SHARED src/py2cpp.cpp include/${PROJECT_NAME}/py2cpp.hpp)
if(SUFFIX_SO_VERSION)
set_target_properties(${PROJECT_NAME}_py2cpp PROPERTIES SOVERSION ${PROJECT_VERSION})
endif()
install(FILES include/${PROJECT_NAME}/py2cpp.hpp DESTINATION include/${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME}_py2cpp EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
target_link_libraries(${PROJECT_NAME}_py2cpp PUBLIC crocoddyl::crocoddyl)
target_link_libraries(${PROJECT_NAME}_py2cpp PRIVATE ${PYTHON_LIBRARIES})
target_include_directories(${PROJECT_NAME}_py2cpp PRIVATE ${PYTHON_INCLUDE_DIRS})
TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME}_py2cpp PRIVATE)
endif()
install(FILES include/${PROJECT_NAME}/py2cpp.hpp DESTINATION include/${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME}_py2cpp EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
target_link_libraries(${PROJECT_NAME}_py2cpp PUBLIC crocoddyl::crocoddyl)
target_link_libraries(${PROJECT_NAME}_py2cpp PRIVATE ${PYTHON_LIBRARIES})
target_include_directories(${PROJECT_NAME}_py2cpp PRIVATE ${PYTHON_INCLUDE_DIRS})
TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME}_py2cpp PRIVATE)
add_subdirectory(python)
endif()
......
......@@ -8,5 +8,7 @@ FOREACH(BENCHMARK_NAME ${${PROJECT_NAME}_BENCHMARK})
target_link_libraries(${BENCHMARK_NAME} PUBLIC ${PROJECT_NAME} crocoddyl::crocoddyl)
ENDFOREACH(BENCHMARK_NAME ${${PROJECT_NAME}_BENCHMARK})
target_compile_definitions(bench-mpc-walk PRIVATE PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
target_link_libraries(bench-mpc-walk PUBLIC ${PROJECT_NAME}_py2cpp)
if(BUILD_PY2CPP_INTERFACE)
target_compile_definitions(bench-mpc-walk PRIVATE PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
target_link_libraries(bench-mpc-walk PUBLIC ${PROJECT_NAME}_py2cpp)
endif()
Subproject commit df7bbb894c8314f91e78164bc3502445e383e973
Subproject commit 72d1acd6e6879eaf73a554c1070b6d46a4ac30ff
......@@ -51,11 +51,13 @@ target_link_libraries(test_walk_params PUBLIC ${PROJECT_NAME}_unittest)
target_compile_definitions(test_walk_params PRIVATE PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
if(BUILD_PYTHON_INTERFACE)
ADD_UNIT_TEST(test_init_shooting_problem test_init_shooting_problem.cpp)
target_link_libraries(test_init_shooting_problem PUBLIC ${PROJECT_NAME}_py2cpp)
target_compile_definitions(test_init_shooting_problem PRIVATE PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
#set_tests_properties(test_init_shooting_problem PROPERTIES ENVIRONMENT
# "PYTHONPATH=${PROJECT_SOURCE_DIR}/mpc:${PROJECT_BINARY_DIR}/python")
if(BUILD_PY2CPP_INTERFACE)
ADD_UNIT_TEST(test_init_shooting_problem test_init_shooting_problem.cpp)
target_link_libraries(test_init_shooting_problem PUBLIC ${PROJECT_NAME}_py2cpp)
target_compile_definitions(test_init_shooting_problem PRIVATE PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
#set_tests_properties(test_init_shooting_problem PROPERTIES ENVIRONMENT
# "PYTHONPATH=${PROJECT_SOURCE_DIR}/mpc:${PROJECT_BINARY_DIR}/python")
endif()
add_subdirectory(python)
endif()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment