Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #163 from sloriot/fix_SFCGAL_linking
Browse files Browse the repository at this point in the history
Fix linking with CGAL and CGAL dependencies
  • Loading branch information
vmora authored Apr 23, 2018
2 parents 2a378a0 + 5a2369d commit 561c301
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 235 deletions.
32 changes: 1 addition & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules;${CMAKE_MODULE_PATH}"

set( SFCGAL_VERSION_MAJOR 1 )
set( SFCGAL_VERSION_MINOR 3 )
set( SFCGAL_VERSION_PATCH 4 )
set( SFCGAL_VERSION_PATCH 5 )

set( SFCGAL_VERSION "${SFCGAL_VERSION_MAJOR}.${SFCGAL_VERSION_MINOR}.${SFCGAL_VERSION_PATCH}" )

Expand Down Expand Up @@ -82,32 +82,6 @@ if((${Boost_MAJOR_VERSION} EQUAL 1) AND (${Boost_MINOR_VERSION} EQUAL 60) AND ($
include_directories( patches/boost-1.60.0 )
endif()

#-- GMP (facultative) -------------------------------------
find_package( GMP )
if( ${GMP_FOUND} )
message( STATUS "GMP_INCLUDE_DIRS = ${GMP_INCLUDE_DIRS}" )
message( STATUS "GMP_LIBRARIES = ${GMP_LIBRARIES}" )
set( SFCGAL_WITH_GMP ON )
endif()



#-- MPFR (needs GMP) --------------------------------------
if( ${GMP_FOUND} )
find_package( MPFR )
if( ${MPFR_FOUND} )
message( STATUS "MPFR_INCLUDE_DIRS = ${MPFR_INCLUDE_DIRS}" )
message( STATUS "MPFR_LIBRARIES = ${MPFR_LIBRARIES}" )
set( SFCGAL_WITH_MPFR ON )
endif()
endif()

if( NOT ${GMP_FOUND} OR NOT ${MPFR_FOUND} )
message( WARNING "can't find GMP and MPFR, using default kernel" )
set( EPLU_USE_CARTESIAN_KERNEL ON )
endif()


#-- OpenScenegraph -----------------------------------------
if ( SFCGAL_WITH_OSG )
find_package( OpenSceneGraph COMPONENTS osgDB osgUtil )
Expand Down Expand Up @@ -143,14 +117,10 @@ endif()
include_directories( SYSTEM
${CGAL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${MPFR_INCLUDE_DIRS}
${GMP_INCLUDE_DIRS}
)
link_directories(
${CGAL_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS}
${MPFR_LIBRARY_DIRS}
${GMP_LIBRARY_DIRS}
)

#-- Warnings, frounding-math and gprof ------------------------------------------
Expand Down
48 changes: 0 additions & 48 deletions cmake/Modules/FindGMP.cmake

This file was deleted.

37 changes: 0 additions & 37 deletions cmake/Modules/FindMPFR.cmake

This file was deleted.

10 changes: 2 additions & 8 deletions example/CGAL-basic_manip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ GET_FILENAME_COMPONENT( EXAMPLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
)
target_link_libraries( example-${EXAMPLE_NAME} SFCGAL)
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
10 changes: 2 additions & 8 deletions example/CGAL-cartesian_kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ GET_FILENAME_COMPONENT( EXAMPLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
)
target_link_libraries( example-${EXAMPLE_NAME} SFCGAL)
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
10 changes: 2 additions & 8 deletions example/CGAL-point_generator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ GET_FILENAME_COMPONENT( EXAMPLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
)
target_link_libraries( example-${EXAMPLE_NAME} SFCGAL)
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
10 changes: 2 additions & 8 deletions example/CGAL-polygon_triangulation2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ GET_FILENAME_COMPONENT( EXAMPLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
)
target_link_libraries( example-${EXAMPLE_NAME} SFCGAL)
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
10 changes: 2 additions & 8 deletions example/CGAL-triangulation2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ GET_FILENAME_COMPONENT( EXAMPLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
)
target_link_libraries( example-${EXAMPLE_NAME} SFCGAL)
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
9 changes: 1 addition & 8 deletions example/SFCGAL-building/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ GET_FILENAME_COMPONENT( EXAMPLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
SFCGAL-osg
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
)
target_link_libraries( example-${EXAMPLE_NAME} SFCGAL SFCGAL-osg)
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
10 changes: 1 addition & 9 deletions example/SFCGAL-export-osg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ GET_FILENAME_COMPONENT( EXAMPLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
SFCGAL-osg
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${OPENSCENEGRAPH_LIBRARIES}
${Boost_LIBRARIES}
)
target_link_libraries( example-${EXAMPLE_NAME} SFCGAL SFCGAL-osg)
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
10 changes: 2 additions & 8 deletions example/SFCGAL-offset/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ GET_FILENAME_COMPONENT( EXAMPLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
)
target_link_libraries( example-${EXAMPLE_NAME} SFCGAL)
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
2 changes: 1 addition & 1 deletion sfcgal-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ case $1 in
echo -I${prefix}/include
;;
--libs)
echo -L${libdir} -l@SFCGAL_LIB_NAME@ -lCGAL -lCGAL_Core
echo -L${libdir} -l@SFCGAL_LIB_NAME@
;;
--ldflags)
echo -L${libdir}
Expand Down
9 changes: 1 addition & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ add_dependencies( SFCGAL copy )
set_target_properties( SFCGAL PROPERTIES VERSION ${SFCGAL_VERSION}
SOVERSION ${SFCGAL_VERSION_MAJOR} )

target_link_libraries( SFCGAL ${CGAL_LIBRARIES} )
if( ${SFCGAL_WITH_MPFR} )
target_link_libraries( SFCGAL ${MPFR_LIBRARIES} )
endif( ${SFCGAL_WITH_MPFR} )

if( ${SFCGAL_WITH_GMP} )
target_link_libraries( SFCGAL ${GMP_LIBRARIES} )
endif( ${SFCGAL_WITH_GMP} )
target_link_libraries( SFCGAL CGAL::CGAL CGAL::CGAL_Core)

target_link_libraries( SFCGAL ${Boost_LIBRARIES} )

Expand Down
10 changes: 0 additions & 10 deletions src/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@

#include <SFCGAL/export.h>

/**
* indicates if GMP is available
*/
#cmakedefine SFCGAL_WITH_GMP
/**
* indicates if MPFR is available
*/
#cmakedefine SFCGAL_WITH_MPFR


/**
* indicates if OpenSceneGraph dependency is activated
*/
Expand Down
9 changes: 1 addition & 8 deletions test/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
file( GLOB SFCGAL_BENCHS_SOURCES *.cpp )
add_executable( bench-SFCGAL ${SFCGAL_BENCHS_SOURCES} )
target_link_libraries( bench-SFCGAL
SFCGAL
${Boost_LIBRARIES}
${CGAL_LIBRARIES}
)
if( SFCGAL_WITH_MPFR )
target_link_libraries( bench-SFCGAL ${MPFR_LIBRARIES} ${GMP_LIBRARIES} )
endif()
target_link_libraries( bench-SFCGAL SFCGAL)
set_target_properties( bench-SFCGAL PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS bench-SFCGAL DESTINATION bin )

6 changes: 1 addition & 5 deletions test/garden/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ file( GLOB_RECURSE SFCGAL_REGRESS_GARDEN_TEST_SOURCES *.cpp )
set( REGRESS_NAME garden-test-SFCGAL )
add_executable( ${REGRESS_NAME} ${SFCGAL_REGRESS_GARDEN_TEST_SOURCES} )

target_link_libraries( ${REGRESS_NAME}
SFCGAL
CGAL::CGAL
CGAL::CGAL_Core
)
target_link_libraries( ${REGRESS_NAME} SFCGAL)
target_link_libraries( ${REGRESS_NAME} ${CGAL_3RD_PARTY_LIBRARIES} )

set_target_properties( ${REGRESS_NAME} PROPERTIES DEBUG_POSTFIX "d" )
Expand Down
6 changes: 1 addition & 5 deletions test/regress/convex_hull/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ file( GLOB_RECURSE SFCGAL_REGRESS_CONVEX_HULL_TEST_SOURCES *.cpp )
set( REGRESS_NAME test-regress-convex_hull )
add_executable( ${REGRESS_NAME} ${SFCGAL_REGRESS_CONVEX_HULL_TEST_SOURCES} )

target_link_libraries( ${REGRESS_NAME}
SFCGAL
CGAL::CGAL
CGAL::CGAL_Core
)
target_link_libraries( ${REGRESS_NAME} SFCGAL)

target_link_libraries( ${REGRESS_NAME} ${CGAL_3RD_PARTY_LIBRARIES} )

Expand Down
6 changes: 1 addition & 5 deletions test/regress/polygon_triangulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ file( GLOB_RECURSE SFCGAL_REGRESS_POLYGON_TRIANGULATOR_TEST_SOURCES *.cpp )
set( REGRESS_NAME test-regress-polygon_triangulator )
add_executable( ${REGRESS_NAME} ${SFCGAL_REGRESS_POLYGON_TRIANGULATOR_TEST_SOURCES} )

target_link_libraries( ${REGRESS_NAME}
SFCGAL
CGAL::CGAL
CGAL::CGAL_Core
)
target_link_libraries( ${REGRESS_NAME} SFCGAL)
target_link_libraries( ${REGRESS_NAME} ${CGAL_3RD_PARTY_LIBRARIES})


Expand Down
8 changes: 1 addition & 7 deletions test/regress/standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
file( GLOB_RECURSE SFCGAL_REGRESS_STANDALONE_TEST_SOURCES *.cpp )
add_executable( standalone-regress-test-SFCGAL ${SFCGAL_REGRESS_STANDALONE_TEST_SOURCES} )

target_link_libraries( standalone-regress-test-SFCGAL
SFCGAL
CGAL::CGAL
CGAL::CGAL_Core
)
target_link_libraries( standalone-regress-test-SFCGAL ${CGAL_3RD_PARTY_LIBRARIES} )

target_link_libraries( standalone-regress-test-SFCGAL SFCGAL)

set_target_properties( standalone-regress-test-SFCGAL PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS standalone-regress-test-SFCGAL DESTINATION bin )
Expand Down
6 changes: 1 addition & 5 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#-- build unit tests
file( GLOB_RECURSE SFCGAL_UNIT_TEST_SOURCES *.cpp )
add_executable( unit-test-SFCGAL ${SFCGAL_UNIT_TEST_SOURCES} )
target_link_libraries( unit-test-SFCGAL
SFCGAL
CGAL::CGAL
CGAL::CGAL_Core
)
target_link_libraries( unit-test-SFCGAL SFCGAL)
target_link_libraries(unit-test-SFCGAL ${CGAL_3RD_PARTY_LIBRARIES})

#include( PrecompiledHeader )
Expand Down

0 comments on commit 561c301

Please sign in to comment.