Commit 51c3c8e1 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

Merge pull request #22 from fvalenza/master

Fixing inclusion of Lua and urdfdom whereas they were not found
parents bd096576 a5328dc5
......@@ -136,22 +136,23 @@ SET(HEADERS
)
IF(URDFDOM_FOUND)
LIST(APPEND HEADERS multibody/parser/urdf.hpp)
SET(${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
${${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS}
multibody/parser/urdf.hpp
)
LIST(APPEND HEADERS
${${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS}
)
ENDIF(URDFDOM_FOUND)
IF(LUA5_1_FOUND)
LIST(APPEND HEADERS
SET(${PROJECT_NAME}_MULTIBODY_PARSER_LUA_HEADERS
multibody/parser/lua.hpp
multibody/parser/lua/lua_tables.hpp
)
SET(${PROJECT_NAME}_MULTIBODY_PARSER_LUA_HEADERS
multibody/parser/lua.hpp
multibody/parser/lua/lua_tables.hpp
LIST(APPEND HEADERS
${${PROJECT_NAME}_MULTIBODY_PARSER_LUA_HEADERS}
)
ENDIF(LUA5_1_FOUND)
......
......@@ -18,6 +18,11 @@ MACRO(ADD_SOURCE_GROUP FILENAMES)
ADD_GROUP("Source Files" ${FILENAMES})
ENDMACRO(ADD_SOURCE_GROUP FILENAMES)
MACRO(ADD_TARGET_CFLAGS target flag)
GET_TARGET_PROPERTY(${target}_CFLAGS ${target} COMPILE_FLAGS)
SET_PROPERTY(TARGET ${target} PROPERTY COMPILE_FLAGS "${${target}_CFLAGS} ${flag}")
ENDMACRO(ADD_TARGET_CFLAGS)
# ----------------------------------------------------
# --- C++ --------------------------------------------
# ----------------------------------------------------
......@@ -70,6 +75,12 @@ IF(EIGENPY_FOUND)
TARGET_LINK_LIBRARIES(${PYWRAP} ${Boost_LIBRARIES} ${PROJECT_NAME})
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/python/${PROJECT_NAME}")
IF(URDFDOM_FOUND)
ADD_TARGET_CFLAGS (${PYWRAP} "-DWITH_URDFDOM")
ENDIF(URDFDOM_FOUND)
IF(LUA5_1_FOUND)
ADD_TARGET_CFLAGS (${PYWRAP} "-DWITH_LUA")
ENDIF(LUA5_1_FOUND)
INSTALL(FILES
"${CMAKE_BINARY_DIR}/lib/python/${PROJECT_NAME}/lib${PYWRAP}.so"
DESTINATION ${PYTHON_SITELIB}/${PROJECT_NAME})
......
......@@ -7,8 +7,13 @@
#include "pinocchio/python/model.hpp"
#include "pinocchio/python/data.hpp"
#include "pinocchio/multibody/parser/urdf.hpp"
#include "pinocchio/multibody/parser/lua.hpp"
#ifdef WITH_URDFDOM
#include "pinocchio/multibody/parser/urdf.hpp"
#endif
#ifdef WITH_LUA
#include "pinocchio/multibody/parser/lua.hpp"
#endif // #ifdef WITH_LUA
namespace se3
{
......@@ -16,6 +21,8 @@ namespace se3
{
struct ParsersPythonVisitor
{
#ifdef WITH_URDFDOM
static ModelHandler buildModelFromUrdf( const std::string & filename,
bool ff )
{
......@@ -23,7 +30,9 @@ namespace se3
*model = se3::urdf::buildModel(filename,ff);
return ModelHandler(model,true);
}
#endif
#ifdef WITH_LUA
static ModelHandler buildModelFromLua(const std::string & filename,
bool ff,
bool verbose
......@@ -33,27 +42,33 @@ namespace se3
*model = se3::lua::buildModel (filename, ff, verbose);
return ModelHandler (model,true);
}
#endif // #ifdef WITH_LUA
/* --- Expose --------------------------------------------------------- */
static void expose()
{
#ifdef WITH_URDFDOM
bp::def("buildModelFromUrdf",buildModelFromUrdf,
bp::args("Filename (string)",
"Free flyer (bool, false for a fixed robot)"),
"Parse the urdf file given in input and return a proper pinocchio model "
"(remember to create the corresponding data structure).");
#endif
#ifdef WITH_LUA
bp::def("buildModelFromLua",buildModelFromLua,
bp::args("Filename (string)",
"Free flyer (bool, false for a fixed robot)",
"Verbose option "),
"Parse the urdf file given in input and return a proper pinocchio model "
"(remember to create the corresponding data structure).");
#endif // #ifdef WITH_LUA
}
};
}} // namespace se3::python
#endif // ifndef __se3_python_data_hpp__
#endif // ifndef __se3_python_parsers_hpp__
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