Commit 8e85b3fe authored by jcarpent's avatar jcarpent
Browse files

[CMake] Rework unit tests

parent a6867bd9
......@@ -48,6 +48,7 @@ ENDIF(APPLE)
# --- OPTIONS ---------------------------------------
# ----------------------------------------------------
OPTION (EIGEN_NUMPY_ALIGNED "Directly aligned data between Numpy and Eigen" OFF)
OPTION (BUILD_UNIT_TESTS "Build the unitary tests" ON)
IF(EIGEN_NUMPY_ALIGNED)
ADD_DEFINITIONS(-DEIGENPY_ALIGNED)
......@@ -104,7 +105,6 @@ ENDFOREACH(header)
# ----------------------------------------------------
# --- TARGETS ----------------------------------------
# ----------------------------------------------------
SET(${PROJECT_NAME}_SOURCES
src/exception.cpp
src/eigenpy.cpp
......@@ -122,15 +122,11 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
# ----------------------------------------------------
# --- UNIT TEST --------------------------------------
# ----------------------------------------------------
ADD_LIBRARY(matrix SHARED unittest/matrix.cpp)
TARGET_LINK_LIBRARIES(matrix ${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(matrix)
SET_TARGET_PROPERTIES(matrix PROPERTIES PREFIX "")
ADD_LIBRARY(geometry SHARED unittest/geometry.cpp)
TARGET_LINK_LIBRARIES(geometry ${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(geometry)
SET_TARGET_PROPERTIES(geometry PROPERTIES PREFIX "")
ADD_SUBDIRECTORY(unittest)
# ----------------------------------------------------
# --- EXECUTABLES ------------------------------------
# ----------------------------------------------------
IF(EIGEN_NUMPY_ALIGNED)
PKG_CONFIG_APPEND_CFLAGS("-DEIGENPY_ALIGNED")
......
#
# Copyright (c) 2016 CNRS
#
# This file is part of eigenpy
# 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/>.
MACRO(ADD_LIB_UNIT_TEST test PKGS)
IF (BUILD_UNIT_TESTS)
ADD_LIBRARY(${test} SHARED ${test})
ELSE (BUILD_UNIT_TESTS)
ADD_LIBRARY(${test} SHARED EXCLUDE_FROM_ALL ${test})
ENDIF (BUILD_UNIT_TESTS)
FOREACH(PKG ${PKGS})
PKG_CONFIG_USE_DEPENDENCY(${test} ${PKG})
ENDFOREACH(PKG)
TARGET_LINK_LIBRARIES(${test} ${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(${test})
SET_TARGET_PROPERTIES(${test} PROPERTIES PREFIX "")
IF(APPLE)
# We need to change the extension for python bindings
SET_TARGET_PROPERTIES(${test} PROPERTIES SUFFIX ".so")
ENDIF(APPLE)
#ADD_TEST(test ${test} COMMAND ${test})
#ADD_DEPENDENCIES(check ${test})
ENDMACRO(ADD_LIB_UNIT_TEST)
ADD_LIB_UNIT_TEST(matrix "eigen3")
ADD_LIB_UNIT_TEST(geometry "eigen3")
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