Unverified Commit 6cdcde30 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #14 from jcarpent/master

Simplify cmake files
parents b63ad911 adc5ebdd
#
# Copyright (c) 2017 CNRS
# Copyright (c) 2017-2018 CNRS
#
# This file is part of tsid
# pinocchio is free software: you can redistribute it
......@@ -21,25 +21,18 @@ INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/python.cmake)
INCLUDE(cmake/ide.cmake)
INCLUDE(cmake/apple.cmake)
SET(PROJECT_NAME tsid)
SET(PROJECT_DESCRIPTION "Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio")
SET(PROJECT_URL "http://github.com/stack-of-tasks/tsid")
OPTION(INSTALL_DOCUMENTATION "Generate and install the documentation" FALSE)
OPTION(INSTALL_DOCUMENTATION "Generate and install the documentation" OFF)
SET(DOXYGEN_USE_MATHJAX YES)
# Handle APPLE Cmake policy
IF(APPLE)
SET(CMAKE_MACOSX_RPATH TRUE)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif("${isSystemDir}" STREQUAL "-1")
APPLY_DEFAULT_APPLE_CONFIGURATION()
ENDIF(APPLE)
# Disable -Werror on Unix for now.
......
Subproject commit d22de8c53c3507df785b1fb3ab260d9fdfb65233
Subproject commit bf10c6ca3565b96ab283edaa8f18b5b533e59da9
......@@ -94,7 +94,7 @@ namespace tsid
const se3::SE3 & Mdes,
se3::Motion & error);
void solveWithDampingFromSvd(Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject> & svd,
void solveWithDampingFromSvd(Eigen::JacobiSVD<Eigen::MatrixXd> & svd,
ConstRefVector b,
RefVector sol, double damping=0.0);
......@@ -107,13 +107,13 @@ namespace tsid
unsigned int computationOptions = Eigen::ComputeThinU | Eigen::ComputeThinV);
void pseudoInverse(ConstRefMatrix A,
Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject>& svdDecomposition,
Eigen::JacobiSVD<Eigen::MatrixXd>& svdDecomposition,
RefMatrix Apinv,
double tolerance,
unsigned int computationOptions);
void pseudoInverse(ConstRefMatrix A,
Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject>& svdDecomposition,
Eigen::JacobiSVD<Eigen::MatrixXd>& svdDecomposition,
RefMatrix Apinv,
double tolerance,
double * nullSpaceBasisOfA,
......@@ -122,7 +122,7 @@ namespace tsid
unsigned int computationOptions);
void dampedPseudoInverse(ConstRefMatrix A,
Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject>& svdDecomposition,
Eigen::JacobiSVD<Eigen::MatrixXd>& svdDecomposition,
RefMatrix Apinv,
double tolerance,
double dampingFactor,
......@@ -130,12 +130,12 @@ namespace tsid
double * nullSpaceBasisOfA=0,
int *nullSpaceRows=0, int *nullSpaceCols=0);
void nullSpaceBasisFromDecomposition(const Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject> & svdDecomposition,
void nullSpaceBasisFromDecomposition(const Eigen::JacobiSVD<Eigen::MatrixXd> & svdDecomposition,
double tolerance,
double * nullSpaceBasisMatrix,
int &rows, int &cols);
void nullSpaceBasisFromDecomposition(const Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject> & svdDecomposition,
void nullSpaceBasisFromDecomposition(const Eigen::JacobiSVD<Eigen::MatrixXd> & svdDecomposition,
int rank,
double * nullSpaceBasisMatrix,
int &rows, int &cols);
......
......@@ -52,7 +52,7 @@ namespace tsid
error = se3::log6(Mdes.inverse() * M);
}
void solveWithDampingFromSvd(Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject> & svd,
void solveWithDampingFromSvd(Eigen::JacobiSVD<Eigen::MatrixXd> & svd,
ConstRefVector b,
RefVector sol, double damping)
{
......@@ -77,7 +77,7 @@ namespace tsid
RefVector sol, double damping)
{
assert(A.rows()==b.size());
Eigen::JacobiSVD<typename Eigen::MatrixXd::PlainObject> svd(A.rows(), A.cols());
Eigen::JacobiSVD<Eigen::MatrixXd> svd(A.rows(), A.cols());
svd.compute(A, Eigen::ComputeThinU | Eigen::ComputeThinV);
solveWithDampingFromSvd(svd, b, sol, damping);
......@@ -89,12 +89,12 @@ namespace tsid
unsigned int computationOptions)
{
Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject> svdDecomposition(A.rows(), A.cols());
Eigen::JacobiSVD<Eigen::MatrixXd> svdDecomposition(A.rows(), A.cols());
pseudoInverse(A, svdDecomposition, Apinv, tolerance, computationOptions);
}
void pseudoInverse(ConstRefMatrix A,
Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject>& svdDecomposition,
Eigen::JacobiSVD<Eigen::MatrixXd> & svdDecomposition,
RefMatrix Apinv,
double tolerance,
unsigned int computationOptions)
......@@ -106,7 +106,7 @@ namespace tsid
}
void pseudoInverse(ConstRefMatrix A,
Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject>& svdDecomposition,
Eigen::JacobiSVD<Eigen::MatrixXd> & svdDecomposition,
RefMatrix Apinv,
double tolerance,
double * nullSpaceBasisOfA,
......@@ -118,7 +118,7 @@ namespace tsid
if (computationOptions == 0) return; //if no computation options we cannot compute the pseudo inverse
svdDecomposition.compute(A, computationOptions);
JacobiSVD<MatrixXd::PlainObject>::SingularValuesType singularValues = svdDecomposition.singularValues();
JacobiSVD<MatrixXd>::SingularValuesType singularValues = svdDecomposition.singularValues();
long int singularValuesSize = singularValues.size();
int rank = 0;
for (long int idx = 0; idx < singularValuesSize; idx++) {
......@@ -140,7 +140,7 @@ namespace tsid
}
void dampedPseudoInverse(ConstRefMatrix A,
Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject>& svdDecomposition,
Eigen::JacobiSVD<Eigen::MatrixXd>& svdDecomposition,
RefMatrix Apinv,
double tolerance,
double dampingFactor,
......@@ -153,7 +153,7 @@ namespace tsid
if (computationOptions == 0) return; //if no computation options we cannot compute the pseudo inverse
svdDecomposition.compute(A, computationOptions);
JacobiSVD<MatrixXd::PlainObject>::SingularValuesType singularValues = svdDecomposition.singularValues();
JacobiSVD<MatrixXd>::SingularValuesType singularValues = svdDecomposition.singularValues();
//rank will be used for the null space basis.
//not sure if this is correct
......@@ -178,13 +178,13 @@ namespace tsid
}
}
void nullSpaceBasisFromDecomposition(const Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject>& svdDecomposition,
void nullSpaceBasisFromDecomposition(const Eigen::JacobiSVD<Eigen::MatrixXd>& svdDecomposition,
double tolerance,
double * nullSpaceBasisMatrix,
int &rows, int &cols)
{
using namespace Eigen;
JacobiSVD<MatrixXd::PlainObject>::SingularValuesType singularValues = svdDecomposition.singularValues();
JacobiSVD<MatrixXd>::SingularValuesType singularValues = svdDecomposition.singularValues();
int rank = 0;
for (int idx = 0; idx < singularValues.size(); idx++) {
if (tolerance > 0 && singularValues(idx) > tolerance) {
......@@ -195,7 +195,7 @@ namespace tsid
}
void nullSpaceBasisFromDecomposition(const Eigen::JacobiSVD<Eigen::MatrixXd::PlainObject> & svdDecomposition,
void nullSpaceBasisFromDecomposition(const Eigen::JacobiSVD<Eigen::MatrixXd> & svdDecomposition,
int rank,
double * nullSpaceBasisMatrix,
int &rows, int &cols)
......
......@@ -18,16 +18,20 @@
# --- MACROS ------------------------------------------------------------------
# --- MACROS ------------------------------------------------------------------
IF(BUILD_UNIT_TESTS)
SET(DISABLE_TESTS OFF)
ELSE(BUILD_UNIT_TESTS)
SET(DISABLE_TESTS ON)
ENDIF(BUILD_UNIT_TESTS)
include(../cmake/test.cmake)
MACRO(ADD_TEST_CFLAGS target flag)
SET_PROPERTY(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS " ${flag}")
ENDMACRO(ADD_TEST_CFLAGS)
MACRO(ADD_UNIT_TEST NAME PKGS)
IF (BUILD_UNIT_TESTS)
ADD_EXECUTABLE(${NAME} ${NAME})
ELSE (BUILD_UNIT_TESTS)
ADD_EXECUTABLE(${NAME} EXCLUDE_FROM_ALL ${NAME})
ENDIF (BUILD_UNIT_TESTS)
MACRO(ADD_TESTCASE NAME PKGS)
ADD_UNIT_TEST(${NAME} ${NAME})
SET_TARGET_PROPERTIES(${NAME} PROPERTIES LINKER_LANGUAGE CXX)
ADD_TEST_CFLAGS(${NAME} "-DBOOST_TEST_DYN_LINK")
SET(MODULE_NAME "${NAME}Test")
......@@ -40,34 +44,26 @@ MACRO(ADD_UNIT_TEST NAME PKGS)
TARGET_LINK_LIBRARIES(${NAME} ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
ADD_TEST(NAME ${NAME} COMMAND ${NAME})
ADD_DEPENDENCIES(check ${NAME})
ENDMACRO(ADD_UNIT_TEST)
ENDMACRO(ADD_TESTCASE)
# --- RULES -------------------------------------------------------------------
# --- RULES -------------------------------------------------------------------
# --- RULES -------------------------------------------------------------------
IF(APPLE)
ADD_CUSTOM_TARGET(check COMMAND export DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH} && ${CMAKE_CTEST_COMMAND})
ELSE(APPLE)
ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
ENDIF(APPLE)
ADD_UNIT_TEST(constraints "eigen3;pinocchio")
ADD_UNIT_TEST(trajectories "eigen3;pinocchio")
ADD_TESTCASE(constraints "eigen3;pinocchio")
ADD_TESTCASE(trajectories "eigen3;pinocchio")
ADD_UNIT_TEST(robot-wrapper "eigen3;pinocchio")
ADD_TESTCASE(robot-wrapper "eigen3;pinocchio")
ADD_TEST_CFLAGS(robot-wrapper '-DTSID_SOURCE_DIR=\\\"${${PROJECT_NAME}_SOURCE_DIR}\\\"')
ADD_UNIT_TEST(tasks "eigen3;pinocchio")
ADD_TESTCASE(tasks "eigen3;pinocchio")
ADD_TEST_CFLAGS(tasks '-DTSID_SOURCE_DIR=\\\"${${PROJECT_NAME}_SOURCE_DIR}\\\"')
ADD_UNIT_TEST(contacts "eigen3;pinocchio")
ADD_TESTCASE(contacts "eigen3;pinocchio")
ADD_TEST_CFLAGS(contacts '-DTSID_SOURCE_DIR=\\\"${${PROJECT_NAME}_SOURCE_DIR}\\\"')
ADD_UNIT_TEST(tsid-formulation "eigen3;pinocchio")
ADD_TESTCASE(tsid-formulation "eigen3;pinocchio")
ADD_TEST_CFLAGS(tsid-formulation '-DTSID_SOURCE_DIR=\\\"${${PROJECT_NAME}_SOURCE_DIR}\\\"')
ADD_UNIT_TEST(math_utils "eigen3;pinocchio")
ADD_UNIT_TEST(hqp_solvers "eigen3;pinocchio")
ADD_TESTCASE(math_utils "eigen3;pinocchio")
ADD_TESTCASE(hqp_solvers "eigen3;pinocchio")
Markdown is supported
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