OpenSceneGraph/CMakeModules/Find3rdPartyDependencies.cmake

103 lines
4.9 KiB
CMake
Raw Normal View History

################################################################################################
# this Macro find a generic dependency, handling debug suffix
# all the paramenter are required, in case of lists, use "" in calling
################################################################################################
MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFFIX)
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."
2008-05-27 06:36:58 +08:00
MESSAGE(STATUS "searching ${DEPNAME} -->${INCLUDEFILE}<-->${LIBRARY_NAMES}<-->${SEARCHPATHLIST}<--")
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} )
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."
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}
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."
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}<--")
FIND_LIBRARY("${DEPNAME}_LIBRARY"
NAMES ${LIBRARY_NAMES}
PATHS ${MY_PATH_LIB}
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."
2008-05-27 06:36:58 +08:00
NO_DEFAULT_PATH
2007-04-27 17:49:28 +08:00
)
SET(LIBRARY_NAMES_DEBUG "")
FOREACH(LIBNAME ${LIBRARY_NAMES})
LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}")
ENDFOREACH(LIBNAME)
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
NAMES ${LIBRARY_NAMES_DEBUG}
PATHS ${MY_PATH_LIB}
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."
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)
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFFIX)
################################################################################################
# this Macro is tailored to Mike dependencies
################################################################################################
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
2007-04-27 17:49:28 +08:00
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D")
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype234;freetype234MT;freetype235;freetype237" ${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
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)
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
2007-04-27 17:49:28 +08:00
ENDIF(FREETYPE_FOUND)
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D")
2007-04-27 17:49:28 +08:00
FIND_DEPENDENCY(JPEG jpeglib.h libjpeg ${OSG_3RDPARTY_BIN} "D")
#FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal_i" ${OSG_3RDPARTY_BIN})
FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D")
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)
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)
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)
#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)
SET(ACTUAL_3DPARTY_DIR "${PARENT_DIR}/3rdparty" CACHE PATH "Location of 3rdparty dependencies")
IF(EXISTS ${ACTUAL_3DPARTY_DIR})
SEARCH_3RDPARTY(${ACTUAL_3DPARTY_DIR})
ENDIF(EXISTS ${ACTUAL_3DPARTY_DIR})
ENDIF(USE_3DPARTY_BIN)