root/OpenSceneGraph/trunk/CMakeModules/FindCOLLADA.cmake @ 10336

Revision 10336, 6.6 kB (checked in by robert, 5 years ago)

From Roger James and Robert Osfield, clean up of COLLADA CMake support

  • Property svn:eol-style set to native
RevLine 
[9307]1# Locate Collada
2# This module defines:
[6606]3# COLLADA_INCLUDE_DIR, where to find the headers
4#
[9307]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#
[6606]11# $COLLADA_DIR is an environment variable that would
12# correspond to the ./configure --prefix=$COLLADA_DIR
13#
14# Created by Robert Osfield.
15
[9741]16SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory")
17
[9952]18IF(APPLE)
19    SET(COLLADA_BUILDNAME "mac")
20ELSEIF(MINGW)
21    SET(COLLADA_BUILDNAME "mingw")
22ELSEIF(MSVC90)
23    SET(COLLADA_BUILDNAME "vc9")
24ELSE(APPLE)
25    SET(COLLADA_BUILDNAME "vc8")
26ENDIF(APPLE)
27
28
[6606]29FIND_PATH(COLLADA_INCLUDE_DIR dae.h
[9741]30    ${COLLADA_DOM_ROOT}/include
[6606]31    $ENV{COLLADA_DIR}/include
32    $ENV{COLLADA_DIR}
33    ~/Library/Frameworks
34    /Library/Frameworks
35    /usr/local/include
[8282]36    /usr/local/include/colladadom
37    /usr/include/
38    /usr/include/colladadom
[6606]39    /sw/include # Fink
40    /opt/local/include # DarwinPorts
41    /opt/csw/include # Blastwave
42    /opt/include
43    /usr/freeware/include
44)
45
[9307]46FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
[9260]47    NAMES collada_dom collada14dom libcollada14dom21
[6606]48    PATHS
[9952]49    ${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
50    $ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4
[6606]51    $ENV{COLLADA_DIR}/lib
52    $ENV{COLLADA_DIR}/lib-dbg
53    $ENV{COLLADA_DIR}
54    ~/Library/Frameworks
55    /Library/Frameworks
56    /usr/local/lib
[8282]57    /usr/local/lib64
[6606]58    /usr/lib
[8282]59    /usr/lib64
[6606]60    /sw/lib
61    /opt/local/lib
62    /opt/csw/lib
63    /opt/lib
64    /usr/freeware/lib64
65)
66
[9307]67FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
[9260]68    NAMES collada_dom-d collada14dom-d libcollada14dom21-d
69    PATHS
[9952]70    ${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
71    $ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d
[9260]72    $ENV{COLLADA_DIR}/lib
73    $ENV{COLLADA_DIR}/lib-dbg
74    $ENV{COLLADA_DIR}
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    /usr/freeware/lib64
86)
87
[9741]88FIND_LIBRARY(COLLADA_STATIC_LIBRARY
89    NAMES libcollada14dom21-s
[9307]90    PATHS
[9952]91    ${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
92    $ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4
[9307]93    $ENV{COLLADA_DIR}/lib
94    $ENV{COLLADA_DIR}/lib-dbg
95    $ENV{COLLADA_DIR}
96    ~/Library/Frameworks
97    /Library/Frameworks
98    /usr/local/lib
99    /usr/local/lib64
100    /usr/lib
101    /usr/lib64
102    /sw/lib
103    /opt/local/lib
104    /opt/csw/lib
105    /opt/lib
106    /usr/freeware/lib64
107)
[6606]108
[9307]109FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
110    NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd
111    PATHS
[9952]112    ${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
113    $ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d
[9307]114    $ENV{COLLADA_DIR}/lib
115    $ENV{COLLADA_DIR}/lib-dbg
116    $ENV{COLLADA_DIR}
117    ~/Library/Frameworks
118    /Library/Frameworks
119    /usr/local/lib
120    /usr/local/lib64
121    /usr/lib
122    /usr/lib64
123    /sw/lib
124    /opt/local/lib
125    /opt/csw/lib
126    /opt/lib
127    /usr/freeware/lib64
128)
[6606]129
[9741]130    # find extra libraries that the static linking requires
131
132    FIND_PACKAGE(LibXml2)
133    IF (LIBXML2_FOUND)
134        SET(COLLADA_LIBXML_LIBRARY ${LIBXML2_LIBRARIES})
135    ELSE(LIBXML2_FOUND)
[9751]136        IF(WIN32)
137            FIND_LIBRARY(COLLADA_LIBXML_LIBRARY
138                NAMES libxml2
139                PATHS
140                ${COLLADA_DOM_ROOT}/external-libs/libxml2/win32/lib
141                ${COLLADA_DOM_ROOT}/external-libs/libxml2/mingw/lib
142            )
143        ENDIF(WIN32)
[9741]144    ENDIF(LIBXML2_FOUND)
145   
146    FIND_PACKAGE(ZLIB)
147    IF (ZLIB_FOUND)
148        SET(COLLADA_ZLIB_LIBRARY ${ZLIB_LIBRARY})
149    ELSE(ZLIB_FOUND)
[9751]150        IF(WIN32)
151            FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
152                NAMES zlib
153                PATHS
154                ${COLLADA_DOM_ROOT}/external-libs/libxml2/win32/lib
155                ${COLLADA_DOM_ROOT}/external-libs/libxml2/mingw/lib
156            )
157        ENDIF(WIN32)
158    ENDIF(ZLIB_FOUND)
159
[10336]160    FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY
161        NAMES pcrecpp
162        PATHS
163        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
164        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
165        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
166    )
[9751]167
[10336]168    FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY_DEBUG
169        NAMES pcrecpp-d
170        PATHS
171        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
172        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
173        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
174    )
[9741]175
[10336]176    FIND_LIBRARY(COLLADA_PCRE_LIBRARY
177        NAMES pcre
178        PATHS
179        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
180        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
181        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
182    )
[9741]183
[10336]184    FIND_LIBRARY(COLLADA_PCRE_LIBRARY_DEBUG
185        NAMES pcre-d
186        PATHS
187        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/${COLLADA_BUILDNAME}
188        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
189        ${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
190    )
[9741]191
[10336]192    FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY
193        NAMES minizip
194        PATHS
195        ${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
196        ${COLLADA_DOM_ROOT}/external-libs/minizip/mac
197    )
[9741]198
[10336]199    FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY_DEBUG
200        NAMES minizip-d
201        PATHS
202        ${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
203        ${COLLADA_DOM_ROOT}/external-libs/minizip/mac
204    )
[9741]205
[10336]206    FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
207        NAMES libboost_filesystem boost_filesystem
208        PATHS
209        ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
210        ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
211    )
[9741]212
[10336]213    FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
214        NAMES libboost_filesystem-d boost_filesystem-d
215        PATHS
216        ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
217        ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
218    )
[9741]219
[10336]220    FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
221        NAMES libboost_system boost_system
222        PATHS
223        ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
224        ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
225    )
[9741]226
[10336]227    FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
228        NAMES libboost_system-d boost_system-d
229        PATHS
230        ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
231        ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
232    )
[9741]233
234
[9307]235SET(COLLADA_FOUND "NO")
236IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
237    IF   (COLLADA_INCLUDE_DIR)
238        SET(COLLADA_FOUND "YES")
239    ENDIF(COLLADA_INCLUDE_DIR)
240ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
Note: See TracBrowser for help on using the browser.