Commit 30f3f35a authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] clean

parent 979a857b
cmake_minimum_required(VERSION 2.6)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/test.cmake)
......@@ -14,55 +14,42 @@ SET(CUSTOM_HEADER_DIR "hpp/centroidal-dynamics")
SETUP_HPP_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} )
OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON)
OPTION(BUILD_PYTHON_INTERFACE "Build the python binding" ON)
IF(BUILD_PYTHON_INTERFACE)
# search for python
FINDPYTHON(2.7 EXACT REQUIRED)
find_package( PythonLibs 2.7 REQUIRED )
include_directories( ${PYTHON_INCLUDE_DIRS} )
FINDPYTHON()
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
ADD_REQUIRED_DEPENDENCY("eigenpy")
find_package( Boost COMPONENTS python REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )
FIND_PACKAGE(Boost COMPONENTS python REQUIRED )
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIR})
ENDIF(BUILD_PYTHON_INTERFACE)
ADD_REQUIRED_DEPENDENCY("eigen3")
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(SYSTEM ${EIGEN3_INCLUDE_DIRS})
set(CMAKE_MODULE_PATH
SET(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake/find-external/CDD
${PROJECT_SOURCE_DIR}/cmake/find-external/CLP
${PROJECT_SOURCE_DIR}/cmake/find-external/qpOASES
)
find_package(CDD REQUIRED)
find_package(qpOASES REQUIRED)
find_package(CLP)
FIND_PACKAGE(CDD REQUIRED)
FIND_PACKAGE(qpOASES 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()
IF(CLP_FOUND)
ADD_DEFINITIONS(-DCLP_FOUND)
INCLUDE_DIRECTORIES("${CLP_INCLUDE_DIR}")
ENDIF()
INCLUDE_DIRECTORIES(${qpOASES_INCLUDE_DIRS})
ADD_SUBDIRECTORY (include/${CUSTOM_HEADER_DIR})
add_subdirectory (src)
add_subdirectory (test)
ADD_SUBDIRECTORY(include/${CUSTOM_HEADER_DIR})
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)
IF(BUILD_PYTHON_INTERFACE)
add_subdirectory (python)
ADD_SUBDIRECTORY(python)
ENDIF(BUILD_PYTHON_INTERFACE)
SETUP_PROJECT_FINALIZE()
# Declare Headers
SET(${PROJECT_NAME}_HEADERS
local_config.hh
util.hh
......@@ -12,5 +11,5 @@ SET(${PROJECT_NAME}_HEADERS
INSTALL(FILES
${${PROJECT_NAME}_HEADERS}
DESTINATION include/hpp/centroidal-dynamics
DESTINATION include/${CUSTOM_HEADER_DIR}
)
cmake_minimum_required( VERSION 2.8 )
STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
# Define the wrapper library that wraps our library
add_library( ${PY_NAME} SHARED centroidal_dynamics_python.cpp )
target_link_libraries( ${PY_NAME} ${Boost_LIBRARIES} ${PROJECT_NAME} )
ADD_LIBRARY(${PY_NAME} SHARED centroidal_dynamics_python.cpp)
TARGET_LINK_LIBRARIES(${PY_NAME} ${Boost_LIBRARIES} ${PROJECT_NAME})
# don't prepend wrapper library name with lib
set_target_properties( ${PY_NAME} PROPERTIES PREFIX "" )
SET_TARGET_PROPERTIES(${PY_NAME} PROPERTIES PREFIX "")
IF(APPLE)
# We need to change the extension for python bindings
......@@ -14,8 +12,6 @@ IF(APPLE)
ENDIF(APPLE)
PKG_CONFIG_USE_DEPENDENCY(${PY_NAME} eigenpy)
INSTALL(
TARGETS ${PY_NAME} DESTINATION ${PYTHON_SITELIB}
)
INSTALL(TARGETS ${PY_NAME} DESTINATION ${PYTHON_SITELIB})
ADD_PYTHON_UNIT_TEST("python-centroidal-dynamics" "python/test/binding_tests.py" "python")
cmake_minimum_required(VERSION 2.6)
if(CLP_FOUND)
include_directories("${CLP_INCLUDE_DIR}")
endif()
SET(LIBRARY_NAME ${PROJECT_NAME})
SET(${LIBRARY_NAME}_SOURCES
......@@ -23,9 +16,8 @@ TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CDD_LIBRARIES} ${qpOASES_LIBRARY})
TARGET_INCLUDE_DIRECTORIES(${LIBRARY_NAME} PUBLIC ${CDD_INCLUDE_DIRS})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} eigen3)
if(CLP_FOUND)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CLP_LIBRARIES}
/usr/lib/libCoinUtils.so)
endif()
IF(CLP_FOUND)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CLP_LIBRARIES})
ENDIF(CLP_FOUND)
INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION lib)
cmake_minimum_required(VERSION 2.6)
# Make Boost.Test generates the main function in test cases.
#ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
ADD_UNIT_TEST(static-equilibrium test_static_equilibrium)
PKG_CONFIG_USE_DEPENDENCY(static-equilibrium eigen3)
TARGET_LINK_LIBRARIES(static-equilibrium ${PROJECT_NAME})
......
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