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

Commit

Permalink
Add a SFCGAL-osg library for OSG specific functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed Nov 8, 2016
1 parent e61c527 commit ae4fbc6
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 22 deletions.
18 changes: 7 additions & 11 deletions example/SFCGAL-building/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
SFCGAL
SFCGAL-osg
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${Boost_LIBRARIES}
)
if(SFCGAL_WITH_OSG)
target_link_libraries( example-${EXAMPLE_NAME}
${OPENSCENEGRAPH_LIBRARIES}
)
endif()
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
7 changes: 4 additions & 3 deletions example/SFCGAL-export-osg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ GET_FILENAME_COMPONENT( EXAMPLE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
add_executable( example-${EXAMPLE_NAME}
main.cpp
)
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
target_link_libraries( example-${EXAMPLE_NAME}
SFCGAL
SFCGAL-osg
${CGAL_LIBRARIES}
${MPFR_LIBRARIES}
${GMP_LIBRARIES}
${OPENSCENEGRAPH_LIBRARIES}
${Boost_LIBRARIES}
)
set_target_properties( example-${EXAMPLE_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
install( TARGETS example-${EXAMPLE_NAME} DESTINATION bin )
50 changes: 42 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ foreach (header ${SFCGAL_HEADERS_COPIED})
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/${header} ${CMAKE_BINARY_DIR}/include/SFCGAL/${header} DEPENDS ${CMAKE_SOURCE_DIR}/src/${header})
endforeach()

if ( NOT SFCGAL_WITH_OSG )
message( STATUS "removing ${CMAKE_SOURCE_DIR}/src/io/osg.h and ${CMAKE_SOURCE_DIR}/src/SFCGAL/io/osg.cpp from the library")
list(REMOVE_ITEM SFCGAL_HEADERS "${CMAKE_SOURCE_DIR}/src/io/osg.h")
list(REMOVE_ITEM SFCGAL_SOURCES "${CMAKE_SOURCE_DIR}/src/io/osg.cpp")
endif()
set( SFCGAL_OSG_HEADERS
${CMAKE_SOURCE_DIR}/src/io/osg.h
${CMAKE_SOURCE_DIR}/src/detail/io/OsgFactory.h )
set( SFCGAL_OSG_SOURCES
${CMAKE_SOURCE_DIR}/src/io/osg.cpp
${CMAKE_SOURCE_DIR}/src/detail/io/OsgFactory.cpp )
message( STATUS "removing OSG dependencies from the library")
list(REMOVE_ITEM SFCGAL_HEADERS ${SFCGAL_OSG_HEADERS})
list(REMOVE_ITEM SFCGAL_SOURCES ${SFCGAL_OSG_SOURCES})

if( SFCGAL_USE_STATIC_LIBS )
add_definitions( "-fPIC" )
Expand Down Expand Up @@ -46,9 +50,6 @@ if( ${SFCGAL_WITH_GMP} )
target_link_libraries( SFCGAL ${GMP_LIBRARIES} )
endif( ${SFCGAL_WITH_GMP} )

if( ${SFCGAL_WITH_OSG} )
target_link_libraries( SFCGAL ${OPENSCENEGRAPH_LIBRARIES} )
endif()
target_link_libraries( SFCGAL ${Boost_LIBRARIES} )

if ( ${Use_precompiled_headers} )
Expand Down Expand Up @@ -76,3 +77,36 @@ install(
BUNDLE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

# SFCGAL-osg
if ( SFCGAL_WITH_OSG )
if( SFCGAL_USE_STATIC_LIBS )
add_definitions( "-fPIC" )
add_library(
SFCGAL-osg
${SFCGAL_OSG_HEADERS}
${SFCGAL_OSG_SOURCES}
)

else()
add_definitions( "-DSFCGAL_BUILD_SHARED" )
add_library(
SFCGAL-osg SHARED
${SFCGAL_OSG_HEADERS}
${SFCGAL_OSG_SOURCES}
)
endif()
target_link_libraries( SFCGAL-osg
SFCGAL
${OPENSCENEGRAPH_LIBRARIES}
)
set_target_properties( SFCGAL-osg PROPERTIES VERSION ${SFCGAL_VERSION}
SOVERSION ${SFCGAL_VERSION_MAJOR} )
install(
TARGETS
SFCGAL-osg
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()

0 comments on commit ae4fbc6

Please sign in to comment.