* Introduce make targets btest (build tests), blas (build blas lib), demos (build demos).

* remove EIGEN_BUILD_TESTS and siblings
* add summary at the end of cmake run, hopefully not too verbose
* fix build of quaternion demo
* kill remnants of old binary library option
This commit is contained in:
Benoit Jacob 2009-09-27 17:48:53 -04:00
parent 6b23cb2101
commit 92480ffd26
14 changed files with 47 additions and 173 deletions

View File

@ -33,20 +33,11 @@ include(CheckCXXCompilerFlag)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
option(EIGEN_BUILD_TESTS "Build tests" OFF)
option(EIGEN_BUILD_DEMOS "Build demos" OFF)
if(NOT WIN32)
option(EIGEN_BUILD_LIB "Build the binary shared library" OFF)
endif(NOT WIN32)
option(EIGEN_BUILD_BTL "Build benchmark suite" OFF)
if(NOT WIN32)
option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON)
endif(NOT WIN32)
if(EIGEN_BUILD_LIB)
option(EIGEN_TEST_LIB "Build the unit tests using the library (disable -pedantic)" OFF)
endif(EIGEN_BUILD_LIB)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(CMAKE_COMPILER_IS_GNUCXX)
@ -129,27 +120,32 @@ endif(EIGEN_BUILD_PKGCONFIG)
add_subdirectory(Eigen)
add_subdirectory(doc)
add_subdirectory(doc EXCLUDE_FROM_ALL)
if(EIGEN_BUILD_TESTS)
include(CTest)
add_subdirectory(test)
endif(EIGEN_BUILD_TESTS)
include(CTest)
enable_testing() # must be called from the root CMakeLists, see man page
add_subdirectory(test EXCLUDE_FROM_ALL)
add_subdirectory(unsupported)
if(EIGEN_BUILD_DEMOS)
add_subdirectory(demos)
endif(EIGEN_BUILD_DEMOS)
add_subdirectory(demos EXCLUDE_FROM_ALL)
if(EIGEN_BUILD_BLAS)
add_subdirectory(blas)
endif(EIGEN_BUILD_BLAS)
add_subdirectory(blas EXCLUDE_FROM_ALL)
# TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"?
if(EIGEN_BUILD_BTL)
add_subdirectory(bench/btl)
add_subdirectory(bench/btl EXCLUDE_FROM_ALL)
endif(EIGEN_BUILD_BTL)
if(EIGEN_BUILD_TESTS)
ei_testing_print_summary()
endif(EIGEN_BUILD_TESTS)
ei_testing_print_summary()
message("You can now do the following:")
message("Command | Description")
message("-------------+------------------------------------------------------------------")
message("make install | Install Eigen to ${CMAKE_INSTALL_PREFIX}")
message(" | Do: cmake -DCMAKE_INSTALL_PREFIX=yourprefix . to change that")
message("make test | Build and run the unit tests (using CTest)")
message(" | Note: this takes lots of time & memory! Easy on the -j option!")
message("make btest | Only build tests, don't run them")
message("make doc | Generate the API documentation, requires Doxygen & LaTeX")
message("make blas | Build BLAS library")
message("-------------+------------------------------------------------------------------")

View File

@ -1,35 +0,0 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
//
// Eigen 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.
//
// Alternatively, you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Eigen 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 Lesser General Public License or the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
#ifndef EIGEN_EXTERN_INSTANTIATIONS
#define EIGEN_EXTERN_INSTANTIATIONS
#endif
#include "../../Core"
#undef EIGEN_EXTERN_INSTANTIATIONS
#include "../../Cholesky"
namespace Eigen {
EIGEN_CHOLESKY_MODULE_INSTANTIATE();
}

View File

@ -5,13 +5,6 @@ INSTALL(FILES
DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel
)
FILE(GLOB Eigen_Core_Product_SRCS "products/*.h")
INSTALL(FILES
${Eigen_Core_Product_SRCS}
DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/products COMPONENT Devel
)
ADD_SUBDIRECTORY(products)
ADD_SUBDIRECTORY(util)
ADD_SUBDIRECTORY(arch)

View File

@ -1,47 +0,0 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
//
// Eigen 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.
//
// Alternatively, you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Eigen 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 Lesser General Public License or the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
#ifdef EIGEN_EXTERN_INSTANTIATIONS
#undef EIGEN_EXTERN_INSTANTIATIONS
#endif
#include "../../Core"
namespace Eigen
{
#define EIGEN_INSTANTIATE_PRODUCT(TYPE) \
template static void ei_cache_friendly_product<TYPE>( \
int _rows, int _cols, int depth, \
bool _lhsRowMajor, const TYPE* _lhs, int _lhsStride, \
bool _rhsRowMajor, const TYPE* _rhs, int _rhsStride, \
bool resRowMajor, TYPE* res, int resStride)
EIGEN_INSTANTIATE_PRODUCT(float);
EIGEN_INSTANTIATE_PRODUCT(double);
EIGEN_INSTANTIATE_PRODUCT(int);
EIGEN_INSTANTIATE_PRODUCT(std::complex<float>);
EIGEN_INSTANTIATE_PRODUCT(std::complex<double>);
}

