Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
eiquadprog
Commits
bfa584fa
Commit
bfa584fa
authored
Sep 17, 2019
by
Guilhem Saurel
Browse files
[CMake] Packaging
- remove license headers - put headers logic in headers subdir - rewrite test without macros
parent
ace8d662
Changes
7
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
bfa584fa
#
# Copyright (c) 2019 CNRS
#
# This file is part of eiquadprog
# pinocchio is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
# pinocchio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Lesser Public License for more details. You should have
# received a copy of the GNU Lesser General Public License along with
# pinocchio If not, see
# <http://www.gnu.org/licenses/>.
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.6
)
...
...
@@ -21,9 +9,10 @@ INCLUDE(cmake/boost.cmake)
INCLUDE
(
cmake/eigen.cmake
)
INCLUDE
(
cmake/test.cmake
)
SET
(
PROJECT_NAMESPACE stack-of-tasks
)
SET
(
PROJECT_NAME eiquadprog
)
SET
(
PROJECT_DESCRIPTION
"C++ reimplementation of eiquadprog"
)
SET
(
PROJECT_URL
"https://gepgitlab.laas.fr/
gbuondon/eiquadprog
"
)
SET
(
PROJECT_URL
"https://gepgitlab.laas.fr/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
"
)
SET
(
PROJECT_CUSTOM_HEADER_EXTENSION
"hpp"
)
# Disable -Werror on Unix for now.
...
...
@@ -37,35 +26,14 @@ SETUP_PROJECT()
# ----------------------------------------------------
ADD_REQUIRED_DEPENDENCY
(
"eigen3"
)
# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
# ----------------------------------------------------
# Add headers here if any
SET
(
${
PROJECT_NAME
}
_HEADERS
include/eiquadprog/eiquadprog.hpp
include/eiquadprog/eiquadprog-fast.hpp
include/eiquadprog/eiquadprog-fast.hxx
)
INSTALL
(
FILES
${${
PROJECT_NAME
}
_HEADERS
}
DESTINATION include/
${
PROJECT_NAME
}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE
)
SET
(
BOOST_REQUIERED_COMPONENTS
""
)
SET
(
BOOST_BUILD_COMPONENTS unit_test_framework
)
SET
(
BOOST_OPTIONAL_COMPONENTS
""
)
SET
(
BOOST_COMPONENTS
${
BOOST_REQUIERED_COMPONENTS
}
${
BOOST_OPTIONAL_COMPONENTS
}
${
BOOST_BUILD_COMPONENTS
}
)
SET
(
BOOST_COMPONENTS unit_test_framework
)
SEARCH_FOR_BOOST
()
# Path to boost headers
INCLUDE_DIRECTORIES
(
SYSTEM
${
Boost_INCLUDE_DIRS
}
)
# --- PACKAGING ----------------------------------------------------------------
PKG_CONFIG_APPEND_LIBS
(
${
PROJECT_NAME
}
)
ADD_SUBDIRECTORY
(
include/
${
PROJECT_NAME
}
)
ADD_SUBDIRECTORY
(
unittest
)
SETUP_PROJECT_FINALIZE
()
include/eiquadprog/CMakeLists.txt
0 → 100644
View file @
bfa584fa
SET
(
${
PROJECT_NAME
}
_HEADERS
eiquadprog.hpp
eiquadprog-fast.hpp
eiquadprog-fast.hxx
)
INSTALL
(
FILES
${${
PROJECT_NAME
}
_HEADERS
}
DESTINATION include/
${
PROJECT_NAME
}
)
include/eiquadprog/eiquadprog-fast.hpp
View file @
bfa584fa
//
// Copyright (c) 2017 CNRS
//
// This file is part of eiquadprog
// eiquadprog is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
// eiquadprog is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// eiquadprog If not, see
// <http://www.gnu.org/licenses/>.
//
#ifndef EIQUADPROGFAST_HPP_
#define EIQUADPROGFAST_HPP_
...
...
include/eiquadprog/eiquadprog-fast.hxx
View file @
bfa584fa
//
// Copyright (c) 2017 CNRS
//
// This file is part of eiquadprog
// eiquadprog is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
// eiquadprog is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// eiquadprog If not, see
// <http://www.gnu.org/licenses/>.
//
#ifndef EIQUADPROGFAST_HXX_
#define EIQUADPROGFAST_HXX_
namespace
eiquadprog
{
namespace
solvers
...
...
@@ -43,7 +30,7 @@ namespace eiquadprog
}
return
a1
*
std
::
sqrt
(
2.0
);
}
EiquadprogFast
::
EiquadprogFast
()
{
m_maxIter
=
DEFAULT_MAX_ITER
;
...
...
@@ -177,7 +164,7 @@ namespace eiquadprog
size_t
&
iq
,
size_t
l
)
{
size_t
nVars
=
R
.
rows
();
#ifdef TRACE_SOLVER
std
::
cerr
<<
"Delete constraint "
<<
l
<<
' '
<<
iq
;
...
...
@@ -705,8 +692,8 @@ l2a:/* Step 2a: determine step direction */
goto
l2a
;
}
}
/* namespace solvers */
}
/* namespace eiquadprog */
#endif
/* EIQUADPROGFAST_HXX_ */
\ No newline at end of file
#endif
/* EIQUADPROGFAST_HXX_ */
unittest/CMakeLists.txt
View file @
bfa584fa
ADD_DEFINITIONS
(
-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN
)
#test paths and names (without .cpp extension)
SET
(
TESTS
...
...
@@ -5,29 +6,8 @@ SET (TESTS
eiquadprog-fast
)
# --- MACROS ------------------------------------------------------------------
MACRO
(
ADD_TEST_CFLAGS target flag
)
SET_PROPERTY
(
TARGET
${
target
}
APPEND_STRING PROPERTY COMPILE_FLAGS
"
${
flag
}
"
)
ENDMACRO
(
ADD_TEST_CFLAGS
)
MACRO
(
ADD_EIQUADPROG_UNIT_TEST NAME
)
SET
(
TEST_NAME
"
${
NAME
}
-test"
)
ADD_UNIT_TEST
(
${
TEST_NAME
}
${
NAME
}
.cpp
)
SET_TARGET_PROPERTIES
(
${
TEST_NAME
}
PROPERTIES LINKER_LANGUAGE CXX
)
TARGET_INCLUDE_DIRECTORIES
(
${
TEST_NAME
}
PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
)
ADD_TEST_CFLAGS
(
${
TEST_NAME
}
"-DBOOST_TEST_DYN_LINK"
)
SET
(
MODULE_NAME
"
${
NAME
}
Test"
)
STRING
(
REGEX REPLACE
"-"
"_"
MODULE_NAME
${
MODULE_NAME
}
)
ADD_TEST_CFLAGS
(
${
TEST_NAME
}
"-DBOOST_TEST_MODULE=
${
MODULE_NAME
}
"
)
PKG_CONFIG_USE_DEPENDENCY
(
${
TEST_NAME
}
eigen3
)
# TARGET_LINK_LIBRARIES(${TEST_NAME} ${PROJECT_NAME})
TARGET_LINK_LIBRARIES
(
${
TEST_NAME
}
${
Boost_UNIT_TEST_FRAMEWORK_LIBRARY
}
)
ENDMACRO
(
ADD_EIQUADPROG_UNIT_TEST
)
FOREACH
(
TEST
${
TESTS
}
)
ADD_EIQUADPROG_UNIT_TEST
(
${
TEST
}
)
ENDFOREACH
(
TEST
)
FOREACH
(
test
${
TESTS
}
)
ADD_UNIT_TEST
(
${
test
}
${
test
}
)
TARGET_LINK_LIBRARIES
(
${
test
}
${
Boost_UNIT_TEST_FRAMEWORK_LIBRARY
}
)
PKG_CONFIG_USE_DEPENDENCY
(
${
test
}
eigen3
)
ENDFOREACH
(
test
${
TESTS
}
)
unittest/eiquadprog-basic.cpp
View file @
bfa584fa
...
...
@@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE ( test_full )
Eigen
::
VectorXi
activeSet
(
2
);
size_t
activeSetSize
;
Eigen
::
VectorXd
solution
(
1
);
Eigen
::
VectorXd
solution
(
2
);
solution
(
0
)
=
2.
;
solution
(
1
)
=
3.
;
...
...
unittest/eiquadprog-fast.cpp
View file @
bfa584fa
...
...
@@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE ( test_full )
Eigen
::
VectorXd
x
(
2
);
Eigen
::
VectorXd
solution
(
1
);
Eigen
::
VectorXd
solution
(
2
);
solution
(
0
)
=
2.
;
solution
(
1
)
=
3.
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment