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

Revision 8358, 4.8 kB (checked in by robert, 7 years ago)

From Philip Lowman, post 1:

"Here is a collection of changes which should fix issues building the OSG with CMake 2.6.0 (along with some other changes)

CMakeLists.txt:
* Set CMP0003 to supress warning about linking against -lpthread (which is a

non-absolute library location). (CMake 2.6.x fix)

* Modified the WIN32_USE_MP and a couple of other Visual Studio specific flags

to be in an IF(MSVC) block (minor tweak to reduce exposing this stuff on MinGW builds)

* Includes my second set of glu tesselator autodetection changes that you
seemed to want but haven't committed yet.

src/OpenThreads/pthreads/CMakeLists.txt:
* Eliminates warning when compiling on Linux about spaces in link line (CMake 2.6.x fix)

CMakeModules/OsgMacroUtils.cmake:
* Tweaks to make the macros behave properly under CMake 2.6.0 (doesn't change behavior under CMake 2.4.x)

CMakeModules/Find3rdPartyDependencies.cmake:
* Adds the NO_DEFAULT_PATH option to all of the search options so that things in C:\Program Files\OpenSceneGraph aren't accidently picked up during configure time and instead only things in the "3rdParty" folder are discovered. (general bugfix)
"

post 2:
"Ok, hold the presses. I just discovered that for some odd reason the osgdb_* plugins under Linux aren't getting put under the osgPlugins-2.5.0 folder. Not exactly sure why this broke, the folder was there, just empty. I'll have to look into it this evening."

post 3:

"Fixed, was caused by the switch to CMAKE_LIBRARY_OUTPUT_DIRECTORY and some code in osgPlugins/CMakeLists.txt that effectively overrides LIBRARY_OUTPUT_PATH on non-MSVC compilers to dump the plugins in the plugins folder. I tweaked it to override CMAKE_LIBRARY_OUTPUT_DIRECTORY as well. Seems to work fine."

  • 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        ENDIF(FREETYPE_FOUND)
65        FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D")
66        FIND_DEPENDENCY(JPEG jpeglib.h libjpeg ${OSG_3RDPARTY_BIN} "D")
67        #FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal_i" ${OSG_3RDPARTY_BIN})
68        FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D")
69        IF(GLUT_FOUND)
70            #forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
71            SET(GLUT_glut_LIBRARY ${GLUT_LIBRARY} CACHE FILEPATH "")
72            MARK_AS_ADVANCED(GLUT_glut_LIBRARY)
73        ENDIF(GLUT_FOUND)
74        FIND_DEPENDENCY(GIFLIB gif_lib.h "ungif;libungif" ${OSG_3RDPARTY_BIN} "D")
75        FIND_DEPENDENCY(ZLIB zlib.h "z;zlib;zlib1" ${OSG_3RDPARTY_BIN} "D")
76        IF(ZLIB_FOUND)
77            FIND_DEPENDENCY(PNG png.h "libpng;libpng13" ${OSG_3RDPARTY_BIN} "D")
78            IF(PNG_FOUND)
79                #forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
80                SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
81                MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
82            ENDIF(PNG_FOUND)
83        ENDIF(ZLIB_FOUND)       
84#luigi#INCLUDE(FindOSGDepends.cmake)
85ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
86
87
88
89
90################################################################################################
91# this is code for handling optional 3DPARTY usage
92################################################################################################
93
94OPTION(USE_3DPARTY_BIN "Set to ON to use Mike prebuilt dependencies situated side of OpenSceneGraph source.  Use OFF for avoiding." ON)
95IF(USE_3DPARTY_BIN)
96    GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH)
97    SET(ACTUAL_3DPARTY_DIR "${PARENT_DIR}/3rdparty" CACHE PATH "Location of 3rdparty dependencies")
98    IF(EXISTS ${ACTUAL_3DPARTY_DIR})
99        SEARCH_3RDPARTY(${ACTUAL_3DPARTY_DIR})
100    ENDIF(EXISTS ${ACTUAL_3DPARTY_DIR})
101ENDIF(USE_3DPARTY_BIN)
Note: See TracBrowser for help on using the browser.