root/OpenSceneGraph/trunk/CMakeModules/FindFBX.cmake @ 13466

Revision 13466, 3.0 kB (checked in by robert, 5 days ago)

Fixed comment

  • Property svn:eol-style set to native
Line 
1# Locate FBX
2# This module defines:
3# FBX_INCLUDE_DIR, where to find the headers
4#
5# FBX_LIBRARY, FBX_LIBRARY_DEBUG
6# FBX_FOUND
7#
8# $FBX_DIR is an environment variable that would
9# correspond to the ./configure --prefix=$FBX_DIR
10
11IF(APPLE)
12    SET(FBX_LIBDIR "gcc4/ub")
13ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
14    SET(FBX_LIBDIR "gcc4")
15ELSEIF(MSVC80)
16    SET(FBX_LIBDIR "vs2005")
17ELSEIF(MSVC90)
18    SET(FBX_LIBDIR "vs2008")
19ELSEIF(MSVC10)
20    SET(FBX_LIBDIR "vs2010")
21ELSEIF(MSVC11 OR MSVC_VERSION>1700)
22    SET(FBX_LIBDIR "vs2012")
23ENDIF()
24
25IF(APPLE)
26    # do nothing
27ELSEIF(CMAKE_CL_64)
28    SET(FBX_LIBDIR ${FBX_LIBDIR}/x64)
29ELSEIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
30    SET(FBX_LIBDIR ${FBX_LIBDIR}/x64)
31ELSE()
32    SET(FBX_LIBDIR ${FBX_LIBDIR}/x86)
33ENDIF()
34
35IF(APPLE)
36    SET(FBX_LIBNAME "libfbxsdk")
37ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
38    SET(FBX_LIBNAME "libfbxsdk")
39ELSE()
40    SET(FBX_LIBNAME "libfbxsdk-md")
41ENDIF()
42
43SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
44
45SET( FBX_SEARCH_PATHS
46    $ENV{FBX_DIR}
47    "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1"
48    "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1"
49    /Applications/Autodesk/FBXSDK20141
50)
51
52# search for headers & debug/release libraries
53FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
54    PATHS ${FBX_SEARCH_PATHS}
55    PATH_SUFFIXES "include")
56FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
57    PATHS ${FBX_SEARCH_PATHS}
58    PATH_SUFFIXES "lib/${FBX_LIBDIR}/release" "lib/${FBX_LIBDIR}")
59
60#Once one of the calls succeeds the result variable will be set and stored in the cache so that no call will search again.   
61
62#no debug d suffix, search in debug folder only
63FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME}
64    PATHS ${FBX_SEARCH_PATHS}
65    PATH_SUFFIXES "lib/${FBX_LIBDIR}/debug")
66FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
67    PATHS ${FBX_SEARCH_PATHS}
68    PATH_SUFFIXES "lib/${FBX_LIBDIR}")
69   
70IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
71    SET(FBX_FOUND "YES")
72ELSE()
73    SET(FBX_FOUND "NO")
74ENDIF()
75
76IF(NOT FBX_FOUND)
77#try to use 2013.3 version
78    IF(APPLE)
79        SET(FBX_LIBNAME "fbxsdk-2013.3-static")
80    ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
81        SET(FBX_LIBNAME "fbxsdk-2013.3-static")
82    ELSE()
83        SET(FBX_LIBNAME "fbxsdk-2013.3-md")
84    ENDIF()
85
86    SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
87
88    SET( FBX_SEARCH_PATHS
89        $ENV{FBX_DIR}
90        $ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2013.3
91        $ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2013.3
92        /Applications/Autodesk/FBXSDK20141
93    )
94
95    # search for headers & debug/release libraries
96    FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
97        PATHS ${FBX_SEARCH_PATHS}
98        PATH_SUFFIXES "include")
99    FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
100        PATHS ${FBX_SEARCH_PATHS}
101        PATH_SUFFIXES "lib/${FBX_LIBDIR}")
102
103    FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
104        PATHS ${FBX_SEARCH_PATHS}
105        PATH_SUFFIXES "lib/${FBX_LIBDIR}")
106    IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
107        SET(FBX_FOUND "YES")
108    ELSE()
109        SET(FBX_FOUND "NO")
110    ENDIF()
111   
112ENDIF()
Note: See TracBrowser for help on using the browser.