Skip to content

Commit

Permalink
* eigen2->eigen3
Browse files Browse the repository at this point in the history
* bump version to 2.91.0
* add FindEigen3.cmake
  • Loading branch information
bjacob committed Nov 19, 2009
1 parent cf06c60 commit 293c79d
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 41 deletions.
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
endif()

# automatically parse the version number
file(READ "${CMAKE_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen2_world_version_match "${_eigen2_version_header}")
set(EIGEN2_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen2_major_version_match "${_eigen2_version_header}")
set(EIGEN2_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen2_minor_version_match "${_eigen2_version_header}")
set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN_VERSION_NUMBER ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION})
file(READ "${CMAKE_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}")
set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}")
set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}")
set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})

# if the mercurial program is absent, this will leave the EIGEN_HG_CHANGESET string empty,
# but won't stop CMake.
Expand Down Expand Up @@ -117,14 +117,14 @@ option(EIGEN_TEST_RVALUE_REF_SUPPORT "Enable rvalue references for unit tests."
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})

set(INCLUDE_INSTALL_DIR
"${CMAKE_INSTALL_PREFIX}/include/eigen2"
"${CMAKE_INSTALL_PREFIX}/include/eigen3"
CACHE PATH
"The directory where we install the header files"
)

if(EIGEN_BUILD_PKGCONFIG)
configure_file(eigen2.pc.in eigen2.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen2.pc
configure_file(eigen3.pc.in eigen3.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc
DESTINATION share/pkgconfig
)
endif(EIGEN_BUILD_PKGCONFIG)
Expand Down
4 changes: 2 additions & 2 deletions Eigen/src/Core/util/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#undef minor

#define EIGEN_WORLD_VERSION 2
#define EIGEN_MAJOR_VERSION 90
#define EIGEN_MINOR_VERSION 1
#define EIGEN_MAJOR_VERSION 91
#define EIGEN_MINOR_VERSION 0

#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
Expand Down
80 changes: 80 additions & 0 deletions cmake/FindEigen3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# - Try to find Eigen3 lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(Eigen3 3.1.2)
# to require version 3.1.2 or newer of Eigen3.
#
# Once done this will define
#
# EIGEN3_FOUND - system has eigen lib with correct version
# EIGEN3_INCLUDE_DIR - the eigen include directory
# EIGEN3_VERSION - eigen version

# Copyright (c) 2006, 2007 Montel Laurent, <[email protected]>
# Copyright (c) 2008, 2009 Gael Guennebaud, <[email protected]>
# Redistribution and use is allowed according to the terms of the BSD license.

if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif(NOT Eigen3_FIND_VERSION_MAJOR)
if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif(NOT Eigen3_FIND_VERSION_MINOR)
if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif(NOT Eigen3_FIND_VERSION_PATCH)

set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif(NOT Eigen3_FIND_VERSION)

macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header LIMIT 5000 OFFSET 1000)

string(REGEX MATCH "define *EIGEN_WORLD_VERSION ([0-9]*)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define *EIGEN_MAJOR_VERSION ([0-9]*)" _eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define *EIGEN_MINOR_VERSION ([0-9]*)" _eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")

set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK TRUE)
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})

if(NOT EIGEN3_VERSION_OK)

message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
"but at least version ${Eigen3_FIND_VERSION} is required")
endif(NOT EIGEN3_VERSION_OK)
endmacro(_eigen3_check_version)

if (EIGEN3_INCLUDE_DIR)

# in cache already
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})

else (EIGEN3_INCLUDE_DIR)

find_path(EIGEN3_INCLUDE_DIR NAMES Eigen/Core
PATHS
${INCLUDE_INSTALL_DIR}
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen3
)

if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
endif(EIGEN3_INCLUDE_DIR)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)

mark_as_advanced(EIGEN3_INCLUDE_DIR)

endif(EIGEN3_INCLUDE_DIR)

2 changes: 1 addition & 1 deletion doc/C01_QuickStartGuide.dox
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ In order to use Eigen, you just need to download and extract Eigen's source code

Here are some quick compilation instructions with GCC. To quickly test an example program, just do

\code g++ -I /path/to/eigen2/ my_program.cpp -o my_program \endcode
\code g++ -I /path/to/eigen/ my_program.cpp -o my_program \endcode

There is no library to link to. For good performance, add the \c -O2 compile-flag. Note however that this makes it impossible to debug inside Eigen code, as many functions get inlined. In some cases, performance can be further improved by disabling Eigen assertions: use \c -DEIGEN_NO_DEBUG or \c -DNDEBUG to disable them.

Expand Down
2 changes: 1 addition & 1 deletion doc/D11_UnalignedArrayAssert.dox
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Eigen {

Hello! You are seeing this webpage because your program terminated on an assertion failure like this one:
<pre>
my_program: path/to/eigen2/Eigen/src/Core/MatrixStorage.h:44:
my_program: path/to/eigen/Eigen/src/Core/MatrixStorage.h:44:
Eigen::ei_matrix_array<T, Size, MatrixOptions, Align>::ei_matrix_array()
[with T = double, int Size = 2, int MatrixOptions = 2, bool Align = true]:
Assertion `(reinterpret_cast<size_t>(array) & 0xf) == 0 && "this assertion
Expand Down
8 changes: 0 additions & 8 deletions doc/Doxyfile.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
################################################################################
## ##
## WARNING ##
## ##
## all modifications in this file must be reported in eigen2/Mainpage.dox ##
## ##
################################################################################

# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
Expand Down
2 changes: 1 addition & 1 deletion doc/I00_CustomizingEigen.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Eigen {

/** \page CustomizingEigen Advanced - Customizing/Extending Eigen

Eigen2 can be extended in several ways, for instance, by defining global methods, \ref ExtendingMatrixBase "by adding custom methods to MatrixBase", adding support to \ref CustomScalarType "custom types" etc.
Eigen can be extended in several ways, for instance, by defining global methods, \ref ExtendingMatrixBase "by adding custom methods to MatrixBase", adding support to \ref CustomScalarType "custom types" etc.

\b Table \b of \b contents
- \ref ExtendingMatrixBase
Expand Down
3 changes: 1 addition & 2 deletions eigen2.pc.in → eigen3.pc.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

Name: Eigen2
Name: Eigen3
Description: A C++ template library for linear algebra: vectors, matrices, and related algorithms
Requires:
Version: ${EIGEN_VERSION_NUMBER}
Expand Down
4 changes: 2 additions & 2 deletions scripts/eigen_gen_credits
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/sh

# this script must be run from the eigen2/ directory.
# this script must be run from the eigen/ directory.
# when running hg churn from the scripts/ subdir, i hit a divide-by-zero error.
#
# like this:
# cd eigen2
# cd eigen
# USER=yourtuxfamilyuser scripts/eigen_gen_credits

rm -f eigen_gen_credits.log
Expand Down
8 changes: 4 additions & 4 deletions test/testsuite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Usage:
# - create a new folder, let's call it cdash
# - in that folder, do:
# ctest -S path/to/eigen2/test/testsuite.cmake[,option1=value1[,option2=value2]]
# ctest -S path/to/eigen/test/testsuite.cmake[,option1=value1[,option2=value2]]
#
# Options:
# - EIGEN_CXX: compiler, eg.: g++-4.2
Expand Down Expand Up @@ -44,9 +44,9 @@
# ARCH=`uname -m`
# SITE=`hostname`
# VERSION=opensuse-11.1
# WORK_DIR=/home/gael/Coding/eigen2/cdash
# WORK_DIR=/home/gael/Coding/eigen/cdash
# # get the last version of the script
# wget http://bitbucket.org/eigen/eigen2/raw/tip/test/testsuite.cmake -o $WORK_DIR/testsuite.cmake
# wget http://bitbucket.org/eigen/eigen/raw/tip/test/testsuite.cmake -o $WORK_DIR/testsuite.cmake
# COMMON="ctest -S $WORK_DIR/testsuite.cmake,EIGEN_WORK_DIR=$WORK_DIR,EIGEN_SITE=$SITE,EIGEN_MODE=$1,EIGEN_BUILD_STRING=$OS_VERSION-$ARCH"
# $COMMON-gcc-3.4.6,EIGEN_CXX=g++-3.4
# $COMMON-gcc-4.0.1,EIGEN_CXX=g++-4.0.1
Expand Down Expand Up @@ -141,7 +141,7 @@ endif(NOT EIGEN_MODE)

if(NOT EIGEN_NO_UPDATE)
SET (CTEST_CVS_COMMAND "hg")
SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} clone http://bitbucket.org/eigen/eigen2 \"${CTEST_SOURCE_DIRECTORY}\"")
SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} clone http://bitbucket.org/eigen/eigen \"${CTEST_SOURCE_DIRECTORY}\"")
SET(CTEST_BACKUP_AND_RESTORE TRUE) # the backup is CVS related ...
endif(NOT EIGEN_NO_UPDATE)

Expand Down
2 changes: 1 addition & 1 deletion unsupported/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ most of them are subject to be included in Eigen in the future.

In order to use an unsupported module you have to do either:

- add the path_to_eigen2/unsupported directory to your include path and do:
- add the path_to_eigen/unsupported directory to your include path and do:
#include <Eigen/ModuleHeader>

- or directly do:
Expand Down
8 changes: 0 additions & 8 deletions unsupported/doc/Doxyfile.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
################################################################################
## ##
## WARNING ##
## ##
## all modifications in this file must be reported in eigen2/Mainpage.dox ##
## ##
################################################################################

# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
Expand Down

0 comments on commit 293c79d

Please sign in to comment.