root/OpenSceneGraph/trunk/CMakeModules/FindInventor.cmake @ 11033

Revision 11033, 5.5 kB (checked in by robert, 5 years ago)

From Jan Peciva, improvements to Inventor find operation

  • Property svn:eol-style set to native
RevLine 
[11033]1#
2# Find Open Inventor
3#
[6381]4# This module defines:
5#  INVENTOR_FOUND, if false, do not try to link against Inventor.
[7349]6#  INVENTOR_INCLUDE_DIR, where to find headers.
[6381]7#  INVENTOR_LIBRARY, the library to link against.
[7349]8#  INVENTOR_LIBRARY_DEBUG, the debug library to link against.
[11033]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#
[6381]14
[11033]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)
[6381]32FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
[11033]33    ${COIN_PREFIX}/include
34    $ENV{COINDIR}/include
35    NO_DEFAULT_PATH
36)
37
38# try to find Inventor includes (regular paths)
39FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
[6561]40    /usr/local/include
41    /usr/include
42    /sw/include
43    /opt/local/include
44    /opt/csw/include
45    /opt/include
[6381]46)
47
[11033]48# default Inventor lib search paths
49SET(INVENTOR_LIB_SEARCH_PATH
[6381]50    /usr/local/lib
51    /usr/lib
52    /sw/lib
53    /opt/local/lib
54    /opt/csw/lib
55    /opt/lib
56)
57
[11033]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)
[7349]79FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG
[11033]80    NAMES coin5d coin4d coin3d coin2d coin1d
81    PATHS ${COIN_PREFIX}/lib
82          $ENV{COINDIR}/lib
83    NO_DEFAULT_PATH
[7349]84)
85
[11033]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
[6381]113SET(INVENTOR_FOUND "NO")
114IF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY)
[6561]115    SET(INVENTOR_FOUND "YES")
[6381]116ENDIF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY)
[11033]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)
Note: See TracBrowser for help on using the browser.