
include_directories( ${OpenLibraries_SOURCE_DIR}/src )
set( NAME openobjectlib_sg )

add_definitions( -DSG_EXPORTS )
if( WIN32 )
   add_definitions( -DOPENOBJECTLIB_LIBNAME=\\\"${NAME}\\\" )
   add_definitions( -DOPENOBJECTLIB_VERSION=\\\"${VERSION_STRING}\\\" )
   add_definitions( -DOPENOBJECTLIB_BUILD )
   set( NAME "${NAME}${LIBRARY_IDENTIFIER}" )
endif( WIN32 )

add_definitions( -DHAVE_OPENIMAGELIB )

set( SOURCES
     appearance.hpp               
     appearance.cpp               
     config.hpp                   
     constant_time_dispatcher.hpp 
     core.hpp                     
     hw_GL_renderer.hpp           
     hw_GL_renderer.cpp           
     lexical_cast.hpp             
     meshes.hpp                   
     meshes.cpp                   
     openobjectlib_plugin.hpp     
     openobjectlib_plugin.cpp     
     scene.hpp                    
     scene.cpp                    
     shaders.hpp                  
     shaders.cpp                  
     spatial.hpp                  
     spatial.cpp                  
     sg.hpp                       
     sg.cpp                       
     bbox_volume.hpp              
     bbox_volume.cpp              
     graph_updater.hpp            
     graph_updater.cpp            
     calculate_tangent_space.hpp  
     calculate_tangent_space.cpp  
     render_buffer.hpp            
     render_buffer.cpp            
     spirit.hpp )

install( 
     FILES
     appearance.hpp               
     config.hpp                   
     constant_time_dispatcher.hpp 
     core.hpp                     
     hw_GL_renderer.hpp           
     lexical_cast.hpp             
     meshes.hpp                   
     openobjectlib_plugin.hpp     
     scene.hpp                    
     sg.hpp                       
     shaders.hpp                  
     spatial.hpp                  
     bbox_volume.hpp              
     graph_updater.hpp            
     calculate_tangent_space.hpp  
     render_buffer.hpp
     DESTINATION "include/${PACKAGE}/openobjectlib/sg" )

add_library( ${NAME} SHARED ${SOURCES} )
install( TARGETS ${NAME} 
         RUNTIME DESTINATION "lib/${PACKAGE}/openobjectlib/lib"
         ARCHIVE DESTINATION "lib/${PACKAGE}/openobjectlib/lib" 
         LIBRARY DESTINATION "lib/${PACKAGE}/openobjectlib/lib" )

# required links 
link_directories( ${OpenLibraries_BINARY_DIR}/src/openpluginlib/pl 
                  ${OpenLibraries_BINARY_DIR}/src/openimagelib/il )
target_link_libraries( ${NAME} "openpluginlib_pl${LIBRARY_IDENTIFIER}" )
target_link_libraries( ${NAME} "openimagelib_il${LIBRARY_IDENTIFIER}" )
target_link_libraries( ${NAME} ${GLEW_LIBRARY} )
