Commit fed08f51 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

clean cmake

parent facb7365
cmake_minimum_required(VERSION 2.6)
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/test.cmake)
INCLUDE(cmake/python.cmake)
INCLUDE(cmake2/FindqpOASES.cmake)
SET(PROJECT_NAME centroidal-dynamics-lib)
SET(PROJECT_ORG stonneau)
SET(PROJECT_NAME hpp-centroidal-dynamics)
SET(PROJECT_DESCRIPTION
"Utility classes for testing (robust) equilibrium of a system in contact with the environment, and other centroidal dynamics methods."
)
SET(PROJECT_URL "")
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/;${PROJECT_SOURCE_DIR}/cmake2/")
set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/lib/")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/build/")
set(SRC_DIR "${PROJECT_SOURCE_DIR}/src")
set(INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
set(EXTERNAL_LIBRARY_DIR "${PROJECT_SOURCE_DIR}/external/lib")
if ( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX")
endif()
SETUP_PROJECT()
......@@ -56,13 +48,8 @@ SET(${PROJECT_NAME}_HEADERS
include/centroidal-dynamics-lib/stop-watch.hh
)
find_package(Eigen3)
if (EIGEN3_INCLUDE_DIR)
message(STATUS "Found Eigen3")
else()
message(STATUS "Eigen3 not found looking for Eigen2")
find_package(Eigen2 REQUIRED)
endif()
ADD_REQUIRED_DEPENDENCY("eigen3")
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIR})
find_package(CDD REQUIRED)
find_package(CLP)
......@@ -84,4 +71,3 @@ IF(BUILD_PYTHON_INTERFACE)
ENDIF(BUILD_PYTHON_INTERFACE)
SETUP_PROJECT_FINALIZE()
Subproject commit ad5a5486c4476e5e92cfd688b82467b54957a570
Subproject commit 320c636960b03b3bad7c7a08bd2e104951f42bc3
cmake_minimum_required( VERSION 2.8 )
include_directories("${INCLUDE_DIR}")
include_directories("${EIGEN3_INCLUDE_DIR}")
ADD_REQUIRED_DEPENDENCY("eigenpy")
# Define the wrapper library that wraps our library
add_library( centroidal_dynamics SHARED centroidal_dynamics_python.cpp )
target_link_libraries( centroidal_dynamics ${Boost_LIBRARIES} ${PROJECT_NAME} )
......@@ -19,5 +15,5 @@ ENDIF(APPLE)
PKG_CONFIG_USE_DEPENDENCY(centroidal_dynamics eigenpy)
INSTALL(
FILES ${LIBRARY_OUTPUT_PATH}/centroidal_dynamics.so DESTINATION ${PYTHON_SITELIB}
TARGETS centroidal_dynamics DESTINATION ${PYTHON_SITELIB}
)
cmake_minimum_required(VERSION 2.6)
include_directories("${SRC_DIR}")
include_directories("${INCLUDE_DIR}")
include_directories("${EIGEN3_INCLUDE_DIR}")
include_directories("${CDD_INCLUDE_DIR}")
# no need to include directories for qpOASES as it is automatically done through pkgconfig
if(CLP_FOUND)
include_directories("${CLP_INCLUDE_DIR}")
......@@ -14,12 +9,12 @@ endif()
SET(LIBRARY_NAME ${PROJECT_NAME})
SET(${LIBRARY_NAME}_SOURCES
${INCLUDE_DIR}/centroidal-dynamics-lib/config.hh
${INCLUDE_DIR}/centroidal-dynamics-lib/util.hh
${INCLUDE_DIR}/centroidal-dynamics-lib/solver_LP_abstract.hh
${INCLUDE_DIR}/centroidal-dynamics-lib/solver_LP_qpoases.hh
${INCLUDE_DIR}/centroidal-dynamics-lib/solver_LP_clp.hh
${INCLUDE_DIR}/centroidal-dynamics-lib/centroidal_dynamics.hh
#${INCLUDE_DIR}/centroidal-dynamics-lib/config.hh
#${INCLUDE_DIR}/centroidal-dynamics-lib/util.hh
#${INCLUDE_DIR}/centroidal-dynamics-lib/solver_LP_abstract.hh
#${INCLUDE_DIR}/centroidal-dynamics-lib/solver_LP_qpoases.hh
#${INCLUDE_DIR}/centroidal-dynamics-lib/solver_LP_clp.hh
#${INCLUDE_DIR}/centroidal-dynamics-lib/centroidal_dynamics.hh
centroidal_dynamics.cpp
solver_LP_abstract.cpp
solver_LP_qpoases.cpp
......@@ -29,13 +24,8 @@ SET(${LIBRARY_NAME}_SOURCES
stop-watch.cpp
)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${${LIBRARY_NAME}_SOURCES})
if ( MSVC )
SET(CMAKE_DEBUG_POSTFIX d)
endif ( MSVC )
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CDD_LIBRARIES})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} qpOASES)
......@@ -44,7 +34,4 @@ if(CLP_FOUND)
/usr/lib/libCoinUtils.so)
endif()
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION lib)
cmake_minimum_required(VERSION 2.6)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
include_directories("${INCLUDE_DIR}")
include_directories("${EIGEN3_INCLUDE_DIR}")
include_directories("${CDD_INCLUDE_DIR}")
# Make Boost.Test generates the main function in test cases.
#ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
# ADD_TESTCASE(NAME)
# ------------------------
#
# Define a test named `NAME'.
#
# This macro will create a binary from `NAME.cc', link it against
# Boost and add it to the test suite.
#
MACRO(ADD_TESTCASE NAME GENERATED)
IF (${GENERATED} STREQUAL TRUE)
ADD_EXECUTABLE(${NAME} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.cpp)
ELSE()
ADD_EXECUTABLE(${NAME} ${NAME}.cpp)
ENDIF()
ADD_TEST(${NAME} ${RUNTIME_OUTPUT_DIRECTORY}/${NAME})
# Link against Boost and project library.
TARGET_LINK_LIBRARIES(${NAME}
${Boost_LIBRARIES}
${PROJECT_NAME}
)
ENDMACRO(ADD_TESTCASE)
if ( MSVC )
SET(CMAKE_DEBUG_POSTFIX d)
endif ( MSVC )
ADD_TESTCASE(test_static_equilibrium FALSE)
ADD_TESTCASE(test_LP_solvers FALSE)
PKG_CONFIG_USE_DEPENDENCY(test_LP_solvers qpOASES)
ADD_UNIT_TEST(static-equilibrium test_static_equilibrium)
PKG_CONFIG_USE_DEPENDENCY(static-equilibrium eigen3)
TARGET_LINK_LIBRARIES(static-equilibrium ${PROJECT_NAME})
ADD_UNIT_TEST(lp-solvers test_LP_solvers)
PKG_CONFIG_USE_DEPENDENCY(lp-solvers qpOASES)
PKG_CONFIG_USE_DEPENDENCY(lp-solvers eigen3)
TARGET_LINK_LIBRARIES(lp-solvers ${PROJECT_NAME})
......@@ -469,7 +469,7 @@ int main()
if(!readMatrixFromFile(file_path+solution_filename+".dat", realSol))
{
SEND_ERROR_MSG("Error while reading LP solution from file "+solution_filename);
return -1;
//return -1;
}
sol.resize(c.size());
solverOases->solve(c, lb, ub, A, Alb, Aub, sol);
......
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