FindASSIMP.cmake 2.74 KB
Newer Older
1 2 3 4 5 6
# - Try to find ASSIMP
# Once done this will define
#  
#  ASSIMP_FOUND        - system has ASSIMP
#  ASSIMP_INCLUDE_DIR  - the ASSIMP include directory
#  ASSIMP_LIBRARY      - Link these to use ASSIMP
7
#  ASSIMP_LIBRARY_DIR  - Directory where the library is found 
8 9 10 11 12 13 14 15 16
#   

IF (ASSIMP_INCLUDE_DIRS)
  # Already in cache, be silent
  SET(ASSIMP_FIND_QUIETLY TRUE)
ENDIF (ASSIMP_INCLUDE_DIRS)

 # Find the headers
 FIND_PATH( ASSIMP_INCLUDE_DIR assimp/scene.h
17 18
            PATHS /usr/include 
                  "C:/Program Files/Assimp/include" )
19 20

if( WIN32 )
21

Jan Möbius's avatar
Jan Möbius committed
22
 if ( CMAKE_GENERATOR MATCHES ".*Win64" )
23
   SET( DIRSUFFIX "x64" )
Jan Möbius's avatar
Jan Möbius committed
24 25
 else ()
   SET( DIRSUFFIX "x86" )
26 27
 endif()

28 29 30
 # Check if the base path is set
 if ( NOT CMAKE_WINDOWS_LIBS_DIR )
   # This is the base directory for windows library search used in the finders we shipp.
Jan Möbius's avatar
Jan Möbius committed
31
   set(CMAKE_WINDOWS_LIBS_DIR "c:/libs" CACHE STRING "Default Library search dir on windows." )
Jan Möbius's avatar
Jan Möbius committed
32
 endif()
33 34 35 36 37 38 39 40 41 42 43 44 45 46

 if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*Win64" )
   SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x64/")
 elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
   SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x32/")
 elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
   SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x64/")
 elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*" )
   SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x32/")
 elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*Win64" )
   SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x64/")
 elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*" )
   SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x32/")
 endif()
47

48 49 50 51 52 53 54
 # Find the headers
 FIND_PATH( ASSIMP_INCLUDE_DIR assimp/scene.h
            PATHS /usr/include 
                  "${VS_SEARCH_PATH}assimp/include"
                  "C:/Program Files/Assimp/include" )


55

56
 FIND_LIBRARY( ASSIMP_LIBRARY
Jan Möbius's avatar
Jan Möbius committed
57
               NAMES assimp
58
	       PATH_SUFFIXES ${DIRSUFFIX}
59
               PATHS "${CMAKE_WINDOWS_LIBS_DIR}/assimp/lib"
60
                     "${VS_SEARCH_PATH}assimp/lib" 
Jan Möbius's avatar
Jan Möbius committed
61
	             "C:/Program Files/Assimp/lib"
62
               )  
63

Jan Möbius's avatar
Jan Möbius committed
64

65
 GET_FILENAME_COMPONENT( ASSIMP_LIBRARY_DIR ${ASSIMP_LIBRARY} PATH ) 
66

Jan Möbius's avatar
Jan Möbius committed
67
 SET( ASSIMP_LIBRARY_DIR ${ASSIMP_LIBRARY_DIR}/../../bin/${DIRSUFFIX}/ CACHE PATH "Path to the DLLs")
68
 
69 70
else (WIN32)

71 72 73 74 75 76
 # Find the headers
 FIND_PATH( ASSIMP_INCLUDE_DIR assimp/scene.h
            PATHS /usr/include 
                  "C:/Program Files/Assimp/include" )


77 78 79 80 81 82 83 84 85 86 87 88
 FIND_LIBRARY( ASSIMP_LIBRARY
               NAMES assimp
               PATHS /usr/lib /usr/local/lib )
endif( WIN32)


IF (ASSIMP_INCLUDE_DIR AND ASSIMP_LIBRARY)
  SET(ASSIMP_FOUND TRUE)
ELSE (ASSIMP_INCLUDE_DIR AND ASSIMP_LIBRARY)
  SET( ASSIMP_FOUND FALSE )
ENDIF (ASSIMP_INCLUDE_DIR AND ASSIMP_LIBRARY)