diff --git a/.gitattributes b/.gitattributes index 2cdc8bce4c6..55de3c12f2e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1585,7 +1585,6 @@ Installation/cmake/modules/CGAL_Macros.cmake -text Installation/cmake/modules/CGAL_SetupBoost.cmake -text Installation/cmake/modules/CGAL_SetupDependencies.cmake -text Installation/cmake/modules/CGAL_SetupFlags.cmake -text -Installation/cmake/modules/CGAL_SetupGMP.cmake -text Installation/cmake/modules/CGAL_SetupGMPXX.cmake -text Installation/cmake/modules/CGAL_UseBLAS.cmake -text Installation/cmake/modules/CGAL_UseLAPACK.cmake -text @@ -1618,7 +1617,6 @@ Installation/cmake/modules/FindRS.cmake -text Installation/cmake/modules/FindTAUCS.cmake -text Installation/cmake/modules/Qt3Macros-patched.cmake -text Installation/cmake/modules/UseCGAL.cmake -text -Installation/cmake/modules/UseESBTL.cmake -text Installation/cmake/modules/test_MPFI.cpp -text Installation/config/support/print_BOOST_version.cpp -text Installation/config/support/print_GMP_version.cpp -text diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 42fc3cab9f3..31fcb6725b6 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -412,7 +412,13 @@ endmacro() # this is the place to tell which external libs are supporting list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIRARIES 0 GMP GMPXX MPFR LEDA MPFI RS NTL) +list (INSERT CGAL_MANDATORY_3RD_PARTY_LIBRARIES 0 GMP GMPXX MPFR) + +hide_variable(CGAL_SUPPORTING_3RD_PARTY_LIRARIES) +hide_variable(CGAL_MANDATORY_3RD_PARTY_LIBRARIES) + foreach (lib ${CGAL_SUPPORTING_3RD_PARTY_LIRARIES}) +# TODO EBEB? add_config_flag( CGAL_USE_${lib} ) endforeach() diff --git a/Installation/cmake/modules/CGALConfig_binary.cmake.in b/Installation/cmake/modules/CGALConfig_binary.cmake.in index 74b0e3f231c..25090b9d727 100644 --- a/Installation/cmake/modules/CGALConfig_binary.cmake.in +++ b/Installation/cmake/modules/CGALConfig_binary.cmake.in @@ -41,8 +41,6 @@ set(CGAL_ImageIO_LIBRARY "@CGAL_ImageIO_LIBRARY@") set(CGAL_Qt3_LIBRARY "@CGAL_Qt3_LIBRARY@" ) set(CGAL_Qt4_LIBRARY "@CGAL_Qt4_LIBRARY@" ) -set(CGAL_3RD_PARTY_PRECONFIGURED "@CGAL_3RD_PARTY_PRECONFIGURED@" ) - set(CGAL_3RD_PARTY_INCLUDE_DIRS "@CGAL_3RD_PARTY_INCLUDE_DIRS@" ) set(CGAL_3RD_PARTY_DEFINITIONS "@CGAL_3RD_PARTY_DEFINITIONS@" ) set(CGAL_3RD_PARTY_LIBRARIES_DIRS "@CGAL_3RD_PARTY_LIBRARIES_DIRS@" ) @@ -71,8 +69,6 @@ set(CGAL_Qt4_3RD_PARTY_LIBRARIES "@CGAL_Qt4_3RD_PARTY_LIBRARIES@" ) set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}") -set(CGAL_GMP_VERSION "@GMP_VERSION@") -set(CGAL_MPFR_VERSION "@MPFR_VERSION@") set(CGAL_AUTO_LINK_GMP "@CGAL_AUTO_LINK_GMP@") set(CGAL_AUTO_LINK_MPFR "@CGAL_AUTO_LINK_MPFR@") @@ -124,9 +120,14 @@ endforeach() set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} ) # for preconfigured libs +set(CGAL_SUPPORTING_3RD_PARTY_LIRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIRARIES@") +set(CGAL_MANDATORY_3RD_PARTY_LIRARIES "@CGAL_MANDATORY_3RD_PARTY_LIRARIES@") + +set(RS3_FOUND "@RS3_FOUND@" ) set(RS3_USE_FILE "@RS3_USE_FILE@" ) -set(RS3_FOUND "@RS3_FOUND" ) set(RS3_INCLUDE_DIR "@RS3_INCLUDE_DIR@" ) set(RS3_LIBRARIES "@RS3_LIBRARIES@" ) set(RS3_DEFINITIONS "@RS3_DEFINITIONS@" ) +set(RS3_CXX_FLAGS "@RS3_CXX_FLAGS@" ) +set(RS3_VERSION "@RS3_VERSION@" ) diff --git a/Installation/cmake/modules/CGALConfig_install.cmake.in b/Installation/cmake/modules/CGALConfig_install.cmake.in index 3af0640db87..5f141070afb 100644 --- a/Installation/cmake/modules/CGALConfig_install.cmake.in +++ b/Installation/cmake/modules/CGALConfig_install.cmake.in @@ -72,8 +72,6 @@ set(CGAL_Qt4_3RD_PARTY_LIBRARIES_DIRS "@CGAL_Qt4_3RD_PARTY_LIBRARIES_DIRS@" ) set(CGAL_Qt4_3RD_PARTY_LIBRARIES "@CGAL_Qt4_3RD_PARTY_LIBRARIES@" ) set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}") -set(CGAL_GMP_VERSION "@GMP_VERSION@") -set(CGAL_MPFR_VERSION "@MPFR_VERSION@") set(CGAL_AUTO_LINK_GMP "@CGAL_AUTO_LINK_GMP@") set(CGAL_AUTO_LINK_MPFR "@CGAL_AUTO_LINK_MPFR@") @@ -124,3 +122,16 @@ endforeach() # Starting with cmake 2.6.3, CGAL_FIND_COMPONENTS is cleared out when find_package returns. # But we need it within UseCGAL.cmake, so we save it aside into another variable set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} ) + +# for preconfigured libs +set(CGAL_SUPPORTING_3RD_PARTY_LIRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIRARIES@") +set(CGAL_MANDATORY_3RD_PARTY_LIRARIES "@CGAL_MANDATORY_3RD_PARTY_LIRARIES@") + +set(RS3_FOUND "@RS3_FOUND@" ) +set(RS3_USE_FILE "@RS3_USE_FILE@" ) +set(RS3_INCLUDE_DIR "@RS3_INCLUDE_DIR@" ) +set(RS3_LIBRARIES "@RS3_LIBRARIES@" ) +set(RS3_DEFINITIONS "@RS3_DEFINITIONS@" ) +set(RS3_CXX_FLAGS "@RS3_CXX_FLAGS@" ) +set(RS3_VERSION "@RS3_VERSION@" ) + diff --git a/Installation/cmake/modules/CGAL_Macros.cmake b/Installation/cmake/modules/CGAL_Macros.cmake index 39bc1405c67..19520267b5c 100644 --- a/Installation/cmake/modules/CGAL_Macros.cmake +++ b/Installation/cmake/modules/CGAL_Macros.cmake @@ -192,27 +192,6 @@ if( NOT CGAL_MACROS_FILE_INCLUDED ) endmacro() - macro( preconfigure_lib lib ) - - find_package( ${lib} ) - - if ( ${lib}_FOUND ) - - message( STATUS "${lib} include: ${${lib}_INCLUDE_DIR}" ) - message( STATUS "${lib} libraries: ${${lib}_LIBRARIES}" ) - message( STATUS "${lib} definitions: ${${lib}_DEFINITIONS}" ) - - set ( CGAL_USE_${lib} TRUE ) - - add_to_cached_list(CGAL_3RD_PARTY_PRECONFIGURED ${lib}) - message( STATUS "${lib} is preconfigured with use-file: ${${lib}_USE_FILE}") - - endif() - - set ( CGAL_${lib}_PRECONFIGRUED TRUE ) - - endmacro() - macro( use_lib lib usefile) string( REGEX REPLACE "###" "" filename ${usefile}) @@ -281,14 +260,16 @@ if( NOT CGAL_MACROS_FILE_INCLUDED ) file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "set( ${lib}_INCLUDE_DIR \"${${lib}_INCLUDE_DIR}\" )\n") file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "set( ${lib}_LIBRARIES \"${${lib}_LIBRARIES}\" )\n") file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "set( ${lib}_USE_DEFINITIONS \"${${lib}_DEFINITIONS}\" )\n\n") - -# TODO-EBEB add CXX_FLAGS to CGALConfig.cmake + file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "set( ${lib}_CXX_FLAGS \"${${lib}_CXX_FLAGS}\" )\n") + file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "set( ${lib}_VERSION \"${${lib}_VERSION}\" )\n") file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "set( ${lib}_FOUND \"${${lib}_FOUND}\")\n") file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "set( ${lib}_USE_FILE \"${${lib}_USE_FILE}\" )\n") file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "set( ${lib}_INCLUDE_DIR \"${${lib}_INCLUDE_DIR}\" )\n") file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "set( ${lib}_LIBRARIES \"${${lib}_LIBRARIES}\" )\n") file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "set( ${lib}_DEFINITIONS \"${${lib}_DEFINITIONS}\" )\n\n") + file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "set( ${lib}_CXX_FLAGS \"${${lib}_CXX_FLAGS}\" )\n\n") + file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "set( ${lib}_VERSION \"${${lib}_VERSION}\" )\n\n") endforeach() diff --git a/Installation/cmake/modules/CGAL_SetupDependencies.cmake b/Installation/cmake/modules/CGAL_SetupDependencies.cmake index 44e9d0057c2..8ea4dd5f211 100644 --- a/Installation/cmake/modules/CGAL_SetupDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupDependencies.cmake @@ -4,39 +4,59 @@ message ( STATUS "External libraries supported: ${CGAL_SUPPORTING_3RD_PARTY_LIRA foreach (lib ${CGAL_SUPPORTING_3RD_PARTY_LIRARIES}) - # 1) preconfiguration for non-lib CMakeLists.txt - - # TODO move "NOT LIB_FOUND" to second part of this loop - if (NOT ${lib}_FOUND OR WITH_${lib}) - preconfigure_lib( ${lib} ) - endif() + #message (STATUS "Check ${lib}") + # Part 1: Try to find lib - # 2) handling for libraries required to build CGAL's libraries + # TODO-EBEB do all libs have a WITH_ by default? + + list(FIND CGAL_MANDATORY_3RD_PARTY_LIBRARIES "${lib}" POSITION) + if ("${POSITION}" STRGREATER "-1" OR WITH_${lib}) + + # message (STATUS "With ${lib} given") + + find_package( ${lib} ) + + if (${lib}_FOUND) + message( STATUS "${lib} is preconfigured with use-file: ${${lib}_USE_FILE}") + message( STATUS "${lib} include: ${${lib}_INCLUDE_DIR}" ) + message( STATUS "${lib} libraries: ${${lib}_LIBRARIES}" ) + message( STATUS "${lib} definitions: ${${lib}_DEFINITIONS}" ) + message( STATUS "${lib} cxx flags: ${${lib}_CXX_FLAGS}" ) + + set ( CGAL_USE_${lib} 1 ) + + # Part 2: Add some lib-specific definitions or obtain version + + if (${lib} STREQUAL "GMP") + if ( MSVC AND NOT CGAL_AUTO_LINK_GMP ) + add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_GMP ) + endif() + get_dependency_version(GMP) + endif() + + if (${lib} STREQUAL "MPFR") + if ( MSVC AND NOT CGAL_AUTO_LINK_MPFR ) + add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_MPFR ) + endif() + set( MPFR_DEPENDENCY_INCLUDE_DIR ${GMP_INCLUDE_DIR} ) + set( MPFR_DEPENDENCY_LIBRARIES ${GMP_LIBRARIES} ) + get_dependency_version(MPFR) + endif() + + if (${lib} STREQUAL "LEDA") + # special case for LEDA - add a flag + uniquely_add_flags( CMAKE_CXX_FLAGS ${LEDA_CXX_FLAGS} ) + endif() + + else() + + if ("${POSITION}" STRGREATER "-1") + message( ERROR "CGAL requires ${lib} to be found" ) + endif() - if ( ${lib} STREQUAL "GMPXX" ) - - if ( MSVC AND NOT CGAL_AUTO_LINK_MPFR ) - add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_MPFR ) - endif() - if ( MSVC AND NOT CGAL_AUTO_LINK_GMP ) - add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_GMP ) endif() - get_dependency_version(GMP) - set( MPFR_DEPENDENCY_LIBRARIES ${GMP_LIBRARIES} ) - set( MPFR_DEPENDENCY_INCLUDE_DIR ${GMP_INCLUDE_DIR} ) - get_dependency_version(MPFR) - - if ( NOT MPFR_FOUND ) - preconfigure_lib(MPFR) - endif() - - endif() - - if ( ${lib} STREQUAL "LEDA" AND WITH_LEDA ) - include(CGAL_UseLEDA) - uniquely_add_flags( CMAKE_CXX_FLAGS ${LEDA_CXX_FLAGS} ) endif() endforeach() @@ -46,13 +66,10 @@ if( NOT GMP_FOUND ) message( STATUS "CGAL_Core needs GMP, cannot be configured.") endif( NOT GMP_FOUND ) -message( STATUS "Preconfigured libraries: ${CGAL_3RD_PARTY_PRECONFIGURED}") - +# finally setup Boost include(CGAL_SetupBoost) if ( MSVC ) add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES "psapi.lib" ) endif( MSVC ) - - diff --git a/Installation/cmake/modules/CGAL_SetupGMP.cmake b/Installation/cmake/modules/CGAL_SetupGMP.cmake deleted file mode 100644 index 1ff612c90eb..00000000000 --- a/Installation/cmake/modules/CGAL_SetupGMP.cmake +++ /dev/null @@ -1,56 +0,0 @@ -if ( NOT CGAL_GMP_SETUP ) - - find_package( GMP ) - find_package( MPFR ) - - if( GMP_FOUND ) - if( MPFR_FOUND ) - - include(CGAL_Macros) - - message( STATUS "GMP include: ${GMP_INCLUDE_DIR}" ) - message( STATUS "GMP libraries: ${GMP_LIBRARIES}" ) - message( STATUS "GMP definitions: ${GMP_DEFINITIONS}" ) - get_dependency_version(GMP) - - message( STATUS "MPFR include: ${MPFR_INCLUDE_DIR}" ) - message( STATUS "MPFR libraries: ${MPFR_LIBRARIES}" ) - message( STATUS "MPFR definitions: ${MPFR_DEFINITIONS}" ) - set( MPFR_DEPENDENCY_LIBRARIES ${GMP_LIBRARIES} ) - set( MPFR_DEPENDENCY_INCLUDE_DIR ${GMP_INCLUDE_DIR} ) - get_dependency_version(MPFR) - - set ( CGAL_USE_GMP 1 ) - set ( CGAL_USE_MPFR 1 ) - - add_to_cached_list(CGAL_3RD_PARTY_INCLUDE_DIRS ${MPFR_INCLUDE_DIR} ) - add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES_DIRS ${MPFR_LIBRARIES_DIR} ) - add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS ${MPFR_DEFINITIONS} ) - - add_to_cached_list(CGAL_3RD_PARTY_INCLUDE_DIRS ${GMP_INCLUDE_DIR} ) - add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES_DIRS ${GMP_LIBRARIES_DIR} ) - add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS ${GMP_DEFINITIONS} ) - - if ( NOT CGAL_AUTO_LINK_MPFR ) - add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES ${MPFR_LIBRARIES} ) - endif() - if ( NOT CGAL_AUTO_LINK_GMP ) - add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES ${GMP_LIBRARIES} ) - endif() - if ( MSVC AND NOT CGAL_AUTO_LINK_MPFR ) - add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_MPFR ) - endif() - if ( MSVC AND NOT CGAL_AUTO_LINK_GMP ) - add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_GMP ) - endif() - else( MPFR_FOUND ) - - message("CGAL GMP support needs MPFR. GMP will not be supported.") - - endif( MPFR_FOUND ) - - endif( GMP_FOUND) - - set( CGAL_GMP_SETUP TRUE ) - -endif() diff --git a/Installation/cmake/modules/FindNTL.cmake b/Installation/cmake/modules/FindNTL.cmake index 29cf9622856..740f143b11e 100644 --- a/Installation/cmake/modules/FindNTL.cmake +++ b/Installation/cmake/modules/FindNTL.cmake @@ -12,11 +12,11 @@ else( NOT GMP_FOUND ) include( CGAL_VersionUtils ) - IS_VERSION_LESS("${CGAL_GMP_VERSION}" "3.1.1" _IS_GMP_VERSION_TOO_LOW) + IS_VERSION_LESS("${GMP_VERSION}" "3.1.1" _IS_GMP_VERSION_TOO_LOW) if( _IS_GMP_VERSION_TOO_LOW ) - message( ERROR, "NTL needs GMP>=3.1.1. Your GMP version is ${CGAL_GMP_VERSION}." ) + message( ERROR, "NTL needs GMP>=3.1.1. Your GMP version is ${GMP_VERSION}." ) else( _IS_GMP_VERSION_TOO_LOW ) @@ -99,7 +99,6 @@ else( NOT GMP_FOUND ) endif( NOT GMP_FOUND ) if ( NTL_FOUND ) - set( NTL_USE_FILE "CGAL_UseNTL" ) # if ( NOT NTL_FIND_QUIETLY ) # message(STATUS "Found NTL: ${NTL_LIBRARY}") # endif (NOT NTL_FIND_QUIETLY ) diff --git a/Installation/cmake/modules/FindRS.cmake b/Installation/cmake/modules/FindRS.cmake index b17b2c0b2dd..e8055051264 100644 --- a/Installation/cmake/modules/FindRS.cmake +++ b/Installation/cmake/modules/FindRS.cmake @@ -33,16 +33,12 @@ if( MPFI_FOUND ) DOC "Path to the RS3 library" ) - if ( NOT CGAL_GMP_VERSION ) - set ( CGAL_GMP_VERSION ${GMP_VERSION} ) - endif() - - IS_VERSION_LESS("${CGAL_GMP_VERSION}" "4.2.0" _IS_GMP_VERSION_TO_LOW) + IS_VERSION_LESS("$GMP_VERSION}" "4.2.0" _IS_GMP_VERSION_TO_LOW) if(_IS_GMP_VERSION_TO_LOW) message( STATUS - "RS needs GMP>=4.2. Your GMP version is ${CGAL_GMP_VERSION}." ) + "RS needs GMP>=4.2. Your GMP version is ${GMP_VERSION}." ) else(_IS_GMP_VERSION_TO_LOW) diff --git a/Installation/cmake/modules/UseCGAL.cmake b/Installation/cmake/modules/UseCGAL.cmake index 5527191843c..1581d246bb9 100644 --- a/Installation/cmake/modules/UseCGAL.cmake +++ b/Installation/cmake/modules/UseCGAL.cmake @@ -20,6 +20,11 @@ if(NOT USE_CGAL_FILE_INCLUDED) set( CGAL_LIBRARIES ) + # special role of leda + if (LEDA_FOUND) + use_lib( LEDA "###${LEDA_USE_FILE}") + endif() + foreach ( CGAL_COMPONENT ${CGAL_REQUESTED_COMPONENTS} ) message (STATUS "CGAL requested component: ${CGAL_COMPONENT}") @@ -32,12 +37,14 @@ if(NOT USE_CGAL_FILE_INCLUDED) add_to_list( CGAL_3RD_PARTY_LIBRARIES_DIRS ${CGAL_${CGAL_COMPONENT}_3RD_PARTY_LIBRARIES_DIRS} ) endif() - # TODO-EBEB enable ALL_PRECONFIGURED_LIBS with cmake-option (which is, e.g., not given by testsuite) + # TODO-EBEB enable ALL_PRECONFIGURED_LIBS with cmake-option (which is, e.g., not given by testsuite if ( ${CGAL_COMPONENT} STREQUAL "ALL_PRECONFIGURED_LIBS" ) - message( STATUS "External libraries ${CGAL_3RD_PARTY_PRECONFIGURED} are preconfigured") - foreach ( CGAL_3RD_PARTY_LIB ${CGAL_3RD_PARTY_PRECONFIGURED}) - use_lib( ${CGAL_3RD_PARTY_LIB} "###${${CGAL_3RD_PARTY_LIB}_USE_FILE}") + message( STATUS "External libraries are all used") + foreach ( CGAL_3RD_PARTY_LIB ${CGAL_SUPPORTING_3RD_PARTY_LIRARIES}) + if (${CGAL_3RD_PARTY_LIB}_FOUND) + use_lib( ${CGAL_3RD_PARTY_LIB} "###${${CGAL_3RD_PARTY_LIB}_USE_FILE}") + endif() endforeach() else() diff --git a/Installation/cmake/modules/UseESBTL.cmake b/Installation/cmake/modules/UseESBTL.cmake deleted file mode 100644 index d72567a5da9..00000000000 --- a/Installation/cmake/modules/UseESBTL.cmake +++ /dev/null @@ -1,4 +0,0 @@ -# This module setups the compiler for using ESBTL library. -# It assumes that find_package(ESBTL) was already called. - -include_directories( ${ESBTL_INCLUDE_DIR} )