View File

@ -1,38 +0,0 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
//
// Eigen 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.
//
// Alternatively, you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Eigen 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 Lesser General Public License or the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
#ifndef EIGEN_EXTERN_INSTANTIATIONS
#define EIGEN_EXTERN_INSTANTIATIONS
#endif
#include "../../Core"
#undef EIGEN_EXTERN_INSTANTIATIONS
#include "../../QR"
namespace Eigen
{
EIGEN_QR_MODULE_INSTANTIATE();
}

View File

@ -1,7 +1,9 @@
add_custom_target(blas)
set(EigenBlas_SRCS single.cpp double.cpp complex_single.cpp complex_double.cpp)
add_library(eigen_blas SHARED ${EigenBlas_SRCS})
add_dependencies(blas eigen_blas)
install(TARGETS eigen_blas
RUNTIME DESTINATION bin

View File

@ -39,6 +39,7 @@ macro(ei_add_test testname)
set(filename ${testname}.cpp)
add_executable(${targetname} ${filename})
add_dependencies(btest ${targetname})
if(NOT EIGEN_NO_ASSERTION_CHECKING)
@ -102,31 +103,31 @@ macro(ei_testing_print_summary)
if(EIGEN_TEST_SSE2)
message("SSE2: ON")
else(EIGEN_TEST_SSE2)
message("SSE2: AUTO")
message("SSE2: Using architecture defaults")
endif(EIGEN_TEST_SSE2)
if(EIGEN_TEST_SSE3)
message("SSE3: ON")
else(EIGEN_TEST_SSE3)
message("SSE3: AUTO")
message("SSE3: Using architecture defaults")
endif(EIGEN_TEST_SSE3)
if(EIGEN_TEST_SSSE3)
message("SSSE3: ON")
else(EIGEN_TEST_SSSE3)
message("SSSE3: AUTO")
message("SSSE3: Using architecture defaults")
endif(EIGEN_TEST_SSSE3)
if(EIGEN_TEST_ALTIVEC)
message("Altivec: ON")
message("Altivec: Using architecture defaults")
else(EIGEN_TEST_ALTIVEC)
message("Altivec: AUTO")
message("Altivec: Using architecture defaults")
endif(EIGEN_TEST_ALTIVEC)
if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
message("Explicit vec: OFF")
else(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
message("Explicit vec: AUTO")
message("Explicit vec: Using architecture defaults")
endif(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
message("\n${EIGEN_TESTING_SUMMARY}")

View File

@ -1,3 +1,9 @@
add_custom_target(demos)
add_subdirectory(mandelbrot)
add_subdirectory(opengl)
find_package(Qt4)
if(QT4_FOUND)
add_subdirectory(mandelbrot)
add_subdirectory(opengl)
else(QT4_FOUND)
message(STATUS "Qt4 not found, so disabling the mandelbrot and opengl demos")
endif(QT4_FOUND)

View File

@ -16,5 +16,6 @@ set(mandelbrot_SRCS
qt4_automoc(${mandelbrot_SRCS})
add_executable(mandelbrot ${mandelbrot_SRCS})
add_dependencies(demos mandelbrot)
target_link_libraries(mandelbrot ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})

View File

@ -1,7 +1,9 @@
This is an example of how one can wrap some of Eigen into a C library.
To try this with GCC, do:
g++ -c binary_library.cpp -O2 -msse2 -I ../..
gcc example.c binary_library.o -o example -lstdc++
./example
This is an example of how one can wrap some of Eigen into a C library.
TODO: add CMakeLists, add more explanations here

View File

@ -1,4 +1,3 @@
find_package(Qt4 REQUIRED)
find_package(OpenGL REQUIRED)
@ -14,6 +13,7 @@ set(quaternion_demo_SRCS gpuhelper.cpp icosphere.cpp camera.cpp trackball.cpp q
qt4_automoc(${quaternion_demo_SRCS})
add_executable(quaternion_demo ${quaternion_demo_SRCS})
add_dependencies(demos quaternion_demo)
target_link_libraries(quaternion_demo
${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}

View File

@ -260,7 +260,7 @@ void Camera::activateGL(void)
Vector3f Camera::unProject(const Vector2f& uv, float depth) const
{
Matrix4f inv = mViewMatrix.inverse();
Matrix4f inv = mViewMatrix.inverse().matrix();
return unProject(uv, depth, inv);
}

View File

@ -1,6 +1,5 @@
add_custom_target(btest)
include(EigenTesting)
enable_testing()
ei_init_testing()
find_package(GSL)

View File

@ -1,9 +1,3 @@
add_subdirectory(Eigen)
add_subdirectory(doc)
if(EIGEN_BUILD_TESTS)
add_subdirectory(test)
endif(EIGEN_BUILD_TESTS)
add_subdirectory(doc EXCLUDE_FROM_ALL)
add_subdirectory(test EXCLUDE_FROM_ALL)