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

Some fixes in the CMakeLists for bare compilation #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.5)

project(xbot2_interface LANGUAGES CXX VERSION 1.0.0)

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++20" COMPILER_SUPPORTS_CXX20)

option(XBOT2_IFC_BUILD_PINOCCHIO "Build Pinocchio implementation" ON)
option(XBOT2_IFC_BUILD_RBDL "Build RBDL implementation" OFF)
option(XBOT2_IFC_BUILD_ROS "Build ROS implementation" ON)
Expand All @@ -19,6 +22,10 @@ find_package(Eigen3 REQUIRED)

include(GNUInstallDirs)

include_directories(include/
external/fmt-10.2.1/include
${srdfdom_INCLUDE_DIRS})

add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)

# internal fmt
Expand Down
126 changes: 126 additions & 0 deletions cmake/FindRBDL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Searches for RBDL includes and library files, including Addons.
#
# Sets the variables
# RBDL_FOUND
# RBDL_INCLUDE_DIR
# RBDL_LIBRARY
#
# You can use the following components:
# LuaModel
# URDFReader
# and then link to them e.g. using RBDL_LuaModel_LIBRARY.

SET (RBDL_FOUND FALSE)
SET (RBDL_LuaModel_FOUND FALSE)
SET (RBDL_URDFReader_FOUND FALSE)

FIND_PATH (RBDL_INCLUDE_DIR rbdl/rbdl.h
HINTS
$ENV{HOME}/local/include
$ENV{RBDL_PATH}/src
$ENV{RBDL_PATH}/include
$ENV{RBDL_INCLUDE_PATH}
/usr/local/include
/usr/include
)

FIND_LIBRARY (RBDL_LIBRARY NAMES rbdl
PATHS
$ENV{HOME}/local/lib
$ENV{HOME}/local/lib/x86_64-linux-gnu
$ENV{RBDL_PATH}/lib
$ENV{RBDL_LIBRARY_PATH}
/usr/local/lib
/usr/local/lib/x86_64-linux-gnu
/usr/lib
/usr/lib/x86_64-linux-gnu
)

FIND_PATH (RBDL_LuaModel_INCLUDE_DIR rbdl/addons/luamodel/luamodel.h
HINTS
$ENV{HOME}/local/include
$ENV{RBDL_PATH}/src
$ENV{RBDL_PATH}/include
$ENV{RBDL_INCLUDE_PATH}
/usr/local/include
/usr/include
)

FIND_LIBRARY (RBDL_LuaModel_LIBRARY NAMES rbdl_luamodel
PATHS
$ENV{HOME}/local/lib
$ENV{HOME}/local/lib/x86_64-linux-gnu
$ENV{RBDL_PATH}
$ENV{RBDL_LIBRARY_PATH}
/usr/local/lib
/usr/local/lib/x86_64-linux-gnu
/usr/lib
/usr/lib/x86_64-linux-gnu
)

FIND_PATH (RBDL_URDFReader_INCLUDE_DIR rbdl/addons/urdfreader/urdfreader.h
HINTS
$ENV{HOME}/local/include
$ENV{RBDL_PATH}/src
$ENV{RBDL_PATH}/include
$ENV{RBDL_INCLUDE_PATH}
/usr/local/include
/usr/include
)

FIND_LIBRARY (RBDL_URDFReader_LIBRARY NAMES rbdl_urdfreader
PATHS
$ENV{HOME}/local/lib
$ENV{HOME}/local/lib/x86_64-linux-gnu
$ENV{RBDL_PATH}
$ENV{RBDL_LIBRARY_PATH}
/usr/local/lib
/usr/local/lib/x86_64-linux-gnu
/usr/lib
/usr/lib/x86_64-linux-gnu
)

IF (NOT RBDL_LIBRARY)
MESSAGE (ERROR "Could not find RBDL")
ENDIF (NOT RBDL_LIBRARY)

IF (RBDL_INCLUDE_DIR AND RBDL_LIBRARY)
SET (RBDL_FOUND TRUE)
ENDIF (RBDL_INCLUDE_DIR AND RBDL_LIBRARY)

IF (RBDL_LuaModel_INCLUDE_DIR AND RBDL_LuaModel_LIBRARY)
SET (RBDL_LuaModel_FOUND TRUE)
ENDIF (RBDL_LuaModel_INCLUDE_DIR AND RBDL_LuaModel_LIBRARY)

IF (RBDL_URDFReader_INCLUDE_DIR AND RBDL_URDFReader_LIBRARY)
SET (RBDL_URDFReader_FOUND TRUE)
ENDIF (RBDL_URDFReader_INCLUDE_DIR AND RBDL_URDFReader_LIBRARY)

IF (RBDL_FOUND)
IF (NOT RBDL_FIND_QUIETLY)
MESSAGE(STATUS "Found RBDL: ${RBDL_LIBRARY}")
ENDIF (NOT RBDL_FIND_QUIETLY)

foreach ( COMPONENT ${RBDL_FIND_COMPONENTS} )
IF (RBDL_${COMPONENT}_FOUND)
IF (NOT RBDL_FIND_QUIETLY)
MESSAGE(STATUS "Found RBDL ${COMPONENT}: ${RBDL_${COMPONENT}_LIBRARY}")
ENDIF (NOT RBDL_FIND_QUIETLY)
ELSE (RBDL_${COMPONENT}_FOUND)
MESSAGE(SEND_ERROR "Could not find RBDL ${COMPONENT}")
ENDIF (RBDL_${COMPONENT}_FOUND)
endforeach ( COMPONENT )
ELSE (RBDL_FOUND)
IF (RBDL_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Could not find RBDL")
ENDIF (RBDL_FIND_REQUIRED)
ENDIF (RBDL_FOUND)

MARK_AS_ADVANCED (
RBDL_INCLUDE_DIR
RBDL_LIBRARY
RBDL_LuaModel_INCLUDE_DIR
RBDL_LuaModel_LIBRARY
RBDL_URDFReader_INCLUDE_DIR
RBDL_URDFReader_LIBRARY
)
6 changes: 4 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ target_link_libraries(test_memory PRIVATE xbot2_interface::collision)
add_test_executable(test_collision)
target_link_libraries(test_collision PRIVATE xbot2_interface::collision)

add_executable(eigen_ref_calls_free src/eigen_ref_calls_free.cpp)
target_link_libraries(eigen_ref_calls_free Eigen3::Eigen dl)
if(COMPILER_SUPPORTS_CXX20)
add_executable(eigen_ref_calls_free src/eigen_ref_calls_free.cpp)
target_link_libraries(eigen_ref_calls_free Eigen3::Eigen dl)
endif()