PROJECT(osgCal)

# Dynamic vs Static Linking
OPTION(DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking.  Use OFF for static." ON)
IF   (DYNAMIC_OPENSCENEGRAPH)
    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
ELSE (DYNAMIC_OPENSCENEGRAPH)
    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
ENDIF(DYNAMIC_OPENSCENEGRAPH)


SET( OSGCAL_INCLUDE_DIR ${osgCal_SOURCE_DIR}/include )
SET( OSGCAL_SOURCE_DIR  ${osgCal_SOURCE_DIR}/src )
SET( OSGCAL_BINARY_DIR  ${osgCal_BINARY_DIR})

SET( CMAKE_MODULE_PATH "${osgCal_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")

# Installation stuff

SET(CMAKE_DEBUG_POSTFIX  "d")

IF(UNIX AND NOT WIN32 AND NOT APPLE)
  IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
      SET(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement")
      MARK_AS_ADVANCED(LIB_POSTFIX)
  ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8")
ENDIF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(NOT DEFINED LIB_POSTFIX)
    SET(LIB_POSTFIX "")
ENDIF(NOT DEFINED LIB_POSTFIX)

INCLUDE(osgcalUtils)

# packages

FIND_PACKAGE(OSG)
FIND_PACKAGE(CAL3D)
FIND_PACKAGE(OpenThreads)
FIND_PACKAGE(OpenGL)

IF (NOT OSG_FOUND)
  MESSAGE(FATAL_ERROR "Unable to locate OpenSceneGraph libary")
ENDIF (NOT OSG_FOUND)

IF (NOT OPEN_THREADS_FOUND)
  MESSAGE(FATAL_ERROR "Unable to locate OpenThreads libary")
ENDIF (NOT OPEN_THREADS_FOUND)

IF (NOT CAL3D_FOUND)
  MESSAGE(FATAL_ERROR "Unable to locate Cal3D libary")
ENDIF (NOT CAL3D_FOUND)

SET(WRAPPER_PREFIX  osgwrapper_)

# sources

ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(applications)

