root/OpenSceneGraph/branches/OpenSceneGraph-2.8/CMakeModules/FindCOLLADA.cmake @ 9760

Revision 9760, 8.1 kB (checked in by robert, 5 years ago)

From Roland Smeenk, "Attached are two small fixes:
-I changed the SET of COLLADA_BOOST_INCLUDE_DIR to use findpath, so users may override this setting if they choose not to build against to precompiled boost libraries delivered with the Collada DOM.

-Changed daeRMaterials.cpp to prevent a compiler warning about a potentially uninitialized variable."

  • Property svn:eol-style set to native
Line 
1# Locate Collada
2# This module defines:
3# COLLADA_INCLUDE_DIR, where to find the headers
4#
5# COLLADA_LIBRARY, COLLADA_LIBRARY_DEBUG
6# COLLADA_FOUND, if false, do not try to link to Collada dynamically
7#
8# COLLADA_LIBRARY_STATIC, COLLADA_LIBRARY_STATIC_DEBUG
9# COLLADA_STATIC_FOUND, if false, do not try to link to Collada statically
10#
11# $COLLADA_DIR is an environment variable that would
12# correspond to the ./configure --prefix=$COLLADA_DIR
13#
14# Created by Robert Osfield.
15
16SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory")
17
18FIND_PATH(COLLADA_INCLUDE_DIR dae.h
19    ${COLLADA_DOM_ROOT}/include
20    $ENV{COLLADA_DIR}/include
21    $ENV{COLLADA_DIR}
22    $ENV{OSGDIR}/include
23    $ENV{OSGDIR}
24    $ENV{OSG_ROOT}/include
25    ~/Library/Frameworks
26    /Library/Frameworks
27    /usr/local/include
28    /usr/local/include/colladadom
29    /usr/include/
30    /usr/include/colladadom
31    /sw/include # Fink
32    /opt/local/include # DarwinPorts
33    /opt/csw/include # Blastwave
34    /opt/include
35    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
36    /usr/freeware/include
37)
38
39FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
40    NAMES collada_dom collada14dom libcollada14dom21
41    PATHS
42    ${COLLADA_DOM_ROOT}/build/vc8-1.4
43    $ENV{COLLADA_DIR}/build/vc8-1.4
44    $ENV{COLLADA_DIR}/lib
45    $ENV{COLLADA_DIR}/lib-dbg
46    $ENV{COLLADA_DIR}
47    $ENV{OSGDIR}/lib
48    $ENV{OSGDIR}
49    $ENV{OSG_ROOT}/lib
50    ~/Library/Frameworks
51    /Library/Frameworks
52    /usr/local/lib
53    /usr/local/lib64
54    /usr/lib
55    /usr/lib64
56    /sw/lib
57    /opt/local/lib
58    /opt/csw/lib
59    /opt/lib
60    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
61    /usr/freeware/lib64
62)
63
64FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
65    NAMES collada_dom-d collada14dom-d libcollada14dom21-d
66    PATHS
67    ${COLLADA_DOM_ROOT}/build/vc8-1.4-d
68    $ENV{COLLADA_DIR}/build/vc8-1.4-d
69    $ENV{COLLADA_DIR}/lib
70    $ENV{COLLADA_DIR}/lib-dbg
71    $ENV{COLLADA_DIR}
72    $ENV{OSGDIR}/lib
73    $ENV{OSGDIR}
74    $ENV{OSG_ROOT}/lib
75    ~/Library/Frameworks
76    /Library/Frameworks
77    /usr/local/lib
78    /usr/local/lib64
79    /usr/lib
80    /usr/lib64
81    /sw/lib
82    /opt/local/lib
83    /opt/csw/lib
84    /opt/lib
85    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
86    /usr/freeware/lib64
87)
88
89FIND_LIBRARY(COLLADA_STATIC_LIBRARY
90    NAMES libcollada14dom21-s
91    PATHS
92    ${COLLADA_DOM_ROOT}/build/vc8-1.4
93    $ENV{COLLADA_DIR}/build/vc8-1.4
94    $ENV{COLLADA_DIR}/lib
95    $ENV{COLLADA_DIR}/lib-dbg
96    $ENV{COLLADA_DIR}
97    $ENV{OSGDIR}/lib
98    $ENV{OSGDIR}
99    $ENV{OSG_ROOT}/lib
100    ~/Library/Frameworks
101    /Library/Frameworks
102    /usr/local/lib
103    /usr/local/lib64
104    /usr/lib
105    /usr/lib64
106    /sw/lib
107    /opt/local/lib
108    /opt/csw/lib
109    /opt/lib
110    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
111    /usr/freeware/lib64
112)
113
114FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
115    NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd
116    PATHS
117    ${COLLADA_DOM_ROOT}/build/vc8-1.4-d
118    $ENV{COLLADA_DIR}/build/vc8-1.4-d
119    $ENV{COLLADA_DIR}/lib
120    $ENV{COLLADA_DIR}/lib-dbg
121    $ENV{COLLADA_DIR}
122    $ENV{OSGDIR}/lib
123    $ENV{OSGDIR}
124    $ENV{OSG_ROOT}/lib
125    ~/Library/Frameworks
126    /Library/Frameworks
127    /usr/local/lib
128    /usr/local/lib64
129    /usr/lib
130    /usr/lib64
131    /sw/lib
132    /opt/local/lib
133    /opt/csw/lib
134    /opt/lib
135    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
136    /usr/freeware/lib64
137)
138
139IF(COLLADA_STATIC_LIBRARY)
140
141    # find extra libraries that the static linking requires
142
143    FIND_PACKAGE(LibXml2)
144    IF (LIBXML2_FOUND)
145        SET(COLLADA_LIBXML_LIBRARY ${LIBXML2_LIBRARIES})
146    ELSE(LIBXML2_FOUND)
147        IF(WIN32)
148            FIND_LIBRARY(COLLADA_LIBXML_LIBRARY
149                NAMES libxml2
150                PATHS
151                ${COLLADA_DOM_ROOT}/external-libs/libxml2/win32/lib
152                ${COLLADA_DOM_ROOT}/external-libs/libxml2/mingw/lib
153            )
154        ENDIF(WIN32)
155    ENDIF(LIBXML2_FOUND)
156   
157    FIND_PACKAGE(ZLIB)
158    IF (ZLIB_FOUND)
159        SET(COLLADA_ZLIB_LIBRARY ${ZLIB_LIBRARY})
160    ELSE(ZLIB_FOUND)
161        IF(WIN32)
162            FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
163                NAMES zlib
164                PATHS
165                ${COLLADA_DOM_ROOT}/external-libs/libxml2/win32/lib
166                ${COLLADA_DOM_ROOT}/external-libs/libxml2/mingw/lib
167            )
168        ENDIF(WIN32)
169    ENDIF(ZLIB_FOUND)
170
171    IF(WIN32)
172
173        FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY
174            NAMES pcrecpp
175            PATHS
176            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8   
177            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
178            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
179            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw   
180        )
181
182        FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY_DEBUG
183            NAMES pcrecpp-d
184            PATHS
185            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8   
186            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
187            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
188            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw   
189        )
190
191        FIND_LIBRARY(COLLADA_PCRE_LIBRARY
192            NAMES pcre
193            PATHS
194            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8   
195            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
196            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
197            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw   
198        )
199
200        FIND_LIBRARY(COLLADA_PCRE_LIBRARY_DEBUG
201            NAMES pcre-d
202            PATHS
203            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8   
204            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
205            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
206            ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
207        )
208
209        FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY
210            NAMES minizip
211            PATHS
212            ${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
213            ${COLLADA_DOM_ROOT}/external-libs/minizip/mac
214        )
215
216        FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY_DEBUG
217            NAMES minizip-d
218            PATHS
219            ${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
220            ${COLLADA_DOM_ROOT}/external-libs/minizip/mac
221        )
222   
223    ENDIF(WIN32)
224
225ENDIF(COLLADA_STATIC_LIBRARY)
226
227IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
228
229    IF(WIN32)
230   
231        FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
232            NAMES libboost_filesystem
233            PATHS
234            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
235            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
236            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
237        )
238
239        FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
240            NAMES libboost_filesystem-d
241            PATHS
242            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
243            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
244            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
245        )
246
247        FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
248            NAMES libboost_system
249            PATHS
250            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
251            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
252            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
253        )
254
255        FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
256            NAMES libboost_system-d
257            PATHS
258            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
259            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
260            ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
261        )
262
263      FIND_PATH(COLLADA_BOOST_INCLUDE_DIR boost/filesystem/convenience.hpp
264        ${COLLADA_DOM_ROOT}/external-libs/boost
265      )
266
267    ENDIF(WIN32)
268
269ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
270
271SET(COLLADA_FOUND "NO")
272IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
273    IF   (COLLADA_INCLUDE_DIR)
274        SET(COLLADA_FOUND "YES")
275    ENDIF(COLLADA_INCLUDE_DIR)
276ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
Note: See TracBrowser for help on using the browser.