project(medicalGL_volumeRender)

find_library(OPENGL_LIBRARY OpenGL)
find_package(OpenGL REQUIRED)

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)
 
  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()
  set(CMAKE_OSX_ARCHITECTURES "x86_64")
  set(DEMO_LIBS ${OpenInventorGLEW_LIBRARIES} ${COCOA_LIBRARY} ${CORESERVICES_LIBRARY} ${IOKIT_LIBRARY})
  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_runtest_parameter("--noMainLoop")
add_oiv_executable (${PROJECT_NAME} gl_volumeRender.cxx ${SRC} ) 

target_link_libraries( ${PROJECT_NAME} 
  ${OpenInventorMedical_LIBRARIES}
  ${LDM_LIBRARIES}
  ${OpenInventor_LIBRARIES}
  ${VolumeViz_LIBRARIES}
  ${DialogVizGui_LIBRARIES}
  ${OPENGL_LIBRARIES}
  ${DEMO_LIBS}
  ${_X11_LIB}
  )

