root/OpenSceneGraph/trunk/CMakeModules/Find3rdPartyDependencies.cmake @ 9819

Revision 9819, 4.9 kB (checked in by robert, 6 years ago)

Addded setting of FREETYPE_INCLUDE_DIRS to Find3rdPartyDependencies.cmake

  • Property svn:eol-style set to native
Line 
1################################################################################################
2# this Macro find a generic dependency, handling debug suffix
3# all the paramenter are required, in case of lists, use "" in calling
4################################################################################################
5
6MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFFIX)
7
8    MESSAGE(STATUS "searching ${DEPNAME} -->${INCLUDEFILE}<-->${LIBRARY_NAMES}<-->${SEARCHPATHLIST}<--")
9
10    SET(MY_PATH_INCLUDE )
11    SET(MY_PATH_LIB )
12   
13    FOREACH( MYPATH ${SEARCHPATHLIST} )
14        SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
15        SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
16    ENDFOREACH( MYPATH ${SEARCHPATHLIST} )
17   
18    FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
19      ${MY_PATH_INCLUDE}
20      NO_DEFAULT_PATH
21    )
22    MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
23    #MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
24   
25    FIND_LIBRARY("${DEPNAME}_LIBRARY"
26        NAMES ${LIBRARY_NAMES}
27      PATHS ${MY_PATH_LIB}
28      NO_DEFAULT_PATH
29    )
30    SET(LIBRARY_NAMES_DEBUG "")
31    FOREACH(LIBNAME ${LIBRARY_NAMES})
32        LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}")
33    ENDFOREACH(LIBNAME)
34    FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
35        NAMES ${LIBRARY_NAMES_DEBUG}
36      PATHS ${MY_PATH_LIB}
37      NO_DEFAULT_PATH
38    )
39    MARK_AS_ADVANCED("${DEPNAME}_LIBRARY")
40    #MESSAGE( " ${DEPNAME}_LIBRARY --> ${${DEPNAME}_LIBRARY}<--")
41    SET( ${DEPNAME}_FOUND "NO" )
42    IF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
43      SET( ${DEPNAME}_FOUND "YES" )
44      IF(NOT ${DEPNAME}_LIBRARY_DEBUG)
45          MESSAGE("-- Warning Debug ${DEPNAME} not found, using: ${${DEPNAME}_LIBRARY}")
46          SET(${DEPNAME}_LIBRARY_DEBUG "${${DEPNAME}_LIBRARY}")
47      ENDIF(NOT ${DEPNAME}_LIBRARY_DEBUG)
48    ENDIF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
49ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFFIX)
50
51
52################################################################################################
53# this Macro is tailored to Mike dependencies
54################################################################################################
55
56MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
57        FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D")
58        FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype234;freetype234MT;freetype235" ${OSG_3RDPARTY_BIN} "_D")
59        IF(FREETYPE_FOUND)
60            #forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
61            SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "")
62            SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR} CACHE PATH "")
63            MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR_ft2build FREETYPE_INCLUDE_DIR_freetype2)
64            SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
65        ENDIF(FREETYPE_FOUND)
66        FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D")
67        FIND_DEPENDENCY(JPEG jpeglib.h libjpeg ${OSG_3RDPARTY_BIN} "D")
68        #FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal_i" ${OSG_3RDPARTY_BIN})
69        FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D")
70        IF(GLUT_FOUND)
71            #forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
72            SET(GLUT_glut_LIBRARY ${GLUT_LIBRARY} CACHE FILEPATH "")
73            MARK_AS_ADVANCED(GLUT_glut_LIBRARY)
74        ENDIF(GLUT_FOUND)
75        FIND_DEPENDENCY(GIFLIB gif_lib.h "ungif;libungif" ${OSG_3RDPARTY_BIN} "D")
76        FIND_DEPENDENCY(ZLIB zlib.h "z;zlib;zlib1" ${OSG_3RDPARTY_BIN} "D")
77        IF(ZLIB_FOUND)
78            FIND_DEPENDENCY(PNG png.h "libpng;libpng13" ${OSG_3RDPARTY_BIN} "D")
79            IF(PNG_FOUND)
80                #forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
81                SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
82                MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
83            ENDIF(PNG_FOUND)
84        ENDIF(ZLIB_FOUND)       
85#luigi#INCLUDE(FindOSGDepends.cmake)
86ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
87
88
89
90
91################################################################################################
92# this is code for handling optional 3DPARTY usage
93################################################################################################
94
95OPTION(USE_3DPARTY_BIN "Set to ON to use Mike prebuilt dependencies situated side of OpenSceneGraph source.  Use OFF for avoiding." ON)
96IF(USE_3DPARTY_BIN)
97    GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH)
98    SET(ACTUAL_3DPARTY_DIR "${PARENT_DIR}/3rdparty" CACHE PATH "Location of 3rdparty dependencies")
99    IF(EXISTS ${ACTUAL_3DPARTY_DIR})
100        SEARCH_3RDPARTY(${ACTUAL_3DPARTY_DIR})
101    ENDIF(EXISTS ${ACTUAL_3DPARTY_DIR})
102ENDIF(USE_3DPARTY_BIN)
Note: See TracBrowser for help on using the browser.