Changeset 11033

Show
Ignore:
Timestamp:
01/31/10 19:23:35 (4 years ago)
Author:
robert
Message:

From Jan Peciva, improvements to Inventor find operation

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/CMakeModules/FindInventor.cmake

    r7830 r11033  
    1 # - Locate Inventor 
     1# 
     2# Find Open Inventor 
     3# 
    24# This module defines: 
    35#  INVENTOR_FOUND, if false, do not try to link against Inventor. 
     
    57#  INVENTOR_LIBRARY, the library to link against. 
    68#  INVENTOR_LIBRARY_DEBUG, the debug library to link against. 
    7  
     9#  INVENTOR_SOWIN_LIBRARY, the SoWin library - window binding library for Inventor 
     10#  INVENTOR_SOWIN_LIBRARY, the SoWin debug library 
     11#  INVENTOR_SOXT_LIBRARY, the SoXt library - window binding library for Inventor 
     12#  INVENTOR_SOXT_LIBRARY, the SoXt debug library 
     13# 
     14 
     15 
     16# 
     17#  Inventor 
     18# 
     19#  notes: 
     20#  - Coin is honored over SGI Inventor 
     21#  - Coin is detected by coin-config script, COINDIR environment variable, 
     22#    and finally standard system locations are searched 
     23#  - SGI Inventor is searched at standard system locations only 
     24# 
     25 
     26# coin-config tells much of Coin instalation (if present) 
     27execute_process (COMMAND coin-config --prefix 
     28                 OUTPUT_VARIABLE COIN_PREFIX 
     29                 OUTPUT_STRIP_TRAILING_WHITESPACE) 
     30 
     31# try to find Inventor includes (priority paths) 
     32FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h 
     33    ${COIN_PREFIX}/include 
     34    $ENV{COINDIR}/include 
     35    NO_DEFAULT_PATH 
     36) 
     37 
     38# try to find Inventor includes (regular paths) 
    839FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h 
    940    /usr/local/include 
     
    1344    /opt/csw/include 
    1445    /opt/include 
    15     $ENV{COINDIR}/include 
    16 ) 
    17  
    18 FIND_LIBRARY(INVENTOR_LIBRARY 
    19     NAMES coin2 Coin 
    20     PATHS 
     46) 
     47 
     48# default Inventor lib search paths 
     49SET(INVENTOR_LIB_SEARCH_PATH 
    2150    /usr/local/lib 
    2251    /usr/lib 
     
    2554    /opt/csw/lib 
    2655    /opt/lib 
    27     $ENV{COINDIR}/lib 
    28 ) 
    29 IF(NOT INVENTOR_LIBRARY) 
    30     # If we can't find libCoin try libInventor 
    31     FIND_LIBRARY(INVENTOR_LIBRARY 
    32         NAMES Inventor 
    33         PATHS 
    34         /usr/local/lib 
    35         /usr/lib 
    36         /sw/lib 
    37         /opt/local/lib 
    38         /opt/csw/lib 
    39         /opt/lib 
    40     ) 
    41 ENDIF(NOT INVENTOR_LIBRARY) 
    42  
     56) 
     57 
     58# try to find Coin release lib (priority paths) 
     59FIND_LIBRARY(INVENTOR_LIBRARY_RELEASE 
     60    NAMES coin5 coin4 coin3 coin2 coin1 Coin 
     61    PATHS ${COIN_PREFIX}/lib 
     62          $ENV{COINDIR}/lib 
     63    NO_DEFAULT_PATH 
     64) 
     65 
     66# try to find Coin release lib (regular paths) 
     67FIND_LIBRARY(INVENTOR_LIBRARY_RELEASE 
     68    NAMES coin5 coin4 coin3 coin2 coin1 Coin 
     69    PATHS ${INVENTOR_LIB_SEARCH_PATH} 
     70) 
     71 
     72# try to find SGI Inventor lib 
     73FIND_LIBRARY(INVENTOR_LIBRARY_RELEASE 
     74    NAMES Inventor 
     75    PATHS ${INVENTOR_LIB_SEARCH_PATH} 
     76) 
     77 
     78# try to find Coin debug lib (priority paths) 
    4379FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG 
    44     NAMES coin2d 
    45     PATHS 
    46     /usr/local/lib 
    47     /usr/lib 
    48     /sw/lib 
    49     /opt/local/lib 
    50     /opt/csw/lib 
    51     /opt/lib 
    52     $ENV{COINDIR}/lib 
    53 ) 
    54 IF(NOT INVENTOR_LIBRARY_DEBUG) 
    55     IF(INVENTOR_LIBRARY) 
    56         SET(INVENTOR_LIBRARY_DEBUG ${INVENTOR_LIBRARY}) 
    57     ENDIF(INVENTOR_LIBRARY) 
    58 ENDIF(NOT INVENTOR_LIBRARY_DEBUG) 
    59  
     80    NAMES coin5d coin4d coin3d coin2d coin1d 
     81    PATHS ${COIN_PREFIX}/lib 
     82          $ENV{COINDIR}/lib 
     83    NO_DEFAULT_PATH 
     84) 
     85 
     86# try to find Coin debug lib (regular paths) 
     87FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG 
     88    NAMES coin5d coin4d coin3d coin2d coin1d 
     89    PATHS ${INVENTOR_LIB_SEARCH_PATH} 
     90) 
     91 
     92# set release to debug if only debug found 
     93IF(NOT INVENTOR_LIBRARY_RELEASE AND INVENTOR_LIBRARY_DEBUG) 
     94  SET(INVENTOR_LIBRARY_RELEASE ${INVENTOR_LIBRARY_DEBUG}) 
     95ENDIF(NOT INVENTOR_LIBRARY_RELEASE AND INVENTOR_LIBRARY_DEBUG) 
     96 
     97# set debug to release (if only release found) 
     98IF(NOT INVENTOR_LIBRARY_DEBUG AND INVENTOR_LIBRARY_RELEASE) 
     99  SET(INVENTOR_LIBRARY_DEBUG ${INVENTOR_LIBRARY_RELEASE}) 
     100ENDIF(NOT INVENTOR_LIBRARY_DEBUG AND INVENTOR_LIBRARY_RELEASE) 
     101 
     102# INVENTOR_LIBRARY 
     103IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) 
     104  SET(INVENTOR_LIBRARY 
     105      optimized ${INVENTOR_LIBRARY_RELEASE} 
     106      debug ${INVENTOR_LIBRARY_DEBUG}) 
     107ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) 
     108  SET(INVENTOR_LIBRARY 
     109      ${INVENTOR_LIBRARY_RELEASE}) 
     110ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) 
     111 
     112# set INVENTOR_FOUND appropriately 
    60113SET(INVENTOR_FOUND "NO") 
    61114IF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY) 
    62115    SET(INVENTOR_FOUND "YES") 
    63116ENDIF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY) 
     117 
     118 
     119# 
     120#  SoWin 
     121# 
     122# notes: SoWin is searched by COINDIR environment variable 
     123#        (as expected to be located at Windows platform) 
     124 
     125# try to find SoWin lib (priority paths) 
     126FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY 
     127    NAMES sowin1 
     128    PATHS $ENV{COINDIR}/lib 
     129    NO_DEFAULT_PATH 
     130) 
     131 
     132# try to find SoWin lib (regular paths) 
     133FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY 
     134    NAMES sowin1 
     135    PATHS ${INVENTOR_LIB_SEARCH_PATH} 
     136) 
     137 
     138# try to find SoWin debug lib (priority paths) 
     139FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY_DEBUG 
     140    NAMES sowin1d 
     141    PATHS $ENV{COINDIR}/lib 
     142    NO_DEFAULT_PATH 
     143) 
     144 
     145# try to find SoWin debug lib (regular paths) 
     146FIND_LIBRARY(INVENTOR_SOWIN_LIBRARY_DEBUG 
     147    NAMES sowin1d 
     148    PATHS ${INVENTOR_LIB_SEARCH_PATH} 
     149) 
     150 
     151# SoWin debug library defaults to non-debug lib 
     152IF(NOT INVENTOR_SOWIN_LIBRARY_DEBUG) 
     153    IF(INVENTOR_SOWIN_LIBRARY) 
     154        SET(INVENTOR_SOWIN_LIBRARY_DEBUG INVENTOR_SOWIN_LIBRARY) 
     155    ENDIF(INVENTOR_SOWIN_LIBRARY) 
     156ENDIF(NOT INVENTOR_SOWIN_LIBRARY_DEBUG) 
     157 
     158 
     159# 
     160#  SoXt 
     161# 
     162#  notes: 
     163#  - SoXt is detected by soxt-config script (as expected by 
     164#    Coin's SoXt on Linux/Unix) and on standard system locations 
     165#  - SGI's InventorXt support is missing now 
     166# 
     167 
     168# soxt-config tells much of SoXt instalation (if present) 
     169execute_process (COMMAND soxt-config --prefix 
     170                 OUTPUT_VARIABLE SOXT_PREFIX 
     171                 OUTPUT_STRIP_TRAILING_WHITESPACE) 
     172 
     173# try to find SoXt lib (priority paths) 
     174FIND_LIBRARY(INVENTOR_SOXT_LIBRARY 
     175    NAMES soxt1 SoXt 
     176    PATHS ${SOXT_PREFIX}/lib 
     177          $ENV{COINDIR}/lib 
     178    NO_DEFAULT_PATH 
     179) 
     180 
     181# try to find SoXt lib (regular paths) 
     182FIND_LIBRARY(INVENTOR_SOXT_LIBRARY 
     183    NAMES soxt1 SoXt 
     184    PATHS ${INVENTOR_LIB_SEARCH_PATH} 
     185) 
     186 
     187# try to find SoXt debug lib (priority paths) 
     188FIND_LIBRARY(INVENTOR_SOXT_LIBRARY_DEBUG 
     189    NAMES soxt1d 
     190    PATHS ${SOXT_PREFIX}/lib 
     191          $ENV{COINDIR}/lib 
     192    NO_DEFAULT_PATH 
     193) 
     194 
     195# try to find SoXt debug lib (regular paths) 
     196FIND_LIBRARY(INVENTOR_SOXT_LIBRARY_DEBUG 
     197    NAMES soxt1d 
     198    PATHS ${INVENTOR_LIB_SEARCH_PATH} 
     199) 
     200 
     201# SoXt debug library defaults to non-debug lib 
     202IF(NOT INVENTOR_SOXT_LIBRARY_DEBUG) 
     203    IF(INVENTOR_SOXT_LIBRARY) 
     204        SET(INVENTOR_SOXT_LIBRARY_DEBUG INVENTOR_SOXT_LIBRARY) 
     205    ENDIF(INVENTOR_SOXT_LIBRARY) 
     206ENDIF(NOT INVENTOR_SOXT_LIBRARY_DEBUG)