-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cmake] Export project for downstream use
- Loading branch information
Showing
8 changed files
with
111 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
include(CMakePackageConfigHelpers) | ||
set(VERSION_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake") | ||
set(PROJECT_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake") | ||
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}") | ||
write_basic_package_version_file( | ||
${VERSION_CONFIG} | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in" "${PROJECT_CONFIG}" INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}") | ||
install(FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}" DESTINATION "${CONFIG_INSTALL_DIR}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_package(mc_panda REQUIRED) | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/mc_panda_lirmmTargets.cmake") | ||
|
||
check_required_components(mc_panda_lirmm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <mc_panda_lirmm/panda_lirmm.h> | ||
|
||
extern "C" | ||
{ | ||
ROBOT_MODULE_API void MC_RTC_ROBOT_MODULE(std::vector<std::string> & names) | ||
{ | ||
using namespace mc_robots; | ||
ForAllVariants([&names](PandaLIRMMRobots robot, bool pump, bool foot, bool hand, bool fixSensorFrame) | ||
{ names.push_back(NameFromParams(robot, pump, foot, hand, fixSensorFrame)); }); | ||
} | ||
ROBOT_MODULE_API void destroy(mc_rbdyn::RobotModule * ptr) | ||
{ | ||
delete ptr; | ||
} | ||
ROBOT_MODULE_API mc_rbdyn::RobotModule * create(const std::string & n) | ||
{ | ||
ROBOT_MODULE_CHECK_VERSION("PandaLIRMM") | ||
|
||
static auto variant_factory = []() | ||
{ | ||
std::map<std::string, std::function<mc_rbdyn::RobotModule *()>> variant_factory; | ||
using namespace mc_robots; | ||
ForAllVariants( | ||
[&variant_factory](PandaLIRMMRobots robot, bool pump, bool foot, bool hand, bool fixSensorFrame) | ||
{ | ||
variant_factory[NameFromParams(robot, pump, foot, hand, fixSensorFrame)] = [=]() | ||
{ return new PandaLIRMM(robot, pump, foot, hand, fixSensorFrame); }; | ||
}); | ||
return variant_factory; | ||
}(); | ||
auto it = variant_factory.find(n); | ||
if(it != variant_factory.end()) | ||
{ | ||
return it->second(); | ||
} | ||
else | ||
{ | ||
mc_rtc::log::error("PandaLIRMM module Cannot create an object of type {}", n); | ||
return nullptr; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters