add_oiv_runtest_parameter("--noMainLoop") 


if (APPLE)
  include_directories(/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/Headers/)
  include_directories(/System/Library/Frameworks/Cocoa.framework/Versions/A/Headers/)
  include_directories(/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/)
  
  find_library(COCOA_LIBRARY Cocoa)
  find_library(CORESERVICES_LIBRARY CoreServices)
  find_library(IOKIT_LIBRARY IOKit) 
  find_library(OPENGL_LIBRARY OpenGL) 
 
  if(EXISTS /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk)
    set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk")
  elseif(EXISTS /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk)
    set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk")
  endif()
  include_directories(${CMAKE_OSX_SYSROOT}/usr/lib/gcc/i686-apple-darwin11/4.2.1/include/)
  set(CMAKE_OSX_ARCHITECTURES "x86_64")


  set(DEMO_LIBS ${COCOA_LIBRARY} ${OPENGL_LIBRARY} ${CORESERVICES_LIBRARY} ${IOKIT_LIBRARY})
endif()

if(APPLE)
 set(SRC OGLWindow_mac.mm)
elseif(WIN32)
  set(SRC OGLWindow_win.cxx)
else()
  set(SRC OGLWindow_x11.cxx)
  set(_X11_LIB ${X11_X11_LIB})
endif()


add_oiv_executable(gl_volumeRender
 gl_volumeRender.cxx
 ${SRC}
)

target_link_libraries(gl_volumeRender 
${LDM_LIBRARIES}
${OpenInventor_LIBRARIES} 
${VolumeViz_LIBRARIES} 
${OPENGL_LIBRARIES}
${DEMO_LIBS} 
${_X11_LIB}
)

if(APPLE)
  target_link_libraries(gl_volumeRender ${OpenInventorGLEW_LIBRARIES})
endif()

