Commit c0e325f4 authored by Jan Möbius's avatar Jan Möbius

Suitesparse finder

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6413 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 61ac590e
# - Try to find CHOLMOD
# Once done this will define
#
# CHOLMOD_FOUND - system has CHOLMOD
# CHOLMOD_INCLUDE_DIRS - the CHOLMOD include directory
# CHOLMOD_LIBRARY - Link these to use CHOLMOD
#
IF (CHOLMOD_INCLUDE_DIRS)
# Already in cache, be silent
SET(CHOLMOD_FIND_QUIETLY TRUE)
ENDIF (CHOLMOD_INCLUDE_DIRS)
if( WIN32 )
FIND_PATH( CHOLMOD_INCLUDE_DIRS cholmod.h
PATHS "C:\\libs\\SuiteSparse\\CHOLMOD\\Include" )
FIND_LIBRARY( CHOLMOD_LIBRARY
cholmod
PATHS "C:\\libs\\SuiteSparse\\CHOLMOD\\Lib" )
else( WIN32 )
FIND_PATH( CHOLMOD_INCLUDE_DIRS cholmod.h
PATHS /usr/local/include /usr/include /usr/include/suitesparse/
PATH_SUFFIXES cholmod/ CHOLMOD/ )
SET( CHOLMOD_NAMES cholmod CHOLMOD )
FIND_LIBRARY( CHOLMOD_LIBRARY
NAMES ${CHOLMOD_NAMES}
PATHS /usr/lib /usr/local/lib )
endif( WIN32 )
GET_FILENAME_COMPONENT( CHOLMOD_LIBRARY_DIR ${CHOLMOD_LIBRARY} PATH )
IF (CHOLMOD_INCLUDE_DIRS AND CHOLMOD_LIBRARY)
IF(WIN32)
list (APPEND CHOLMOD_INCLUDE_DIRS ${CHOLMOD_INCLUDE_DIRS}/../../UFconfig )
ENDIF(WIN32)
SET(CHOLMOD_FOUND TRUE)
ELSE (CHOLMOD_INCLUDE_DIRS AND CHOLMOD_LIBRARY)
SET( CHOLMOD_FOUND FALSE )
ENDIF (CHOLMOD_INCLUDE_DIRS AND CHOLMOD_LIBRARY)
# Find the Qwt 5.x includes and library, either the version linked to Qt3 or the version linked to Qt4
#
# On Windows it makes these assumptions:
# - the Qwt DLL is where the other DLLs for Qt are (QT_DIR\bin) or in the path
# - the Qwt .h files are in QT_DIR\include\Qwt or in the path
# - the Qwt .lib is where the other LIBs for Qt are (QT_DIR\lib) or in the path
#
# Qwt5_INCLUDE_DIR - where to find qwt.h if Qwt
# Qwt5_Qt4_LIBRARY - The Qwt5 library linked against Qt4 (if it exists)
# Qwt5_Qt3_LIBRARY - The Qwt5 library linked against Qt4 (if it exists)
# Qwt5_Qt4_FOUND - Qwt5 was found and uses Qt4
# Qwt5_Qt3_FOUND - Qwt5 was found and uses Qt3
# Qwt5_FOUND - Set to TRUE if Qwt5 was found (linked either to Qt3 or Qt4)
# Copyright (c) 2007, Pau Garcia i Quiles, <pgquiles@elpauer.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Condition is "(A OR B) AND C", CMake does not support parentheses but it evaluates left to right
IF(Qwt5_Qt4_LIBRARY OR Qwt5_Qt3_LIBRARY AND Qwt5_INCLUDE_DIR)
SET(Qwt5_FIND_QUIETLY TRUE)
ENDIF(Qwt5_Qt4_LIBRARY OR Qwt5_Qt3_LIBRARY AND Qwt5_INCLUDE_DIR)
IF(NOT QT4_FOUND)
FIND_PACKAGE( Qt4 REQUIRED QUIET )
ENDIF(NOT QT4_FOUND)
IF( QT4_FOUND )
# Is Qwt5 installed? Look for header files
FIND_PATH( Qwt5_INCLUDE_DIR qwt.h
PATHS ${QT_INCLUDE_DIR} /usr/local/qwt/include /usr/local/include /usr/include/qwt /usr/include c:\\Program\ Files\\qwt\\qwt-5.2.0 c:\\qwt-5.2.0
PATH_SUFFIXES qwt qwt5 qwt-qt4 qwt5-qt4 qwt-qt3 qwt5-qt3 include qwt/include qwt5/include qwt-qt4/include qwt5-qt4/include qwt-qt3/include qwt5-qt3/include ENV PATH)
# Find Qwt version
IF( Qwt5_INCLUDE_DIR )
FILE( READ ${Qwt5_INCLUDE_DIR}/qwt_global.h QWT_GLOBAL_H )
STRING( REGEX MATCH "#define *QWT_VERSION *(0x05*)" QWT_IS_VERSION_5 ${QWT_GLOBAL_H})
IF( QWT_IS_VERSION_5 )
STRING(REGEX REPLACE ".*#define[\\t\\ ]+QWT_VERSION_STR[\\t\\ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" "\\1" Qwt_VERSION "${QWT_GLOBAL_H}")
# Find Qwt5 library linked to Qt4
FIND_LIBRARY( Qwt5_Qt4_TENTATIVE_LIBRARY NAMES qwt5-qt4 qwt-qt4 qwt5 qwt PATHS /usr/local/qwt/lib /usr/local/lib /usr/lib c:\\Program\ Files\\qwt\\qwt-5.2.0\\lib c:\\qwt-5.2.0
)
IF( UNIX AND NOT CYGWIN)
IF( Qwt5_Qt4_TENTATIVE_LIBRARY )
#MESSAGE("Qwt5_Qt4_TENTATIVE_LIBRARY = ${Qwt5_Qt4_TENTATIVE_LIBRARY}")
EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5_Qt4_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt_Qt4_LIBRARIES_LINKED_TO )
STRING( REGEX MATCH "QtCore" Qwt5_IS_LINKED_TO_Qt4 ${Qwt_Qt4_LIBRARIES_LINKED_TO})
IF( Qwt5_IS_LINKED_TO_Qt4 )
SET( Qwt5_Qt4_LIBRARY ${Qwt5_Qt4_TENTATIVE_LIBRARY} )
SET( Qwt5_Qt4_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt: ${Qwt5_Qt4_LIBRARY}" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( Qwt5_IS_LINKED_TO_Qt4 )
ENDIF( Qwt5_Qt4_TENTATIVE_LIBRARY )
ELSE( UNIX AND NOT CYGWIN)
# Assumes qwt.dll is in the Qt dir
SET( Qwt5_Qt4_LIBRARY ${Qwt5_Qt4_TENTATIVE_LIBRARY} )
SET( Qwt5_Qt4_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt4" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( UNIX AND NOT CYGWIN)
# Find Qwt5 library linked to Qt3
FIND_LIBRARY( Qwt5_Qt3_TENTATIVE_LIBRARY NAMES qwt-qt3 qwt qwt5-qt3 qwt5 )
IF( UNIX AND NOT CYGWIN)
IF( Qwt5_Qt3_TENTATIVE_LIBRARY )
#MESSAGE("Qwt5_Qt3_TENTATIVE_LIBRARY = ${Qwt5_Qt3_TENTATIVE_LIBRARY}")
EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5_Qt3_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt-Qt3_LIBRARIES_LINKED_TO )
STRING( REGEX MATCH "qt-mt" Qwt5_IS_LINKED_TO_Qt3 ${Qwt-Qt3_LIBRARIES_LINKED_TO})
IF( Qwt5_IS_LINKED_TO_Qt3 )
SET( Qwt5_Qt3_LIBRARY ${Qwt5_Qt3_TENTATIVE_LIBRARY} )
SET( Qwt5_Qt3_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt3" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( Qwt5_IS_LINKED_TO_Qt3 )
ENDIF( Qwt5_Qt3_TENTATIVE_LIBRARY )
ELSE( UNIX AND NOT CYGWIN)
SET( Qwt5_Qt3_LIBRARY ${Qwt5_Qt3_TENTATIVE_LIBRARY} )
SET( Qwt5_Qt3_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt: ${Qwt5_Qt3_LIBRARY}" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( UNIX AND NOT CYGWIN)
ENDIF( QWT_IS_VERSION_5 )
IF( Qwt5_Qt4_FOUND OR Qwt5_Qt3_FOUND )
SET( Qwt5_FOUND TRUE )
ENDIF( Qwt5_Qt4_FOUND OR Qwt5_Qt3_FOUND )
MARK_AS_ADVANCED( Qwt5_INCLUDE_DIR Qwt5_Qt4_LIBRARY Qwt5_Qt3_LIBRARY )
ENDIF( Qwt5_INCLUDE_DIR )
IF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Qwt 5.x")
ENDIF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED)
# Find the Qwt 5.x includes and library, either the version linked to Qt3 or the version linked to Qt4
#
# On Windows it makes these assumptions:
# - the Qwt DLL is where the other DLLs for Qt are (QT_DIR\bin) or in the path
# - the Qwt .h files are in QT_DIR\include\Qwt or in the path
# - the Qwt .lib is where the other LIBs for Qt are (QT_DIR\lib) or in the path
#
# Qwt5_INCLUDE_DIR - where to find qwt.h if Qwt
# Qwt5_Qt4_LIBRARY - The Qwt5 library linked against Qt4 (if it exists)
# Qwt5_Qt3_LIBRARY - The Qwt5 library linked against Qt4 (if it exists)
# Qwt5_Qt4_FOUND - Qwt5 was found and uses Qt4
# Qwt5_Qt3_FOUND - Qwt5 was found and uses Qt3
# Qwt5_FOUND - Set to TRUE if Qwt5 was found (linked either to Qt3 or Qt4)
# Copyright (c) 2007, Pau Garcia i Quiles, <pgquiles@elpauer.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Condition is "(A OR B) AND C", CMake does not support parentheses but it evaluates left to right
IF(Qwt5_Qt4_LIBRARY OR Qwt5_Qt3_LIBRARY AND Qwt5_INCLUDE_DIR)
SET(Qwt5_FIND_QUIETLY TRUE)
ENDIF(Qwt5_Qt4_LIBRARY OR Qwt5_Qt3_LIBRARY AND Qwt5_INCLUDE_DIR)
IF(NOT QT4_FOUND)
FIND_PACKAGE( Qt4 REQUIRED QUIET )
ENDIF(NOT QT4_FOUND)
IF( QT4_FOUND )
# Is Qwt5 installed? Look for header files
FIND_PATH( Qwt5_INCLUDE_DIR qwt.h
PATHS ${QT_INCLUDE_DIR} /usr/local/qwt/include /usr/local/include /usr/include/qwt /usr/include c:\\Program\ Files\\qwt\\qwt-5.2.0 c:\\qwt-5.2.0
PATH_SUFFIXES qwt qwt5 qwt-qt4 qwt5-qt4 qwt-qt3 qwt5-qt3 include qwt/include qwt5/include qwt-qt4/include qwt5-qt4/include qwt-qt3/include qwt5-qt3/include ENV PATH)
# Find Qwt version
IF( Qwt5_INCLUDE_DIR )
FILE( READ ${Qwt5_INCLUDE_DIR}/qwt_global.h QWT_GLOBAL_H )
STRING( REGEX MATCH "#define *QWT_VERSION *(0x05*)" QWT_IS_VERSION_5 ${QWT_GLOBAL_H})
IF( QWT_IS_VERSION_5 )
STRING(REGEX REPLACE ".*#define[\\t\\ ]+QWT_VERSION_STR[\\t\\ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" "\\1" Qwt_VERSION "${QWT_GLOBAL_H}")
# Find Qwt5 library linked to Qt4
FIND_LIBRARY( Qwt5_Qt4_TENTATIVE_LIBRARY NAMES qwt5-qt4 qwt-qt4 qwt5 qwt PATHS /usr/local/qwt/lib /usr/local/lib /usr/lib c:\\Program\ Files\\qwt\\qwt-5.2.0\\lib c:\\qwt-5.2.0
)
IF( UNIX AND NOT CYGWIN)
IF( Qwt5_Qt4_TENTATIVE_LIBRARY )
#MESSAGE("Qwt5_Qt4_TENTATIVE_LIBRARY = ${Qwt5_Qt4_TENTATIVE_LIBRARY}")
EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5_Qt4_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt_Qt4_LIBRARIES_LINKED_TO )
STRING( REGEX MATCH "QtCore" Qwt5_IS_LINKED_TO_Qt4 ${Qwt_Qt4_LIBRARIES_LINKED_TO})
IF( Qwt5_IS_LINKED_TO_Qt4 )
SET( Qwt5_Qt4_LIBRARY ${Qwt5_Qt4_TENTATIVE_LIBRARY} )
SET( Qwt5_Qt4_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt: ${Qwt5_Qt4_LIBRARY}" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( Qwt5_IS_LINKED_TO_Qt4 )
ENDIF( Qwt5_Qt4_TENTATIVE_LIBRARY )
ELSE( UNIX AND NOT CYGWIN)
# Assumes qwt.dll is in the Qt dir
SET( Qwt5_Qt4_LIBRARY ${Qwt5_Qt4_TENTATIVE_LIBRARY} )
SET( Qwt5_Qt4_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt4" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( UNIX AND NOT CYGWIN)
# Find Qwt5 library linked to Qt3
FIND_LIBRARY( Qwt5_Qt3_TENTATIVE_LIBRARY NAMES qwt-qt3 qwt qwt5-qt3 qwt5 )
IF( UNIX AND NOT CYGWIN)
IF( Qwt5_Qt3_TENTATIVE_LIBRARY )
#MESSAGE("Qwt5_Qt3_TENTATIVE_LIBRARY = ${Qwt5_Qt3_TENTATIVE_LIBRARY}")
EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5_Qt3_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt-Qt3_LIBRARIES_LINKED_TO )
STRING( REGEX MATCH "qt-mt" Qwt5_IS_LINKED_TO_Qt3 ${Qwt-Qt3_LIBRARIES_LINKED_TO})
IF( Qwt5_IS_LINKED_TO_Qt3 )
SET( Qwt5_Qt3_LIBRARY ${Qwt5_Qt3_TENTATIVE_LIBRARY} )
SET( Qwt5_Qt3_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt3" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( Qwt5_IS_LINKED_TO_Qt3 )
ENDIF( Qwt5_Qt3_TENTATIVE_LIBRARY )
ELSE( UNIX AND NOT CYGWIN)
SET( Qwt5_Qt3_LIBRARY ${Qwt5_Qt3_TENTATIVE_LIBRARY} )
SET( Qwt5_Qt3_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt: ${Qwt5_Qt3_LIBRARY}" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( UNIX AND NOT CYGWIN)
ENDIF( QWT_IS_VERSION_5 )
IF( Qwt5_Qt4_FOUND OR Qwt5_Qt3_FOUND )
SET( Qwt5_FOUND TRUE )
ENDIF( Qwt5_Qt4_FOUND OR Qwt5_Qt3_FOUND )
MARK_AS_ADVANCED( Qwt5_INCLUDE_DIR Qwt5_Qt4_LIBRARY Qwt5_Qt3_LIBRARY )
ENDIF( Qwt5_INCLUDE_DIR )
IF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Qwt 5.x")
ENDIF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED)
ENDIF( QT4_FOUND )
\ No newline at end of file
# - Try to find SUITESPARSE
# Once done this will define
#
# SUITESPARSE_FOUND - system has SUITESPARSE
# SUITESPARSE_INCLUDE_DIRS - the SUITESPARSE include directory
# SUITESPARSE_LIBRARIES - Link these to use SUITESPARSE
# SUITESPARSE_LIBRARY_DIR - Library directory containing suitesparse libs
#
IF (SUITESPARSE_INCLUDE_DIRS)
# Already in cache, be silent
SET(SUITESPARSE_FIND_QUIETLY TRUE)
ENDIF (SUITESPARSE_INCLUDE_DIRS)
if( WIN32 )
# Find cholmod part of the suitesparse library collection
FIND_PATH( CHOLMOD_INCLUDE_DIR cholmod.h
PATHS "C:\\libs\\SuiteSparse\\CHOLMOD\\Include" )
# Add cholmod include directory to collection include directories
IF ( CHOLMOD_INCLUDE_DIR )
list ( APPEND SUITESPARSE_INCLUDE_DIRS ${CHOLMOD_INCLUDE_DIR} )
ENDIF( CHOLMOD_INCLUDE_DIR )
# find path suitesparse library
FIND_PATH( SUITESPARSE_LIBRARY_DIRS
suitesparse.lib
PATHS "C:\\libs\\SuiteSparse\\libs" )
# if we found the library, add it to the defined libraries
IF ( SUITESPARSE_LIBRARY_DIRS )
list ( APPEND SUITESPARSE_LIBRARIES suitesparse )
ENDIF( SUITESPARSE_LIBRARY_DIRS )
else( WIN32 )
FIND_PATH( CHOLMOD_INCLUDE_DIR cholmod.h
PATHS /usr/local/include /usr/include /usr/include/suitesparse/
PATH_SUFFIXES cholmod/ CHOLMOD/ )
# Add cholmod include directory to collection include directories
IF ( CHOLMOD_INCLUDE_DIR )
list ( APPEND SUITESPARSE_INCLUDE_DIRS ${CHOLMOD_INCLUDE_DIR} )
ENDIF( CHOLMOD_INCLUDE_DIR )
FIND_PATH( SUITESPARSE_LIBRARY_DIR
NAMES libcholmod.so
PATHS /usr/lib /usr/local/lib )
# if we found the library, add it to the defined libraries
IF ( SUITESPARSE_LIBRARY_DIR )
FIND_LIBRARY( CHOLMOD_LIBRARY
NAMES cholmod CHOLMOD
PATHS ${SUITESPARSE_LIBRARY_DIR} )
list ( APPEND SUITESPARSE_LIBRARIES ${CHOLMOD_LIBRARY} )
ENDIF( SUITESPARSE_LIBRARY_DIR )
endif( WIN32 )
IF (SUITESPARSE_INCLUDE_DIRS AND SUITESPARSE_LIBRARIES)
IF(WIN32)
list (APPEND SUITESPARSE_INCLUDE_DIRS ${CHOLMOD_INCLUDE_DIR}/../../UFconfig )
ENDIF(WIN32)
SET(SUITESPARSE_FOUND TRUE)
ELSE (SUITESPARSE_INCLUDE_DIRS AND SUITESPARSE_LIBRARIES)
SET( SUITESPARSE_FOUND FALSE )
ENDIF (SUITESPARSE_INCLUDE_DIRS AND SUITESPARSE_LIBRARIES)
Markdown is supported
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