Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 14, 2008, 5:15:54 PM (16 years ago)
Author:
rgrieder
Message:

First attempt to find ODE on a tardis box.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/cmake/FindODE.cmake

    r1505 r1920  
    1 # find ODE (Open Dynamics Engine) includes and library
     1# Find ODE includes and library
    22#
    3 # ODE_INCLUDE_DIR - where the directory containing the ODE headers can be
    4 #                   found
    5 # ODE_LIBRARY     - full path to the ODE library
    6 # ODE_FOUND       - TRUE if ODE was found
     3# This module defines
     4#  ODE_INCLUDE_DIR
     5#  ODE_LIBRARIES, the libraries to link against to use ODE.
     6#  ODE_LIB_DIR, the location of the libraries
     7#  ODE_FOUND, If false, do not try to use ODE
     8#
     9# Copyright © 2007, Matt Williams (version for FindOGRE)
     10# Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture of the ETH Zurich
     11#
     12# Redistribution and use is allowed according to the terms of the BSD license.
     13#
     14# Several changes and additions by Fabian 'x3n' Landau
     15# Adaption from FindOGRE to FindODE by Reto '1337' Grieder
     16#                 > www.orxonox.net <
    717
    8 IF (NOT ODE_FOUND)
     18IF (ODE_LIBRARIES AND ODE_INCLUDE_DIR AND ODE_LIB_DIR)
     19    SET (ODE_FIND_QUIETLY TRUE) # Already in cache, be silent
     20ENDIF (ODE_LIBRARIES AND ODE_INCLUDE_DIR AND ODE_LIB_DIR)
    921
    10   FIND_PATH(ODE_INCLUDE_DIR ode/ode.h
    11     /usr/include
    12     /usr/local/include
    13     $ENV{OGRE_HOME}/include # OGRE SDK on WIN32
    14     $ENV{INCLUDE}
    15   )
    16   FIND_LIBRARY(ODE_LIBRARY
    17     NAMES ode
    18     PATHS
    19     /usr/lib
    20     /usr/local/lib
    21     $ENV{OGRE_HOME}/lib # OGRE SDK on WIN32
    22   )
     22IF (WIN32) #Windows
     23    FIND_PATH(ODE_INCLUDE_DIR ode/ode.h
     24        ../libs/ode-0.10.1/include
     25        ${DEPENDENCY_DIR}/ode-0.10.1/include
     26    )
    2327
    24   IF(ODE_INCLUDE_DIR)
    25     MESSAGE(STATUS "Found ODE include dir: ${ODE_INCLUDE_DIR}")
    26   ELSE(ODE_INCLUDE_DIR)
    27     MESSAGE(STATUS "Could NOT find ODE headers.")
    28   ENDIF(ODE_INCLUDE_DIR)
     28    SET(ODE_LIBRARIES debug ode_singled optimized ode_single)
     29    FIND_LIBRARY(ODE_LIBDIR NAMES ${ODE_LIBRARIES} PATHS
     30        ../libs/ode-0.10.1/lib
     31        ${DEPENDENCY_DIR}/ode-0.10.1/lib
     32    )
    2933
    30   IF(ODE_LIBRARY)
    31     MESSAGE(STATUS "Found ODE library: ${ODE_LIBRARY}")
    32   ELSE(ODE_LIBRARY)
    33     MESSAGE(STATUS "Could NOT find ODE library.")
    34   ENDIF(ODE_LIBRARY)
     34    # Strip the filename from the path
     35    IF (ODE_LIBDIR)
     36        GET_FILENAME_COMPONENT(ODE_LIBDIR ${ODE_LIBDIR} PATH)
     37        SET (ODE_LIB_DIR ${ODE_LIBDIR} CACHE FILEPATH "")
     38    ENDIF (ODE_LIBDIR)
     39ELSE (WIN32) #Unix
     40    FIND_PACKAGE(PkgConfig)
     41    PKG_SEARCH_MODULE(ODE ODE /usr/pack/ode-0.9-sd/i686-debian-linux3.1/lib/pkgconfig/ode.pc) # tardis specific hack
     42    SET(ODE_INCLUDE_DIR ${ODE_INCLUDE_DIRS})
     43    SET(ODE_LIB_DIR ${ODE_LIBDIR})
     44    SET(ODE_LIBRARIES ${ODE_LIBRARIES})
     45ENDIF (WIN32)
    3546
    36   IF(ODE_INCLUDE_DIR AND ODE_LIBRARY)
    37      SET(ODE_FOUND TRUE CACHE STRING "Whether ODE was found or not")
    38    ELSE(ODE_INCLUDE_DIR AND ODE_LIBRARY)
    39      SET(ODE_FOUND FALSE)
    40      IF(ODE_FIND_REQUIRED)
    41        MESSAGE(FATAL_ERROR "Could not find ODE. Please install ODE (http://www.ode.org)")
    42      ENDIF(ODE_FIND_REQUIRED)
    43    ENDIF(ODE_INCLUDE_DIR AND ODE_LIBRARY)
    44 ENDIF (NOT ODE_FOUND)
     47#Do some preparation
     48SEPARATE_ARGUMENTS(ODE_INCLUDE_DIR)
     49SEPARATE_ARGUMENTS(ODE_LIBRARIES)
    4550
    46 # vim: et sw=4 ts=4
     51SET (ODE_INCLUDE_DIR ${ODE_INCLUDE_DIR} CACHE PATH "")
     52SET (ODE_LIBRARIES ${ODE_LIBRARIES} CACHE STRING "")
     53SET (ODE_LIB_DIR ${ODE_LIB_DIR} CACHE PATH "")
     54
     55IF (ODE_INCLUDE_DIR AND ODE_LIBRARIES AND ODE_LIB_DIR)
     56    SET(ODE_FOUND TRUE)
     57ENDIF (ODE_INCLUDE_DIR AND ODE_LIBRARIES AND ODE_LIB_DIR)
     58
     59IF (ODE_FOUND)
     60    IF (NOT ODE_FIND_QUIETLY)
     61        MESSAGE(STATUS "ODE was found.")
     62        IF (VERBOSE_FIND)
     63            MESSAGE (STATUS "  include path: ${ODE_INCLUDE_DIR}")
     64            MESSAGE (STATUS "  library path: ${ODE_LIB_DIR}")
     65            MESSAGE (STATUS "  libraries:    ${ODE_LIBRARIES}")
     66        ENDIF (VERBOSE_FIND)
     67    ENDIF (NOT ODE_FIND_QUIETLY)
     68ELSE (ODE_FOUND)
     69    IF (NOT ODE_INCLUDE_DIR)
     70        MESSAGE(SEND_ERROR "ODE include path was not found.")
     71    ENDIF (NOT ODE_INCLUDE_DIR)
     72    IF (NOT ODE_LIB_DIR)
     73        MESSAGE(SEND_ERROR "ODE library was not found.")
     74    ENDIF (NOT ODE_LIB_DIR)
     75    IF (NOT ODE_LIBRARIES)
     76        MESSAGE(SEND_ERROR "ODE libraries not known.")
     77    ENDIF (NOT ODE_LIBRARIES)
     78ENDIF (ODE_FOUND)
Note: See TracChangeset for help on using the changeset viewer.