Skip to content
Snippets Groups Projects
Commit 5571f154 authored by andreadelprete's avatar andreadelprete
Browse files

Fix cmake so that it can work even without coin-or LP solver.

parent 2ee806d6
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,10 @@ endif()
SETUP_PROJECT()
# Inhibit all warning messages.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
# remove flag that makes all warnings into errors
string (REPLACE "-Werror" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
MESSAGE( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} )
......@@ -48,7 +52,15 @@ else()
endif()
find_package(CDD REQUIRED)
find_package(CLP REQUIRED)
find_package(CLP)
IF("${CLP_LIBRARY}" STREQUAL "CLP_LIBRARY-NOTFOUND")
message(STATUS "CLP_LIBRARY equal to CLP_LIBRARY-NOTFOUND so I assume CLP was not found ")
else()
message(STATUS "CLP library found, defining macro CLP_FOUND")
add_definitions(-DCLP_FOUND)
endif()
SEARCH_FOR_QPOASES()
add_subdirectory (src)
......
......@@ -7,11 +7,11 @@
find_path(CDD_INCLUDE_DIR cdd/cdd.h
HINTS ${CDD_INCLUDEDIR}
HINTS ${CDD_INCLUDEDIR} /usr/include
PATH_SUFFIXES CDD )
find_library(CDD_LIBRARY NAMES libcdd
HINTS ${CDD_LIBDIR} ${CDD_LIBRARY_DIRS} )
HINTS ${CDD_LIBDIR} ${CDD_LIBRARY_DIRS} /usr/lib/libcdd.so )
set(CDD_LIBRARIES ${CDD_LIBRARY} )
set(CDD_INCLUDE_DIRS ${CDD_INCLUDE_DIR} )
......
# - Try to find libcdd
# Once done this will define
# CDD_FOUND - System has CDD
# CDD_INCLUDE_DIRS - The CDD include directories
# CDD_LIBRARIES - The libraries needed to use CDD
# CDD_DEFINITIONS - Compiler switches required for using CDD
# CLP_FOUND - System has CLP
# CLP_INCLUDE_DIRS - The CLP include directories
# CLP_LIBRARIES - The libraries needed to use CLP
# CLP_DEFINITIONS - Compiler switches required for using CLP
# /usr/include/coin, /usr/lib/libClp.so
......
......@@ -59,7 +59,7 @@ typedef const Eigen::Ref<const MatrixXX> & Cref_matrixXX;
#else
typedef Vector2 & Ref_vector2;
typedef Vector3 & Ref_vector3;
typedef VectorX & Ref_vector;
typedef VectorX & Ref_vectorX;
typedef Rotation & Ref_rotation;
typedef MatrixX3 & Ref_matrixX3;
typedef Matrix43 & Ref_matrix43;
......
......@@ -4,9 +4,13 @@ include_directories("${SRC_DIR}")
include_directories("${INCLUDE_DIR}")
include_directories("${EIGEN3_INCLUDE_DIR}")
include_directories("${CDD_INCLUDE_DIR}")
include_directories("${CLP_INCLUDE_DIR}")
include_directories("${qpOASES_INCLUDE_DIR}")
if( DEFINED CLP_FOUND)
include_directories("${CLP_INCLUDE_DIR}")
endif()
SET(LIBRARY_NAME ${PROJECT_NAME})
SET(${LIBRARY_NAME}_SOURCES
......@@ -32,9 +36,11 @@ if ( MSVC )
endif ( MSVC )
TARGET_LINK_LIBRARIES(robust-equilibrium-lib ${CDD_LIBRARY}
${qpOASES_LIBRARY}
${CLP_LIBRARY}
/usr/lib/libCoinUtils.so)
${qpOASES_LIBRARY})
if( DEFINED CLP_FOUND)
TARGET_LINK_LIBRARIES(robust-equilibrium-lib ${CLP_LIBRARY}
/usr/lib/libCoinUtils.so)
endif()
SET_TARGET_PROPERTIES(robust-equilibrium-lib PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
SET_TARGET_PROPERTIES(robust-equilibrium-lib PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
......
......@@ -4,8 +4,10 @@ include_directories("${SRC_DIR}")
include_directories("${INCLUDE_DIR}")
include_directories("${EIGEN3_INCLUDE_DIR}")
include_directories("${CDD_INCLUDE_DIR}")
include_directories("${CLP_INCLUDE_DIR}")
include_directories("${qpOASES_INCLUDE_DIR}")
if(DEFINED CLP_FOUND)
include_directories("${CLP_INCLUDE_DIR}")
endif()
PROJECT(robust-equilibrium-lib)
......
......@@ -217,7 +217,7 @@ int test_findExtremumOverLine(StaticEquilibrium &solver_to_test, StaticEquilibri
}
if(verb>0)
SEND_INFO_MSG("Test findExtremumOverLine "+solver_to_test.getName()+" VS "+solver_ground_truth.getName()+": "+toString(error_counter)+" error(s).");
cout<<"Test findExtremumOverLine "+solver_to_test.getName()+" VS "+solver_ground_truth.getName()+": "+toString(error_counter)+" error(s).\n";
return error_counter;
}
......@@ -461,9 +461,9 @@ int main()
test_computeEquilibriumRobustness(solver_DLP_oases, solver_DLP_coin, comPositions, PERF_DLP_OASES, PERF_DLP_COIN, 1);
test_computeEquilibriumRobustness(solver_DLP_oases, solver_LP_coin, comPositions, PERF_DLP_OASES, PERF_LP_COIN, 1);
test_computeEquilibriumRobustness_vs_checkEquilibrium(solver_LP_coin, solver_PP, comPositions, PERF_LP_COIN, 1);
test_computeEquilibriumRobustness_vs_checkEquilibrium(solver_LP2_coin, solver_PP, comPositions, PERF_LP2_COIN, 1);
test_computeEquilibriumRobustness_vs_checkEquilibrium(solver_DLP_coin, solver_PP, comPositions, PERF_DLP_COIN, 1);
test_computeEquilibriumRobustness_vs_checkEquilibrium(solver_LP_coin, solver_PP, comPositions, PERF_LP_COIN, NULL, 1);
test_computeEquilibriumRobustness_vs_checkEquilibrium(solver_LP2_coin, solver_PP, comPositions, PERF_LP2_COIN, NULL, 1);
test_computeEquilibriumRobustness_vs_checkEquilibrium(solver_DLP_coin, solver_PP, comPositions, PERF_DLP_COIN, NULL, 1);
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment