Commit 5cc75040 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke
Browse files

Rewrote Petsc finder.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18184 383ad7c9-94d9-4d36-a494-682f7c89f535
parent aefbadf3
if (PETSC_INCLUDE_DIRS) IF (PETSC_INCLUDE_DIRS)
# Already in cache, be silent # Already in cache, be silent
SET(PETSC_FIND_QUIETLY TRUE) SET(PETSC_FIND_QUIETLY TRUE)
endif(PETSC_INCLUDE_DIRS) ENDIF (PETSC_INCLUDE_DIRS)
if (WIN32) SET (PETSC_HEADER "petsc.h")
find_path(PETSC_INCLUDE_DIR NAMES petsc.h SET (PETSC_LIB_OPT "petsc")
PREFIXES SRC SET (PETSC_LIB_DBG "${PETSC_LIB_OPT}")
IF (WIN32)
SET (PETSC_LIB_OPT "SuperLU")
SET (PETSC_LIB_DBG "SuperLUd")
ELSEIF (APPLE)
SET (PETSC_HEADER "gurobi_c++.h")
SET (PETSC_LIB_OPT "SuperLU")
SET (PETSC_LIB_DBG "SuperLU")
ENDIF (WIN32)
FIND_PATH(PETSC_INCLUDE_DIR NAMES ${PETSC_HEADER}
PATHS PATHS
/usr/local/include/petsc
/usr/local/include
/usr/include/petsc
/usr/include
"C:\\libs\\gurobi45" "C:\\libs\\gurobi45"
${PETSC_DIR}/include ${PETSC_DIR}/include
) "${CMAKE_SOURCE_DIR}/MacOS/Libs/gurobi40"
find_library( PETSC_LIBRARY_RELEASE
SuperLU
PATHS "C:\\libs\\gurobi45\\lib" )
find_library( PETSC_LIBRARY_DEBUG
SuperLUd
PATHS "C:\\libs\\gurobi45\\lib" )
set ( PETSC_LIBRARY "optimized;${PETSC_LIBRARY_RELEASE};debug;${PETSC_LIBRARY_DEBUG}" CACHE STRING "PETSC Libraries" )
ELSEIF(APPLE)
find_path(PETSC_INCLUDE_DIR NAMES gurobi_c++.h
PATHS "${CMAKE_SOURCE_DIR}/MacOS/Libs/gurobi40"
${PETSC_INCLUDE_PATH} ${PETSC_INCLUDE_PATH}
) )
find_library( PETSC_LIBRARY
SuperLU
PATHS "${CMAKE_SOURCE_DIR}/MacOS/Libs/gurobi40")
ELSE( WIN32 ) SET(PETSC_LIBRARY_DIR NOTFOUND CACHE PATH "The directory where the petsc library resides.")
find_path(PETSC_INCLUDE_DIR1 NAMES petsc.h FIND_LIBRARY( PETSC_LIBRARY_DEBUG
PATHS "$ENV{PETSC_DIR}/include" NAMES ${PETSC_LIB_DBG}
${PETSC_INCLUDE_DIR1} PATHS
${PETSC_LIBRARY_DIR}
"${CMAKE_SOURCE_DIR}/MacOS/Libs/gurobi40"
) )
FIND_LIBRARY( PETSC_LIBRARY_RELEASE
find_path(PETSC_INCLUDE_DIR2 NAMES petscconf.h NAMES ${PETSC_LIB_OPT}
PATHS "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/include" PATHS
${PETSC_INCLUDE_DIR2} ${PETSC_LIBRARY_DIR}
"${CMAKE_SOURCE_DIR}/MacOS/Libs/gurobi40"
) )
INCLUDE (FindPackageHandleStandardArgs)
# MESSAGE(STATUS "$ENV{PETSC_HOME}/include") FIND_PACKAGE_HANDLE_STANDARD_ARGS(Petsc DEFAULT_MSG PETSC_LIBRARY_DEBUG PETSC_LIBRARY_RELEASE PETSC_INCLUDE_DIR)
IF(PETSC_INCLUDE_DIR1 AND PETSC_INCLUDE_DIR2)
SET(PETSC_FOUND TRUE)
SET(PETSC_INCLUDE_DIRS "${PETSC_INCLUDE_DIR1};${PETSC_INCLUDE_DIR2}")
SET(PETSC_LIBRARY_DIR "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib" CACHE PATH "Path to PETSC Library")
SET(PETSC_LIBRARY "petsc" CACHE STRING "PETSC Libraries")
ELSE(PETSC_INCLUDE_DIR1 AND PETSC_INCLUDE_DIR2)
SET(PETSC_FOUND FALSE)
SET(PETSC_INCLUDE_DIR ${PETSC_INCLUDE_DIR})
ENDIF(PETSC_INCLUDE_DIR1 AND PETSC_INCLUDE_DIR2)
#find_library( PETSC_LIBRARY IF (PETSC_FOUND)
# gurobi SET(PETSC_LIBRARIES "${PETSC_LIBRARY}")
# PATHS "${PETSC_HOME}/lib" ) SET(PETSC_INCLUDE_DIRS "${PETSC_INCLUDE_DIR}")
ENDIF() SET( PETSC_LIBRARY
\ No newline at end of file debug ${PETSC_LIBRARY_DEBUG}
release ${PETSC_LIBRARY_RELEASE} )
ENDIF (PETSC_FOUND)
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