[eigen] GTest occasionally segfaults with Quaterniond typedef? |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2) PROJECT(unitTesting) INCLUDE(ExternalProject) SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) FIND_PACKAGE(Eigen3) FIND_PACKAGE(Threads) ADD_DEFINITIONS( -O3 -DAPL=0 -DIBM=0 -DLIN=1 -DNDEBUG -DXPLM200 -DXPLM210 -Wall -Wextra -fvisibility=hidden -fPIC -g -march=native -pedantic -pthread ) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -fms-extensions") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -fms-extensions") SET(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gtest") EXTERNALPROJECT_ADD(GTestExternal PREFIX "${GTEST_PREFIX}" URL https://googletest.googlecode.com/files/gtest-1.7.0.zip URL_HASH SHA1=f85f6d2481e2c6c4a18539e391aa4ea8ab0394af INSTALL_COMMAND "" ) SET(LIBPREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}") SET(LIBSUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}") SET(GTEST_LOCATION "${GTEST_PREFIX}/src/GTestExternal-build") SET(GTEST_LIBRARY "${GTEST_LOCATION}/${LIBPREFIX}gtest${LIBSUFFIX}") SET(GTEST_MAINLIB "${GTEST_LOCATION}/${LIBPREFIX}gtest_main${LIBSUFFIX}") ADD_LIBRARY(GTest IMPORTED STATIC GLOBAL) SET_TARGET_PROPERTIES(GTest PROPERTIES IMPORTED_LOCATION "${GTEST_LIBRARY}" IMPORTED_LINK_INTERFACE_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}" ) ADD_LIBRARY(GTestMain IMPORTED STATIC GLOBAL) SET_TARGET_PROPERTIES(GTestMain PROPERTIES IMPORTED_LOCATION "${GTEST_MAINLIB}" IMPORTED_LINK_INTERFACE_LIBRARIES "${GTEST_LIBRARY};${CMAKE_THREAD_LIBS_INIT}" ) ADD_DEPENDENCIES(GTest GTestExternal) ADD_DEPENDENCIES(GTestMain GTestExternal) EXTERNALPROJECT_GET_PROPERTY(GTestExternal source_dir) INCLUDE_DIRECTORIES( eigen ${EIGEN3_INCLUDE_DIR} ${source_dir}/include ) SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LD_VERSION_SCRIPT_FLAG}") ADD_EXECUTABLE(unitTests QuaternionTest.cpp ) TARGET_LINK_LIBRARIES(unitTests GTestMain )
Attachment:
compile.sh
Description: Bourne shell script
/** * @file QuaternionTest.cpp * @copyright Grey Point Corporation */ #include "gtest/gtest.h" #include <Eigen/Dense> #include <Eigen/Geometry> #include <iostream> class QuaternionTest : public ::testing::Test { public: //EIGEN_MAKE_ALIGNED_OPERATOR_NEW protected: virtual void SetUp() { vector1 = Eigen::Vector4d(1., 1., 1., 1.); quaternion1 = Eigen::Quaterniond::Identity(); } Eigen::Vector4d vector1; Eigen::Quaterniond quaternion1; }; TEST_F(QuaternionTest, assignment) { // ASSERT_EQ(vector1, Eigen::Vector4d(1., 1., 1., 1.)); // ASSERT_EQ(quaternion1.w(), 1.0); // ASSERT_EQ(quaternion1.y(), 0.0); // ASSERT_EQ(quaternion1.x(), 0.0); // ASSERT_EQ(quaternion1.z(), 0.0); }
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |