File switch-to-eigen3.diff of Package kalzium4
From 6698499251550b8cdd91bb1b94500a3383fc4df3 Mon Sep 17 00:00:00 2001
From: Etienne Rebetez <etienne.rebetez@gmail.com>
Date: Mon, 10 Mar 2014 19:05:21 +0100
Subject: REVIEW: 116638 Use EIGEN3 instead of EIGEN2. Thanks to Maximiliano
Curia for the patch.
---
CMakeLists.txt | 6 ++--
KalziumConfigureChecks.cmake | 6 ++--
cmake/modules/FindEigen2.cmake | 75 --------------------------------------
cmake/modules/FindEigen3.cmake | 81 ++++++++++++++++++++++++++++++++++++++++++
compoundviewer/CMakeLists.txt | 2 +-
src/CMakeLists.txt | 10 +++---
6 files changed, 93 insertions(+), 87 deletions(-)
delete mode 100644 cmake/modules/FindEigen2.cmake
create mode 100644 cmake/modules/FindEigen3.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d7583c3..804f0b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,7 +35,7 @@ kde4_no_enable_final(kalzium)
include(KalziumConfigureChecks.cmake)
-if (OPENBABEL2_FOUND AND Avogadro_FOUND AND EIGEN2_FOUND)
+if (OPENBABEL2_FOUND AND Avogadro_FOUND AND EIGEN3_FOUND)
# avoid compilerwarnings about redefinitions
# todo: use check_function_exits() ?
message(STATUS "Kalzium molecular editor enabled")
@@ -43,9 +43,9 @@ if (OPENBABEL2_FOUND AND Avogadro_FOUND AND EIGEN2_FOUND)
add_definitions(-DHAVE_SNPRINTF -DHAVE_STRCASECMP -DHAVE_STRNCASECMP)
endif (WIN32)
add_subdirectory(compoundviewer)
-else (OPENBABEL2_FOUND AND Avogadro_FOUND AND EIGEN2_FOUND)
+else (OPENBABEL2_FOUND AND Avogadro_FOUND AND EIGEN3_FOUND)
message(STATUS "Kalzium molecular editor disabled")
-endif (OPENBABEL2_FOUND AND Avogadro_FOUND AND EIGEN2_FOUND)
+endif (OPENBABEL2_FOUND AND Avogadro_FOUND AND EIGEN3_FOUND)
add_subdirectory(doc)
add_subdirectory(src)
diff --git a/KalziumConfigureChecks.cmake b/KalziumConfigureChecks.cmake
index 8917d5e..e3197ac 100644
--- a/KalziumConfigureChecks.cmake
+++ b/KalziumConfigureChecks.cmake
@@ -4,7 +4,7 @@ include(CheckFunctionExists)
macro_optional_find_package(OCaml)
macro_optional_find_package(Libfacile)
macro_optional_find_package(OpenBabel2)
-macro_optional_find_package(Eigen2)
+macro_optional_find_package(Eigen3)
macro_optional_find_package(Avogadro 1.0.0 NO_MODULE)
find_package(PkgConfig)
@@ -14,7 +14,7 @@ check_include_files(ieeefp.h HAVE_IEEEFP_H)
macro_bool_to_01(LIBFACILE_FOUND HAVE_FACILE)
macro_bool_to_01(OPENBABEL2_FOUND HAVE_OPENBABEL2)
-macro_bool_to_01(EIGEN2_FOUND HAVE_EIGEN)
+macro_bool_to_01(EIGEN3_FOUND HAVE_EIGEN)
macro_bool_to_01(Avogadro_FOUND HAVE_AVOGADRO)
# at the end, output the configuration
@@ -26,7 +26,7 @@ configure_file(
macro_log_feature(OCAML_FOUND "OCaml" "OCaml is needed by Kalzium for the Equation Solver" "http://caml.inria.fr/" FALSE "" "")
macro_log_feature(LIBFACILE_FOUND "LibFacile" "libfacile is needed by Kalzium for the Equation Solver." "http://www.recherche.enac.fr/log/facile/" FALSE "" "")
macro_log_feature(OPENBABEL2_FOUND "OpenBabel2" "OpenBabel is needed by Kalzium for the 3D-molecule viewer" "http://openbabel.sourceforge.net/" FALSE "2.2" "")
-macro_log_feature(EIGEN2_FOUND "Eigen2" "A generic C++ template library for dense and sparse matrices" "http://eigen.tuxfamily.org" FALSE "2.0.0" "")
+macro_log_feature(EIGEN3_FOUND "Eigen3" "A generic C++ template library for dense and sparse matrices" "http://eigen.tuxfamily.org" FALSE "3.0.0" "")
macro_log_feature(Avogadro_FOUND "Avogadro" "Advanced molecular editor" "http://avogadro.openmolecules.net" FALSE "1.0" "")
macro_log_feature(CHEMICAL_MIME_DATA_FOUND "Chemical mime data" "Needed to open CML molecules from the file manager" "http://chemical-mime.sourceforge.net/" FALSE "" "")
diff --git a/cmake/modules/FindEigen2.cmake b/cmake/modules/FindEigen2.cmake
deleted file mode 100644
index 74e183e..0000000
--- a/cmake/modules/FindEigen2.cmake
+++ /dev/null
@@ -1,75 +0,0 @@
-# - Try to find Eigen2 lib
-# Once done this will define
-#
-# EIGEN2_FOUND - system has eigen lib with correct version
-# EIGEN2_INCLUDE_DIR - the eigen include directory
-# EIGEN2_VERSION - eigen version
-
-# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
-# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
-# Redistribution and use is allowed according to the terms of the BSD license.
-
-if(NOT EIGEN2_MIN_VERSION)
- if(NOT Eigen2_FIND_VERSION_MAJOR)
- set(Eigen2_FIND_VERSION_MAJOR 2)
- endif(NOT Eigen2_FIND_VERSION_MAJOR)
- if(NOT Eigen2_FIND_VERSION_MINOR)
- set(Eigen2_FIND_VERSION_MINOR 0)
- endif(NOT Eigen2_FIND_VERSION_MINOR)
- if(NOT Eigen2_FIND_VERSION_PATCH)
- set(Eigen2_FIND_VERSION_PATCH 0)
- endif(NOT Eigen2_FIND_VERSION_PATCH)
-
- set(EIGEN2_MIN_VERSION "${Eigen2_FIND_VERSION_MAJOR}.${Eigen2_FIND_VERSION_MINOR}.${Eigen2_FIND_VERSION_PATCH}")
-endif(NOT EIGEN2_MIN_VERSION)
-
-macro(_eigen2_check_version)
- file(READ "${EIGEN2_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header LIMIT 5000 OFFSET 1000)
-
- string(REGEX MATCH "define *EIGEN_WORLD_VERSION ([0-9]*)" _eigen2_world_version_match "${_eigen2_version_header}")
- set(EIGEN2_WORLD_VERSION "${CMAKE_MATCH_1}")
- string(REGEX MATCH "define *EIGEN_MAJOR_VERSION ([0-9]*)" _eigen2_major_version_match "${_eigen2_version_header}")
- set(EIGEN2_MAJOR_VERSION "${CMAKE_MATCH_1}")
- string(REGEX MATCH "define *EIGEN_MINOR_VERSION ([0-9]*)" _eigen2_minor_version_match "${_eigen2_version_header}")
- set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}")
-
- set(EIGEN2_VERSION ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION})
- if(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
- set(EIGEN2_VERSION_OK FALSE)
- else(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
- set(EIGEN2_VERSION_OK TRUE)
- endif(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
-
- if(NOT EIGEN2_VERSION_OK)
-
- message(STATUS "Eigen2 version ${EIGEN2_VERSION} found in ${EIGEN2_INCLUDE_DIR}, "
- "but at least version ${EIGEN2_MIN_VERSION} is required")
- endif(NOT EIGEN2_VERSION_OK)
-endmacro(_eigen2_check_version)
-
-if (EIGEN2_INCLUDE_DIR)
-
- # in cache already
- _eigen2_check_version()
- set(EIGEN2_FOUND ${EIGEN2_VERSION_OK})
-
-else (EIGEN2_INCLUDE_DIR)
-
-find_path(EIGEN2_INCLUDE_DIR NAMES Eigen/Core
- PATHS
- ${INCLUDE_INSTALL_DIR}
- ${KDE4_INCLUDE_DIR}
- PATH_SUFFIXES eigen2
- )
-
-if(EIGEN2_INCLUDE_DIR)
- _eigen2_check_version()
-endif(EIGEN2_INCLUDE_DIR)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Eigen2 DEFAULT_MSG EIGEN2_INCLUDE_DIR EIGEN2_VERSION_OK)
-
-mark_as_advanced(EIGEN2_INCLUDE_DIR)
-
-endif(EIGEN2_INCLUDE_DIR)
-
diff --git a/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake
new file mode 100644
index 0000000..9c546a0
--- /dev/null
+++ b/cmake/modules/FindEigen3.cmake
@@ -0,0 +1,81 @@
+# - 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, <montel@kde.org>
+# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
+# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
+# Redistribution and use is allowed according to the terms of the 2-clause 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)
+
+ string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
+ set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
+ set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([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 signature_of_eigen3_matrix_library
+ PATHS
+ ${CMAKE_INSTALL_PREFIX}/include
+ ${KDE4_INCLUDE_DIR}
+ PATH_SUFFIXES eigen3 eigen
+ )
+
+ 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)
+
diff --git a/compoundviewer/CMakeLists.txt b/compoundviewer/CMakeLists.txt
index b2b7e6c..0971248 100644
--- a/compoundviewer/CMakeLists.txt
+++ b/compoundviewer/CMakeLists.txt
@@ -2,7 +2,7 @@ include(${Avogadro_USE_FILE})
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/..
- ${EIGEN2_INCLUDE_DIR}
+ ${EIGEN3_INCLUDE_DIR}
${OPENBABEL2_INCLUDE_DIR}
)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0ada32e..3cefc58 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,7 +23,7 @@ if (OPENBABEL2_FOUND)
)
include_directories(${OPENBABEL2_INCLUDE_DIR})
- if (EIGEN2_FOUND AND Avogadro_FOUND)
+ if (EIGEN3_FOUND AND Avogadro_FOUND)
include(${Avogadro_USE_FILE})
@@ -35,8 +35,8 @@ if (OPENBABEL2_FOUND)
kde4_add_ui_files(kalziumtools_SRCS
tools/moleculeviewerwidget.ui
)
- include_directories(${EIGEN2_INCLUDE_DIR})
- endif (EIGEN2_FOUND AND Avogadro_FOUND)
+ include_directories(${EIGEN3_INCLUDE_DIR})
+ endif (EIGEN3_FOUND AND Avogadro_FOUND)
endif (OPENBABEL2_FOUND)
## Kalzium calculator files
@@ -137,9 +137,9 @@ target_link_libraries(kalzium ${KDE4_KHTML_LIBRARY} ${KDE4_KNEWSTUFF3_LIBS} ${KD
if (OPENBABEL2_FOUND)
target_link_libraries(kalzium ${OPENBABEL2_LIBRARIES})
- if (EIGEN2_FOUND AND Avogadro_FOUND)
+ if (EIGEN3_FOUND AND Avogadro_FOUND)
target_link_libraries(kalzium ${QT_QTOPENGL_LIBRARY} compoundviewer avogadro)
- endif (EIGEN2_FOUND AND Avogadro_FOUND)
+ endif (EIGEN3_FOUND AND Avogadro_FOUND)
endif (OPENBABEL2_FOUND)
if (LIBFACILE_FOUND)
--
cgit v0.11.2