2007-03-28 15:34:46 +08:00
|
|
|
################################################################################################
|
|
|
|
# this Macro find a generic dependency, handling debug suffix
|
|
|
|
# all the paramenter are required, in case of lists, use "" in calling
|
|
|
|
################################################################################################
|
|
|
|
|
2010-03-11 01:23:58 +08:00
|
|
|
MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX EXSUFFIX)
|
2007-03-28 15:34:46 +08:00
|
|
|
|
2010-03-11 01:23:58 +08:00
|
|
|
MESSAGE(STATUS "searching ${DEPNAME} -->${INCLUDEFILE}<-->${LIBRARY_NAMES_BASE}<-->${SEARCHPATHLIST}<--")
|
2008-05-27 06:36:58 +08:00
|
|
|
|
2007-04-27 17:49:28 +08:00
|
|
|
SET(MY_PATH_INCLUDE )
|
|
|
|
SET(MY_PATH_LIB )
|
|
|
|
|
|
|
|
FOREACH( MYPATH ${SEARCHPATHLIST} )
|
|
|
|
SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
|
|
|
|
SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
|
|
|
|
ENDFOREACH( MYPATH ${SEARCHPATHLIST} )
|
2008-05-27 06:36:58 +08:00
|
|
|
|
2007-04-27 17:49:28 +08:00
|
|
|
FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
|
|
|
|
${MY_PATH_INCLUDE}
|
2008-05-27 06:36:58 +08:00
|
|
|
NO_DEFAULT_PATH
|
2007-04-27 17:49:28 +08:00
|
|
|
)
|
|
|
|
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
|
|
|
|
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
|
|
|
|
2010-03-11 01:23:58 +08:00
|
|
|
SET(LIBRARY_NAMES "")
|
|
|
|
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
|
|
|
LIST(APPEND LIBRARY_NAMES "${LIBNAME}${EXSUFFIX}")
|
|
|
|
ENDFOREACH(LIBNAME)
|
|
|
|
FIND_LIBRARY("${DEPNAME}_LIBRARY"
|
2007-04-27 17:49:28 +08:00
|
|
|
NAMES ${LIBRARY_NAMES}
|
|
|
|
PATHS ${MY_PATH_LIB}
|
2008-05-27 06:36:58 +08:00
|
|
|
NO_DEFAULT_PATH
|
2007-04-27 17:49:28 +08:00
|
|
|
)
|
|
|
|
SET(LIBRARY_NAMES_DEBUG "")
|
2010-03-11 01:23:58 +08:00
|
|
|
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
|
|
|
LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}${EXSUFFIX}")
|
2007-04-27 17:49:28 +08:00
|
|
|
ENDFOREACH(LIBNAME)
|
|
|
|
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
|
|
|
|
NAMES ${LIBRARY_NAMES_DEBUG}
|
|
|
|
PATHS ${MY_PATH_LIB}
|
2008-05-27 06:36:58 +08:00
|
|
|
NO_DEFAULT_PATH
|
2007-04-27 17:49:28 +08:00
|
|
|
)
|
|
|
|
MARK_AS_ADVANCED("${DEPNAME}_LIBRARY")
|
|
|
|
#MESSAGE( " ${DEPNAME}_LIBRARY --> ${${DEPNAME}_LIBRARY}<--")
|
|
|
|
SET( ${DEPNAME}_FOUND "NO" )
|
|
|
|
IF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
|
|
|
|
SET( ${DEPNAME}_FOUND "YES" )
|
|
|
|
IF(NOT ${DEPNAME}_LIBRARY_DEBUG)
|
|
|
|
MESSAGE("-- Warning Debug ${DEPNAME} not found, using: ${${DEPNAME}_LIBRARY}")
|
|
|
|
SET(${DEPNAME}_LIBRARY_DEBUG "${${DEPNAME}_LIBRARY}")
|
|
|
|
ENDIF(NOT ${DEPNAME}_LIBRARY_DEBUG)
|
|
|
|
ENDIF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
|
2010-03-11 01:23:58 +08:00
|
|
|
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX)
|
2007-03-28 15:34:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
################################################################################################
|
|
|
|
# this Macro is tailored to Mike dependencies
|
|
|
|
################################################################################################
|
|
|
|
|
|
|
|
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
2010-03-11 01:23:58 +08:00
|
|
|
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D" "_i")
|
|
|
|
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype234;freetype234MT;freetype235;freetype237;freetype238" ${OSG_3RDPARTY_BIN} "d" "")
|
2007-04-27 17:49:28 +08:00
|
|
|
IF(FREETYPE_FOUND)
|
|
|
|
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
|
2009-02-27 06:09:47 +08:00
|
|
|
SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
|
|
|
SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
2007-04-27 17:49:28 +08:00
|
|
|
MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR_ft2build FREETYPE_INCLUDE_DIR_freetype2)
|
2009-02-26 18:48:04 +08:00
|
|
|
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
2007-04-27 17:49:28 +08:00
|
|
|
ENDIF(FREETYPE_FOUND)
|
2010-03-11 01:23:58 +08:00
|
|
|
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D" "")
|
|
|
|
FIND_DEPENDENCY(JPEG jpeglib.h libjpeg ${OSG_3RDPARTY_BIN} "D" "")
|
|
|
|
FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal16" ${OSG_3RDPARTY_BIN} "d" "_i")
|
|
|
|
FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D" "")
|
2007-04-27 17:49:28 +08:00
|
|
|
IF(GLUT_FOUND)
|
|
|
|
#forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
|
|
|
|
SET(GLUT_glut_LIBRARY ${GLUT_LIBRARY} CACHE FILEPATH "")
|
|
|
|
MARK_AS_ADVANCED(GLUT_glut_LIBRARY)
|
|
|
|
ENDIF(GLUT_FOUND)
|
2010-03-11 01:23:58 +08:00
|
|
|
FIND_DEPENDENCY(GIFLIB gif_lib.h "ungif;libungif" ${OSG_3RDPARTY_BIN} "D" "")
|
|
|
|
FIND_DEPENDENCY(ZLIB zlib.h "z;zlib;zlib1" ${OSG_3RDPARTY_BIN} "D" "")
|
2007-04-27 17:49:28 +08:00
|
|
|
IF(ZLIB_FOUND)
|
2010-03-11 01:23:58 +08:00
|
|
|
FIND_DEPENDENCY(PNG png.h "libpng;libpng13" ${OSG_3RDPARTY_BIN} "D" "")
|
2007-04-27 17:49:28 +08:00
|
|
|
IF(PNG_FOUND)
|
|
|
|
#forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
|
|
|
|
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
|
|
|
|
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
|
|
|
|
ENDIF(PNG_FOUND)
|
|
|
|
ENDIF(ZLIB_FOUND)
|
2007-03-28 15:34:46 +08:00
|
|
|
#luigi#INCLUDE(FindOSGDepends.cmake)
|
|
|
|
ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################################
|
|
|
|
# this is code for handling optional 3DPARTY usage
|
|
|
|
################################################################################################
|
|
|
|
|
|
|
|
OPTION(USE_3DPARTY_BIN "Set to ON to use Mike prebuilt dependencies situated side of OpenSceneGraph source. Use OFF for avoiding." ON)
|
|
|
|
IF(USE_3DPARTY_BIN)
|
2007-04-27 17:49:28 +08:00
|
|
|
GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH)
|
2010-03-11 01:23:58 +08:00
|
|
|
SET(TEST_3DPARTY_DIR "${PARENT_DIR}/3rdparty")
|
|
|
|
IF(NOT EXISTS ${TEST_3DPARTY_DIR})
|
|
|
|
IF(MSVC71)
|
|
|
|
SET(TEST_3DPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs71")
|
|
|
|
ELSEIF(MSVC80)
|
|
|
|
SET(TEST_3DPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs80sp1")
|
|
|
|
ELSEIF(MSVC90)
|
|
|
|
SET(TEST_3DPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs90sp1")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF(NOT EXISTS ${TEST_3DPARTY_DIR})
|
|
|
|
SET(ACTUAL_3DPARTY_DIR "${TEST_3DPARTY_DIR}" CACHE PATH "Location of 3rdparty dependencies")
|
2007-04-27 17:49:28 +08:00
|
|
|
IF(EXISTS ${ACTUAL_3DPARTY_DIR})
|
|
|
|
SEARCH_3RDPARTY(${ACTUAL_3DPARTY_DIR})
|
|
|
|
ENDIF(EXISTS ${ACTUAL_3DPARTY_DIR})
|
2007-03-28 15:34:46 +08:00
|
|
|
ENDIF(USE_3DPARTY_BIN)
|