Skip to content

Commit

Permalink
Merge pull request #13 from cmake-wheel/cmake
Browse files Browse the repository at this point in the history
CMake updates
  • Loading branch information
jcarpent authored Dec 10, 2023
2 parents 4cdf945 + 1f2714b commit b2cd4bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,30 @@ COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})

include(${CMAKE_CURRENT_LIST_DIR}/cmake/boost.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/python.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/apple.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/ide.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/python-helpers.cmake)
include(CMakeDependentOption)

# If needed, fix CMake policy for APPLE systems
APPLY_DEFAULT_APPLE_CONFIGURATION()

# Project dependencies
find_package(Boost REQUIRED COMPONENTS unit_test_framework)
find_package(crocoddyl REQUIRED)
find_package(eigenpy REQUIRED)

add_project_dependency(crocoddyl 2.0.0 REQUIRED)
add_project_dependency(eigenpy 2.7.10 REQUIRED)
add_project_dependency(example-robot-data 4.0.7 REQUIRED PKG_CONFIG_REQUIRES
"example-robot-data >= 4.0.7")

if(BUILD_WITH_PROXSUITE)
find_package(proxsuite REQUIRED)
add_project_dependency(proxsuite REQUIRED)
add_definitions(-DMIM_SOLVERS_WITH_PROXQP)
endif()

find_package(OpenMP REQUIRED COMPONENTS CXX)

if(BUILD_PYTHON_INTERFACE)
FINDPYTHON()
string(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
set(${PY_NAME}_INSTALL_DIR ${PYTHON_SITELIB}/${PY_NAME})
SEARCH_FOR_BOOST_PYTHON()
endif()

# Main Library
Expand Down
11 changes: 3 additions & 8 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include("../cmake/python-helpers.cmake")

if(GENERATE_PYTHON_STUBS)
include(${PROJECT_SOURCE_DIR}/cmake/stubs.cmake)
endif(GENERATE_PYTHON_STUBS)
Expand All @@ -17,12 +15,9 @@ if(BUILD_WITH_PROXSUITE)
endif(BUILD_WITH_PROXSUITE)

add_library(${PY_NAME}_pywrap MODULE ${${PY_NAME}_SOURCES})
MODERNIZE_TARGET_LINK_LIBRARIES(${PY_NAME}_pywrap SCOPE PUBLIC TARGETS eigenpy::eigenpy)
target_link_libraries(${PY_NAME}_pywrap PUBLIC ${PROJECT_NAME})
target_link_libraries(${PY_NAME}_pywrap PUBLIC crocoddyl::crocoddyl)
target_link_libraries(${PY_NAME}_pywrap PUBLIC ${PROJECT_NAME} eigenpy::eigenpy)

set_target_properties(${PY_NAME}_pywrap PROPERTIES
INSTALL_RPATH "\$ORIGIN/../../.."
LIBRARY_OUTPUT_DIRECTORY ${PY_NAME}_pywrap
PREFIX ""
SUFFIX ${PYTHON_EXT_SUFFIX})
Expand All @@ -35,9 +30,9 @@ endif(GENERATE_PYTHON_STUBS)
set(${PY_NAME}_PYTHON mim_solvers/__init__.py)

SET(PYLIB_INSTALL_DIR ${PYTHON_SITELIB}/mim_solvers)
GET_RELATIVE_RPATH(${PYLIB_INSTALL_DIR} PYLIB_RPATH)
IF(UNIX)
SET_TARGET_PROPERTIES(${${PY_NAME}_pywrap} PROPERTIES INSTALL_RPATH ${PYLIB_RPATH})
GET_RELATIVE_RPATH(${PYLIB_INSTALL_DIR} PYLIB_RPATH)
SET_TARGET_PROPERTIES(${PY_NAME}_pywrap PROPERTIES INSTALL_RPATH ${PYLIB_RPATH})
ENDIF()

install(TARGETS ${PY_NAME}_pywrap LIBRARY DESTINATION ${PYLIB_INSTALL_DIR})
Expand Down

0 comments on commit b2cd4bf

Please sign in to comment.