Commit e90453c3 authored by Max Lyon's avatar Max Lyon

Merge branch 'Simplify_CMakeList' into 'master'

Simplify c make list

See merge request !36
parents 6beba73a 03e7419c
Pipeline #7886 passed with stages
in 8 minutes and 9 seconds
cmake_minimum_required (VERSION 2.6)
#Only set project name if CoMISo is built as stand-alone library
if("${PROJECT_NAME}" STREQUAL "")
project(CoMISo)
endif()
# add our macro directory to cmake search path
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set (CMAKE_DEBUG_POSTFIX "d")
include (ACGCommon)
# Flag to enable or disable QT widgets in CoMISo
set( WANT_COMISO_QT ON CACHE BOOL "Enable Qt support in CoMISo" )
if( WANT_COMISO_QT )
acg_qt5 ()
......@@ -40,7 +36,7 @@ set(COMISO_LINK_DIRECTORIES "")
set(COMISO_LINK_LIBRARIES "")
set(NEED_LAPACK "")
FIND_PACKAGE( Boost 1.42.0 COMPONENTS system filesystem regex QUIET)
FIND_PACKAGE( Boost 1.59.0 COMPONENTS system filesystem regex QUIET)
if(Boost_FOUND)
set (COMISO_BOOST_CONFIG_FILE_SETTINGS "#define COMISO_BOOST_AVAILABLE 1" )
list( APPEND COMISO_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS} )
......@@ -73,20 +69,8 @@ else()
message (FATAL_ERROR "GMM not found!")
endif ()
# We require cgal with its blas on windows
find_package(CGAL)
if (CGAL_FOUND)
set (COMISO_CGAL_CONFIG_FILE_SETTINGS "#define COMISO_CGAL_AVAILABLE 1" )
list( APPEND COMISO_INCLUDE_DIRECTORIES ${CGAL_INCLUDE_DIR} )
list( APPEND COMISO_LINK_DIRECTORIES ${CGAL_LIBRARY_DIR} )
list( APPEND COMISO_LINK_LIBRARIES ${CGAL_LIBRARIES} )
add_definitions(-DCGAL_NO_AUTOLINK)
else()
set (COMISO_CGAL_CONFIG_FILE_SETTINGS "#define COMISO_CGAL_AVAILABLE 0" )
message (STATUS "CGAL not found!")
endif()
set(TMP_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
set(CMAKE_FIND_LIBRARY_PREFIXES lib "") #Our blas librariy is called libblas.lib. Is there a better way to find it than this?
find_package (BLAS)
if (BLAS_FOUND )
set (COMISO_BLAS_CONFIG_FILE_SETTINGS "#define COMISO_BLAS_AVAILABLE 1" )
......@@ -98,6 +82,7 @@ else()
set (COMISO_BLAS_CONFIG_FILE_SETTINGS "#define COMISO_BLAS_AVAILABLE 0" )
message (STATUS "BLAS not found!")
endif ()
set(CMAKE_FIND_LIBRARY_PREFIXES "${TMP_CMAKE_FIND_LIBRARY_PREFIXES}")
find_package (ADOLC)
if (ADOLC_FOUND)
......@@ -288,7 +273,7 @@ endif ()
find_package (Taucs)
set (SUPRESS_TAUCS OFF CACHE BOOL "Set to ON if CoMISo should be built without TAUCS.")
if (TAUCS_FOUND AND NOT SUPRESS_TAUCS)
list (APPEND NEED_LAPACK "Tacus")
list (APPEND NEED_LAPACK "Taucs")
set (COMISO_TAUCS_CONFIG_FILE_SETTINGS "#define COMISO_TAUCS_AVAILABLE 1" )
list( APPEND COMISO_INCLUDE_DIRECTORIES ${TAUCS_INCLUDE_DIR} )
list( APPEND COMISO_LINK_LIBRARIES ${TAUCS_LIBRARY} )
......@@ -345,7 +330,9 @@ else ()
set (COMISO_CPLEX_CONFIG_FILE_SETTINGS "#define COMISO_CPLEX_AVAILABLE 0" )
endif ()
if (NEED_LAPACK)
set(TMP_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
set(CMAKE_FIND_LIBRARY_PREFIXES lib "") #Our lapack library is called liblapack.lib. Is there a better way to find it than this?
if (NEED_LAPACK AND NOT SUITESPARSE_FOUND)
FIND_PACKAGE(LAPACK)
if (LAPACK_FOUND)
list( APPEND COMISO_INCLUDE_DIRECTORIES ${LAPACK_INCLUDE_DIR} )
......@@ -354,7 +341,8 @@ if (NEED_LAPACK)
else()
message(STATUS "LAPACK not found!")
endif()
endif(NEED_LAPACK)
endif(NEED_LAPACK AND NOT SUITESPARSE_FOUND)
set(CMAKE_FIND_LIBRARY_PREFIXES "${TMP_CMAKE_FIND_LIBRARY_PREFIXES}")
include_directories (
..
......
......@@ -982,3 +982,40 @@ function (generate_qhp_file files_loc plugin_name)
endif()
endforeach()
endfunction()
# Set path to libraries VS_SEARCH_PATH
if (WIN32)
if ( CMAKE_GENERATOR MATCHES ".*Win64" )
SET( DIRSUFFIX "lib64" )
else ()
SET( DIRSUFFIX "lib" )
endif()
# Check if the base path is set
if ( NOT CMAKE_WINDOWS_LIBS_DIR )
# This is the base directory for windows library search used in the finders we shipp.
set(CMAKE_WINDOWS_LIBS_DIR "c:/libs" CACHE STRING "Default Library search dir on windows." )
endif()
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x32/")
endif()
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${VS_SEARCH_PATH}" "${VS_SEARCH_PATH}/lapack_blas_windows")
endif(WIN32)
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
# This macro is intended to be used in FindXXX.cmake modules files.
# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
# it also sets the <UPPERCASED_NAME>_FOUND variable.
# The package is found if all variables listed are TRUE.
# Example:
#
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
#
# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and
# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
# independent whether QUIET was used or not.
# If it is found, the location is reported using the VAR1 argument, so
# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
# If the second argument is DEFAULT_MSG, the message in the failure case will
# be "Could NOT find LibXml2", if you don't like this message you can specify
# your own custom failure message there.
macro(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
if("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
set(_FAIL_MESSAGE "Could NOT find ${_NAME}")
else()
set(_FAIL_MESSAGE "${_FAIL_MSG}")
endif()
string(TOUPPER ${_NAME} _NAME_UPPER)
set(${_NAME_UPPER}_FOUND TRUE)
if(NOT ${_VAR1})
set(${_NAME_UPPER}_FOUND FALSE)
endif()
foreach(_CURRENT_VAR ${ARGN})
if(NOT ${_CURRENT_VAR})
set(${_NAME_UPPER}_FOUND FALSE)
endif()
endforeach()
if (${_NAME_UPPER}_FOUND)
if (NOT ${_NAME}_FIND_QUIETLY)
message(STATUS "Found ${_NAME}: ${${_VAR1}}")
endif()
else()
if (${_NAME}_FIND_REQUIRED)
message(FATAL_ERROR "${_FAIL_MESSAGE}")
else()
if (NOT ${_NAME}_FIND_QUIETLY)
message(STATUS "${_FAIL_MESSAGE}")
endif()
endif()
endif()
endmacro()
if ( NOT CGAL_GENERATOR_SPECIFIC_SETTINGS_FILE_INCLUDED )
set( CGAL_GENERATOR_SPECIFIC_SETTINGS_FILE_INCLUDED 1 )
message( STATUS "Targetting ${CMAKE_GENERATOR}")
if ( MSVC )
message( STATUS "Target build enviroment supports auto-linking" )
set(CGAL_AUTO_LINK_ENABLED TRUE)
endif()
if ( MSVC15 )
set(CGAL_TOOLSET "vc150")
message( STATUS "Using VC15 compiler." )
elseif ( MSVC14 )
set(CGAL_TOOLSET "vc140")
message( STATUS "Using VC14 compiler." )
elseif ( MSVC12 )
set(CGAL_TOOLSET "vc120")
message( STATUS "Using VC12 compiler." )
elseif ( MSVC11 )
set(CGAL_TOOLSET "vc110")
message( STATUS "Using VC11 compiler." )
elseif ( MSVC10 )
set(CGAL_TOOLSET "vc100")
message( STATUS "Using VC10 compiler." )
elseif ( MSVC90 )
set(CGAL_TOOLSET "vc90")
message( STATUS "Using VC90 compiler." )
elseif ( MSVC80 )
set(CGAL_TOOLSET "vc80")
message( STATUS "Using VC80 compiler." )
elseif ( MSVC71 )
set(CGAL_TOOLSET "vc71")
message( STATUS "Using VC71 compiler." )
else()
message( STATUS "Using ${CMAKE_CXX_COMPILER} compiler." )
endif()
# From james Bigler, in the cmake users list.
IF (APPLE)
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
message(STATUS "DARWIN_VERSION=${DARWIN_VERSION}")
if (DARWIN_VERSION GREATER 8)
message(STATUS "Mac Leopard detected")
set(CGAL_APPLE_LEOPARD 1)
endif()
endif()
if ( NOT "${CMAKE_CFG_INTDIR}" STREQUAL "." )
set(HAS_CFG_INTDIR TRUE CACHE INTERNAL "Generator uses intermediate configuration directory" )
message( STATUS "Generator uses intermediate configuration directory: ${CMAKE_CFG_INTDIR}" )
endif()
endif()
# Find TAUCS library shipped with CGAL
#
# This module searches for TAUCS in CGAL "auxiliary" folder
# and in in $CGAL_TAUCS_DIR environment variable.
#
# This module sets the following variables:
# CGAL_TAUCS_FOUND - set to true if TAUCS library shipped with CGAL
# is found
# CGAL_TAUCS_PLATFORM - name of TAUCS subfolder corresponding to the current compiler
# CGAL_TAUCS_INCLUDE_DIR - list of folders (using full path name) containing
# TAUCS (and optionaly BLAS and LAPACK) headers
# CGAL_TAUCS_LIBRARIES_DIR -list of folders (using full path name) containing
# TAUCS (and optionaly BLAS and LAPACK) libraries
include(CGAL_Macros)
if ( NOT CGAL_TAUCS_FOUND )
#
# Find out TAUCS name for the current platform.
# This code is a translation of TAUCS "configure" script.
#
# The first task is to figure out CMAKE_SYSTEM_NAME
# (on unix this is uname -s, for windows it is Windows).
#message("DEBUG: CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
#message("DEBUG: CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
set( CGAL_TAUCS_PLATFORM "${CMAKE_SYSTEM_NAME}" )
# Convert to lower case
STRING(TOLOWER "${CGAL_TAUCS_PLATFORM}" CGAL_TAUCS_PLATFORM)
# Sometimes uname returns a value that is
# inconsistent with the way CGAL_TAUCS_PLATFORM is set. For example, on
# Solaris, CGAL_TAUCS_PLATFORM=solaris but uname returns SunOS.
if ( ${CGAL_TAUCS_PLATFORM} STREQUAL "sunos" )
set( CGAL_TAUCS_PLATFORM "solaris" )
endif()
if ( ${CGAL_TAUCS_PLATFORM} STREQUAL "windows" )
set( CGAL_TAUCS_PLATFORM "win32" )
endif()
# LS 2007: added "darwin_intel" for Intel Macs.
# "darwin" = original Darwin platform = PowerPC architecture.
if ( ${CGAL_TAUCS_PLATFORM} STREQUAL "darwin" )
# CMAKE_SYSTEM_PROCESSOR=uname -p
if ( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386" )
set( CGAL_TAUCS_PLATFORM "darwin_intel" )
endif()
endif()
# LS 2007: append "64" if 64 bits processor (tested on Linux only)
if ( ${CGAL_TAUCS_PLATFORM} STREQUAL "linux" )
# CMAKE_SYSTEM_PROCESSOR=uname -p
if ( ${CMAKE_SYSTEM_PROCESSOR} MATCHES ".*64.*" )
set( CGAL_TAUCS_PLATFORM "${CGAL_TAUCS_PLATFORM}64" )
endif()
endif()
#message("DEBUG: CGAL_TAUCS_PLATFORM = ${CGAL_TAUCS_PLATFORM}")
#
# Search for TAUCS folder.
#
#message("DEBUG: CGAL_SOURCE_DIRECTORY = ${CGAL_SOURCE_DIRECTORY}")
# VC++ uses auto-link, thus we search for a folder containing the output of
# build_taucs_win32_for_CGAL.bat/build_taucs_win64_for_CGAL.bat,
# ie TAUCS libraries compiled for all Windows runtimes.
if ( MSVC )
# Check $CGAL_TAUCS_DIR environment variable
fetch_env_var(CGAL_TAUCS_DIR)
#message("DEBUG: CGAL_TAUCS_DIR = ${CGAL_TAUCS_DIR}")
if (NOT "${CGAL_TAUCS_DIR}" STREQUAL "" AND EXISTS ${CGAL_TAUCS_DIR})
set( CGAL_TAUCS_INCLUDE_DIR "${CGAL_TAUCS_DIR}/include")
set( CGAL_TAUCS_LIBRARIES_DIR "${CGAL_TAUCS_DIR}/lib" )
set( CGAL_TAUCS_FOUND TRUE )
# Else, search for TAUCS in CGAL "auxiliary" folder
elseif ( EXISTS "${CGAL_SOURCE_DIRECTORY}/auxiliary/taucs" )
set( CGAL_TAUCS_INCLUDE_DIR "${CGAL_SOURCE_DIRECTORY}/auxiliary/taucs/include")
set( CGAL_TAUCS_LIBRARIES_DIR "${CGAL_SOURCE_DIRECTORY}/auxiliary/taucs/lib" )
set( CGAL_TAUCS_FOUND TRUE )
endif()
# On Unix, search for TAUCS "taucs_full" folder
else ( MSVC )
# Check $CGAL_TAUCS_DIR environment variable
fetch_env_var(CGAL_TAUCS_DIR)
#message("DEBUG: CGAL_TAUCS_DIR = ${CGAL_TAUCS_DIR}")
if (NOT "${CGAL_TAUCS_DIR}" STREQUAL "" AND EXISTS ${CGAL_TAUCS_DIR})
set( CGAL_TAUCS_INCLUDE_DIR "${CGAL_TAUCS_DIR}/build/${CGAL_TAUCS_PLATFORM}"
"${CGAL_TAUCS_DIR}/src" )
set( CGAL_TAUCS_LIBRARIES_DIR "${CGAL_TAUCS_DIR}/external/lib/${CGAL_TAUCS_PLATFORM}"
"${CGAL_TAUCS_DIR}/lib/${CGAL_TAUCS_PLATFORM}" )
set( CGAL_TAUCS_FOUND TRUE )
endif()
endif ( MSVC )
# Add variables to cache
set( CGAL_TAUCS_DIR "${CGAL_TAUCS_DIR}"
CACHE PATH "Directory containing BLAS, LAPACK and TAUCS" )
#message("DEBUG: CGAL_TAUCS_INCLUDE_DIR = ${CGAL_TAUCS_INCLUDE_DIR}")
#message("DEBUG: CGAL_TAUCS_LIBRARIES_DIR = ${CGAL_TAUCS_LIBRARIES_DIR}")
#message("DEBUG: CGAL_TAUCS_FOUND = ${CGAL_TAUCS_FOUND}")
endif ( NOT CGAL_TAUCS_FOUND )
This diff is collapsed.
This diff is collapsed.
# - Find CGAL
# Find the CGAL autolinking headers.
#
# CGAL_INCLUDE_DIR - where to find CGAL.h, etc.
# CGAL_FOUND - True if CGAL found.
IF (CGAL_INCLUDE_DIR)
# Already in cache, be silent
SET(CGAL_FIND_QUIETLY TRUE)
ENDIF (CGAL_INCLUDE_DIR)
GET_FILENAME_COMPONENT(module_file_path ${CMAKE_CURRENT_LIST_FILE} PATH )
# Check if the base path is set
if ( NOT CMAKE_WINDOWS_LIBS_DIR )
# This is the base directory for windows library search used in the finders we shipp.
set(CMAKE_WINDOWS_LIBS_DIR "c:/libs" CACHE STRING "Default Library search dir on windows." )
endif()
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*Win64" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*" )
SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x32/")
endif()
IF (NOT APPLE )
# Look for the header file.
FIND_PATH(CGAL_INCLUDE_DIR NAMES CGAL/auto_link/auto_link.h
PATHS "${VS_SEARCH_PATH}/CGAL-4.12/include"
"${VS_SEARCH_PATH}/CGAL-4.7/include"
/usr/include
../../External/include
$ENV{CGAL_DIR}/include
"C:/libs/CGAL-3.6/include"
"C:/Program Files/CGAL-3.5/include"
"C:/Programme/CGAL-3.5/include"
"C:/libs/CGAL-3.5/include"
"C:/Program Files/CGAL-3.4/include"
"C:/Programme/CGAL-3.4/include"
"C:/libs/CGAL-3.4/include"
"C:/Programme/CGAL-3.9/include"
"C:/Program Files/CGAL-3.9/include"
"C:/Program Files (x86)/CGAL-3.9/include"
${module_file_path}/../../../External/include )
ELSE( NOT APPLE)
# Look for the header file.
FIND_PATH(CGAL_INCLUDE_DIR NAMES CGAL/auto_link/auto_link.h
PATHS "/opt/local/include"
)
ENDIF( NOT APPLE )
MARK_AS_ADVANCED(CGAL_INCLUDE_DIR)
if ("${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" MATCHES ".*clang.*")
SET(CXX_IS_CLANG true)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[cC][lL][aA][nN][gG]")
SET(CXX_IS_CLANG true)
else()
SET(CXX_IS_CLANG false)
endif()
# Copy the results to the output variables.
IF(CGAL_INCLUDE_DIR )
SET(CGAL_FOUND 1)
SET(CGAL_INCLUDE_DIR ${CGAL_INCLUDE_DIR})
# Look for the taucs dir.
FIND_PATH(CGAL_TAUCS_DIR NAMES include/taucs.h
PATHS ${CGAL_INCLUDE_DIR}/../auxiliary/taucs)
IF(WIN32)
include(CGAL_GeneratorSpecificSettings)
find_path(CGAL_LIBRARY_DIR
NAMES "CGAL-${CGAL_TOOLSET}-mt.lib"
"CGAL-${CGAL_TOOLSET}-mt-gd.lib"
"CGAL-${CGAL_TOOLSET}-mt-4.12.lib"
"CGAL-${CGAL_TOOLSET}-mt-4.7.lib"
"CGAL-${CGAL_TOOLSET}-mt-4.5.lib"
PATHS "${CGAL_INCLUDE_DIR}/../lib"
DOC "Directory containing the CGAL library"
)
# Binary dir for DLLs
find_path(CGAL_BIN_DIR
NAMES "CGAL-${CGAL_TOOLSET}-mt-4.12.dll"
"CGAL-${CGAL_TOOLSET}-mt-4.7.dll"
"CGAL-${CGAL_TOOLSET}-mt-4.5.dll"
"CGAL-${CGAL_TOOLSET}-mt-gd.dll"
PATHS "${CGAL_INCLUDE_DIR}/../bin"
DOC "Directory containing the CGAL DLLs"
)
MARK_AS_ADVANCED(CGAL_BIN_DIR )
#add_definitions (-DCGAL_AUTOLINK)
ELSEIF( APPLE)
find_path(CGAL_LIBRARY_DIR
NAMES "libCGAL.dylib"
PATHS "/opt/local/lib/"
DOC "Directory containing the CGAL library"
)
list ( APPEND CGAL_LIBRARIES CGAL CGAL_Core CGAL_ImageIO mpfr )
if (NOT CXX_IS_CLANG)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -frounding-math")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -frounding-math")
endif()
ELSE( WIN32 )
find_path(CGAL_LIBRARY_DIR
NAMES "libCGAL.so"
PATHS "/usr/lib/" "/usr/lib64"
DOC "Directory containing the CGAL library"
)
list ( APPEND CGAL_LIBRARIES CGAL CGAL_Core CGAL_ImageIO)
if (NOT CXX_IS_CLANG)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frounding-math")
endif()
# This is needed to link correctly against lapack
add_definitions (-DCGAL_USE_F2C)
ENDIF(WIN32)
ELSE(CGAL_INCLUDE_DIR )
SET(CGAL_FOUND 0)
SET(CGAL_INCLUDE_DIR)
ENDIF(CGAL_INCLUDE_DIR )
#use eigen if available
find_package(EIGEN3)
if ( EIGEN3_FOUND )
add_definitions(-DCGAL_EIGEN3_ENABLED)
endif()
# Report the results.
IF(NOT CGAL_FOUND)
SET(CGAL_DIR_MESSAGE
"CGAL was not found. Make sure CGAL_INCLUDE_DIR is set to the directories containing the include files for CGAL. .")
IF(CGAL_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "${CGAL_DIR_MESSAGE}")
ELSEIF(NOT CGAL_FIND_QUIETLY)
MESSAGE(STATUS "${CGAL_DIR_MESSAGE}")
ELSE(NOT CGAL_FIND_QUIETLY)
ENDIF(CGAL_FIND_REQUIRED)
ELSE (NOT CGAL_FOUND)
IF(NOT CGAL_FIND_QUIETLY)
MESSAGE(STATUS "Looking for CGAL - found")
ENDIF(NOT CGAL_FIND_QUIETLY)
ENDIF(NOT CGAL_FOUND)
......@@ -20,6 +20,7 @@ endif()
find_path( GMM_INCLUDE_DIR
NAMES gmm/gmm.h
PATHS $ENV{GMM_DIR}
$ENV{GMM_DIR}/include
/usr/include
/usr/include
/usr/local/include
......
# Try to find the GMP libraries
# GMP_FOUND - system has GMP lib
# GMP_INCLUDE_DIR - the GMP include directory
# GMP_LIBRARY_DIR - Directory where the GMP libraries are located
# GMP_LIBRARIES - the GMP libraries
# GMP_IN_CGAL_AUXILIARY - TRUE if the GMP found is the one distributed with CGAL in the auxiliary folder
# TODO: support MacOSX
include(CGAL_FindPackageHandleStandardArgs)
include(CGAL_GeneratorSpecificSettings)
# Is it already configured?
if (GMP_INCLUDE_DIR AND GMP_LIBRARY_DIR )
set(GMP_FOUND TRUE)
else()
find_package(CGAL)
if (NOT CGAL_FOUND)
message(STATUS "CGAL not found .. required to use taucs!")
set(GMP_FOUND FALSE)
else ()
find_path(GMP_INCLUDE_DIR
NAMES gmp.h
PATHS "${CGAL_INCLUDE_DIR}/../auxiliary/gmp/include"
DOC "The directory containing the GMP header files"
)
if ( GMP_INCLUDE_DIR STREQUAL "${CMAKE_SOURCE_DIR}/auxiliary/gmp/include" )
cache_set( GMP_IN_CGAL_AUXILIARY TRUE )
endif()
if ( CGAL_AUTO_LINK_ENABLED )
message("AAAA")
find_path(GMP_LIBRARY_DIR
NAMES "gmp-${CGAL_TOOLSET}-mt.lib" "gmp-${CGAL_TOOLSET}-mt-gd.lib" libgmp-10.lib
PATHS "${CGAL_INCLUDE_DIR}/../auxiliary/gmp/lib"
DOC "Directory containing the GMP library"
)
list ( APPEND GMP_LIBRARIES libgmp-10.lib;libmpfr-4.lib )
else()
find_library(GMP_LIBRARIES NAMES gmp
PATHS ENV GMP_LIB_DIR
DOC "Path to the GMP library"
)
if ( GMP_LIBRARIES )
get_filename_component(GMP_LIBRARY_DIR ${GMP_LIBRARIES} PATH CACHE )
endif()
endif()
# Attempt to load a user-defined configuration for GMP if couldn't be found
if ( NOT GMP_INCLUDE_DIR OR NOT GMP_LIBRARY_DIR )
include( GMPConfig OPTIONAL )
endif()
find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_INCLUDE_DIR GMP_LIBRARY_DIR)
endif()
endif()
......@@ -83,35 +83,36 @@ if (WIN32)
ENDIF(IPOPT_INCLUDE_DIR)
ELSE( WIN32 )
find_path(IPOPT_INCLUDE_DIR NAMES IpNLP.hpp
PATHS "$ENV{IPOPT_HOME}/include/coin"
HINTS "$ENV{IPOPT_HOME}/include/coin"
"/usr/include/coin"
)
find_library( IPOPT_LIBRARY
ipopt
PATHS "$ENV{IPOPT_HOME}/lib"
HINTS "$ENV{IPOPT_HOME}/lib"
"/usr/lib" )
#wrong config under Debian workaround
add_definitions( -DHAVE_CSTDDEF )
# set optional path to HSL Solver for dynamic usage
find_path(IPOPT_HSL_LIBRARY_DIR
NAMES libhsl.so
libhsl.dylib
PATHS "$ENV{IPOPT_HSL_LIBRARY_PATH}"
HINTS "$ENV{IPOPT_HSL_LIBRARY_PATH}"
"$ENV{HOME}/opt/HSL/lib"
)
# find HSL library for fixed linking of solvers
find_library( IPOPT_HSL_LIBRARY
coinhsl
PATHS "$ENV{IPOPT_HOME}/lib"
NAMES hsl coinhsl
HINTS "$ENV{IPOPT_HSL_LIBRARY_PATH}"
"$ENV{IPOPT_HOME}/lib"
"/usr/lib" )
IF( IPOPT_HSL_LIBRARY_DIR)
IF( NOT IPOPT_FIND_QUIETLY )
......@@ -121,7 +122,7 @@ ELSE( WIN32 )
LIST( APPEND IPOPT_LIBRARY_DIRS "${IPOPT_HSL_LIBRARY_DIR}")
ENDIF(IPOPT_HSL_LIBRARY_DIR)
set(IPOPT_INCLUDE_DIRS "${IPOPT_INCLUDE_DIR}" )
set(IPOPT_LIBRARIES "${IPOPT_LIBRARY}" )
......
This diff is collapsed.
# Try to find the MPFR library
# See http://www.mpfr.org/
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(MPFR 2.3.0)
# to require version 2.3.0 to newer of MPFR.
#
# Once done this will define
#
# MPFR_FOUND - system has MPFR lib with correct version
# MPFR_INCLUDES - the MPFR include directory
# MPFR_LIBRARIES - the MPFR library
# MPFR_VERSION - MPFR version
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2010 Jitse Niesen, <jitse@maths.leeds.ac.uk>
# Redistribution and use is allowed according to the terms of the BSD license.
# Set MPFR_INCLUDES
find_package(CGAL)
find_path(MPFR_INCLUDES
NAMES
mpfr.h
PATHS
$ENV{GMPDIR}
${INCLUDE_INSTALL_DIR}
${CGAL_INCLUDE_DIR}/../auxiliary/gmp/include
)
# Set MPFR_FIND_VERSION to 1.0.0 if no minimum version is specified
if(NOT MPFR_FIND_VERSION)
if(NOT MPFR_FIND_VERSION_MAJOR)
set(MPFR_FIND_VERSION_MAJOR 1)
endif(NOT MPFR_FIND_VERSION_MAJOR)
if(NOT MPFR_FIND_VERSION_MINOR)
set(MPFR_FIND_VERSION_MINOR 0)
endif(NOT MPFR_FIND_VERSION_MINOR)
if(NOT MPFR_FIND_VERSION_PATCH)
set(MPFR_FIND_VERSION_PATCH 0)
endif(NOT MPFR_FIND_VERSION_PATCH)
set(MPFR_FIND_VERSION "${MPFR_FIND_VERSION_MAJOR}.${MPFR_FIND_VERSION_MINOR}.${MPFR_FIND_VERSION_PATCH}")
endif(NOT MPFR_FIND_VERSION)
if(MPFR_INCLUDES)
# Set MPFR_VERSION
file(READ "${MPFR_INCLUDES}/mpfr.h" _mpfr_version_header)
string(REGEX MATCH "define[ \t]+MPFR_VERSION_MAJOR[ \t]+([0-9]+)" _mpfr_major_version_match "${_mpfr_version_header}")
set(MPFR_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPFR_VERSION_MINOR[ \t]+([0-9]+)" _mpfr_minor_version_match "${_mpfr_version_header}")
set(MPFR_MINOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPFR_VERSION_PATCHLEVEL[ \t]+([0-9]+)" _mpfr_patchlevel_version_match "${_mpfr_version_header}")
set(MPFR_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}")
set(MPFR_VERSION ${MPFR_MAJOR_VERSION}.${MPFR_MINOR_VERSION}.${MPFR_PATCHLEVEL_VERSION})
# Check whether found version exceeds minimum version
if(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION})
set(MPFR_VERSION_OK FALSE)
message(STATUS "MPFR version ${MPFR_VERSION} found in ${MPFR_INCLUDES}, "
"but at least version ${MPFR_FIND_VERSION} is required")
else(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION})
set(MPFR_VERSION_OK TRUE)
endif(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION})
endif(MPFR_INCLUDES)
# Set MPFR_LIBRARIES
find_library(MPFR_LIBRARIES mpfr libmpfr-4 PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR} ${CGAL_INCLUDE_DIR}/../auxiliary/gmp/lib)
# Epilogue