diff options
30 files changed, 2752 insertions, 767 deletions
diff --git a/Modules/FindFreeType.cmake b/Modules/FindFreeType.cmake new file mode 100644 index 0000000..b42cd8c --- /dev/null +++ b/Modules/FindFreeType.cmake @@ -0,0 +1,116 @@ +# - Locate FreeType library +# This module defines +# FREETYPE_LIBRARY, the library to link against +# FREETYPE_FOUND, if false, do not try to link to FREETYPE +# FREETYPE_INCLUDE_DIRS, where to find headers. +# This is the concatenation of the paths: +# FREETYPE_INCLUDE_DIR_ft2build +# FREETYPE_INCLUDE_DIR_freetype2 +# +# $FREETYPE_DIR is an environment variable that would +# correspond to the ./configure --prefix=$FREETYPE_DIR +# used in building FREETYPE. +# Created by Eric Wing. + +# Ugh, FreeType seems to use some #include trickery which +# makes this harder than it should be. It looks like they +# put ft2build.h in a common/easier-to-find location which +# then contains a #include to a more specific header in a +# more specific location (#include <freetype/config/ftheader.h>). +# Then from there, they need to set a bunch of #define's +# so you can do something like: +# #include FT_FREETYPE_H +# Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES() +# wants explicit full paths and this trickery doesn't work too well. +# I'm going to attempt to cut out the middleman and hope +# everything still works. +FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h + $ENV{FREETYPE_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h + PATHS + /usr/local + /usr + /usr/local/X11R6 + /usr/local/X11 + /usr/X11R6 + /usr/X11 + /sw + /opt/local + /opt/csw + /opt + /usr/freeware + PATH_SUFFIXES include +) + +FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h + $ENV{FREETYPE_DIR}/include/freetype2 + NO_DEFAULT_PATH +) +FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include/freetype2 +) +FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h + /usr/local/include/freetype2 + /usr/include/freetype2 + /usr/local/X11R6/include/freetype2 + /usr/local/X11/include/freetype2 + /usr/X11R6/include/freetype2 + /usr/X11/include/freetype2 + /sw/include/freetype2 + /opt/local/include/freetype2 + /opt/csw/include/freetype2 + /opt/include/freetype2 + /usr/freeware/include/freetype2 +) + +FIND_LIBRARY(FREETYPE_LIBRARY + NAMES freetype libfreetype freetype219 + PATHS + $ENV{FREETYPE_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(FREETYPE_LIBRARY + NAMES freetype libfreetype freetype219 + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(FREETYPE_LIBRARY + NAMES freetype libfreetype freetype219 + PATHS + /usr/local + /usr + /usr/local/X11R6 + /usr/local/X11 + /usr/X11R6 + /usr/X11 + /sw + /opt/local + /opt/csw + /opt + /usr/freeware + PATH_SUFFIXES lib64 lib +) + +IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) + SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}") +ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) + + +SET(FREETYPE_FOUND "NO") +IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) + SET(FREETYPE_FOUND "YES") +ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) + + diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake new file mode 100644 index 0000000..14c075a --- /dev/null +++ b/Modules/FindGDAL.cmake @@ -0,0 +1,93 @@ +# Locate gdal +# This module defines +# GDAL_LIBRARY +# GDAL_FOUND, if false, do not try to link to gdal +# GDAL_INCLUDE_DIR, where to find the headers +# +# $GDALDIR is an environment variable that would +# correspond to the ./configure --prefix=$GDAL_DIR +# used in building gdal. +# +# Created by Eric Wing. I'm not a gdal user, but OpenSceneGraph uses it +# for osgTerrain so I whipped this module together for completeness. +# I actually don't know the conventions or where files are typically +# placed in distros. +# Any real gdal users are encouraged to correct this (but please don't +# break the OS X framework stuff when doing so which is what usually seems +# to happen). + +# This makes the presumption that you are include gdal.h like +# #include "gdal.h" + +FIND_PATH(GDAL_INCLUDE_DIR gdal.h + $ENV{GDAL_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) + +FIND_PATH(GDAL_INCLUDE_DIR gdal.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) + +FIND_PATH(GDAL_INCLUDE_DIR gdal.h + PATHS + ~/Library/Frameworks/gdal.framework/Headers + /Library/Frameworks/gdal.framework/Headers + /usr/local/include/gdal + /usr/local/include/GDAL + /usr/local/include + /usr/include/gdal + /usr/include/GDAL + /usr/include + /sw/include/gdal + /sw/include/GDAL + /sw/include # Fink + /opt/local/include/gdal + /opt/local/include/GDAL + /opt/local/include # DarwinPorts + /opt/csw/include/gdal + /opt/csw/include/GDAL + /opt/csw/include # Blastwave + /opt/include/gdal + /opt/include/GDAL + /opt/include +) + +FIND_LIBRARY(GDAL_LIBRARY + NAMES gdal GDAL + PATHS + $ENV{GDAL_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(GDAL_LIBRARY + NAMES gdal GDAL + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(GDAL_LIBRARY + NAMES gdal GDAL + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + /usr/freeware + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;GDAL_ROOT]/lib + PATH_SUFFIXES lib64 lib +) + +SET(GDAL_FOUND "NO") +IF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR) + SET(GDAL_FOUND "YES") +ENDIF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR) + + + diff --git a/Modules/FindGIFLIB.cmake b/Modules/FindGIFLIB.cmake new file mode 100644 index 0000000..b2b2f23 --- /dev/null +++ b/Modules/FindGIFLIB.cmake @@ -0,0 +1,74 @@ +# This module defines +# GIFLIB_LIBRARY +# GIFLIB_FOUND, if false, do not try to link +# GIFLIB_INCLUDE_DIR, where to find the headers +# +# $GIFLIB_DIR is an environment variable that would +# correspond to the ./configure --prefix=$GIFLIB_DIR +# +# Created by Eric Wing. + +FIND_PATH(GIFLIB_INCLUDE_DIR gif_lib.h + PATHS + $ENV{GIFLIB_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) + +FIND_PATH(GIFLIB_INCLUDE_DIR gif_lib.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) + +FIND_PATH(GIFLIB_INCLUDE_DIR gif_lib.h + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local/include + /usr/include + /sw/include # Fink + /opt/local/include # DarwinPorts + /opt/csw/include # Blastwave + /opt/include + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include + /usr/freeware/include +) + +FIND_LIBRARY(GIFLIB_LIBRARY + NAMES gif ungif libgif libungif + PATHS + $ENV{GIFLIB_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) + +FIND_LIBRARY(GIFLIB_LIBRARY + NAMES gif ungif libgif libungif + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) + +FIND_LIBRARY(GIFLIB_LIBRARY + NAMES gif ungif libgif libungif + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + /usr/freeware + PATH_SUFFIXES lib64 lib +) + +SET(GIFLIB_FOUND "NO") +IF(GIFLIB_LIBRARY AND GIFLIB_INCLUDE_DIR) + SET(GIFLIB_FOUND "YES") +ENDIF(GIFLIB_LIBRARY AND GIFLIB_INCLUDE_DIR) + + diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake new file mode 100644 index 0000000..7058372 --- /dev/null +++ b/Modules/FindLua50.cmake @@ -0,0 +1,114 @@ +# Locate Lua library +# This module defines +# LUA_LIBRARIES, both lua and lualib +# LUA_FOUND, if false, do not try to link to Lua +# LUA_INCLUDE_DIR, where to find lua.h and lualib.h (and probably lauxlib.h) +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include <lua/lua.h> +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + + +FIND_PATH(LUA_INCLUDE_DIR lua.h + PATHS + $ENV{LUA_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include +) +FIND_PATH(LUA_INCLUDE_DIR lua.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include +) +FIND_PATH(LUA_INCLUDE_DIR lua.h + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include +) + +FIND_LIBRARY(LUA_LIBRARY_lua + NAMES lua50 lua5.0 lua5 lua + PATHS + $ENV{LUA_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(LUA_LIBRARY_lua + NAMES lua50 lua5.0 lua5 lua + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(LUA_LIBRARY_lua + NAMES lua50 lua5.0 lua5 lua + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +# In an OS X framework, lualib is usually included as part of the framework +# (like GLU in OpenGL.framework) +IF(${LUA_LIBRARY_lua} MATCHES "framework") + SET( LUA_LIBRARIES "${LUA_LIBRARY_lua}" CACHE STRING "Lua framework") +ELSE(${LUA_LIBRARY_lua} MATCHES "framework") + FIND_LIBRARY(LUA_LIBRARY_lualib + NAMES lualib50 lualib5.0 lualib5 lualib + PATHS + $ENV{LUALIB_DIR} + $ENV{LUA_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib + ) + FIND_LIBRARY(LUA_LIBRARY_lualib + NAMES lualib50 lualib5.0 lualib5 lualib + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib + ) + FIND_LIBRARY(LUA_LIBRARY_lualib + NAMES lualib50 lualib5.0 lualib5 lualib + PATHS + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib + ) + IF(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua) + # include the math library for Unix + IF(UNIX AND NOT APPLE) + FIND_LIBRARY(MATH_LIBRARY_FOR_LUA m) + SET( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatentation of lua and lualib libraries") + # For Windows and Mac, don't need to explicitly include the math library + ELSE(UNIX AND NOT APPLE) + SET( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatentation of lua and lualib libraries") + ENDIF(UNIX AND NOT APPLE) + ENDIF(LUA_LIBRARY_lualib AND LUA_LIBRARY_lua) +ENDIF(${LUA_LIBRARY_lua} MATCHES "framework") + + + +SET(LUA_FOUND "NO") +IF(LUA_LIBRARIES AND LUA_INCLUDE_DIR) + SET(LUA_FOUND "YES") +ENDIF(LUA_LIBRARIES AND LUA_INCLUDE_DIR) + diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake new file mode 100644 index 0000000..7917ba7 --- /dev/null +++ b/Modules/FindLua51.cmake @@ -0,0 +1,81 @@ +# Locate Lua library +# This module defines +# LUA_LIBRARIES +# LUA_FOUND, if false, do not try to link to Lua +# LUA_INCLUDE_DIR, where to find lua.h +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include <lua/lua.h> +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + + +FIND_PATH(LUA_INCLUDE_DIR lua.h + PATHS + $ENV{LUA_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include +) +FIND_PATH(LUA_INCLUDE_DIR lua.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include +) +FIND_PATH(LUA_INCLUDE_DIR lua.h + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include +) + +FIND_LIBRARY(LUA_LIBRARY + NAMES lua51 lua5.1 lua + PATHS + $ENV{LUA_DIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(LUA_LIBRARY + NAMES lua51 lua5.1 lua + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(LUA_LIBRARY + NAMES lua51 lua5.1 lua + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +IF(LUA_LIBRARY) + # include the math library for Unix + IF(UNIX AND NOT APPLE) + FIND_LIBRARY(MATH_LIBRARY_FOR_LUA m) + SET( LUA_LIBRARIES "${LUA_LIBRARY};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "Lua Libraries") + # For Windows and Mac, don't need to explicitly include the math library + ELSE(UNIX AND NOT APPLE) + SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") + ENDIF(UNIX AND NOT APPLE) +ENDIF(LUA_LIBRARY) + +SET(LUA_FOUND "NO") +IF(LUA_LIBRARIES AND LUA_INCLUDE_DIR) + SET(LUA_FOUND "YES") +ENDIF(LUA_LIBRARIES AND LUA_INCLUDE_DIR) + diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 0bc791b..f5a189e 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -1,62 +1,109 @@ -# - Locate OpenAL +# Locate OpenAL # This module defines -# OPENAL_LIBRARY -# OPENAL_FOUND, if false, do not try to link to OpenAL -# OPENAL_INCLUDE_DIR, where to find the headers -# +# OPENAL_LIBRARY +# OPENAL_FOUND, if false, do not try to link to OpenAL +# OPENAL_INCLUDE_DIR, where to find the headers +# # $OPENALDIR is an environment variable that would # correspond to the ./configure --prefix=$OPENALDIR # used in building OpenAL. -# +# # Created by Eric Wing. This was influenced by the FindSDL.cmake module. -# On OSX, this will prefer the Framework version (if found) over others. + +# This makes the presumption that you are include al.h like +# #include "al.h" +# and not +# #include <AL/al.h> +# The reason for this is that the latter is not entirely portable. +# Windows/Creative Labs does not by default put their headers in AL/ and +# OS X uses the convention <OpenAL/al.h>. +# +# For Windows, Creative Labs seems to have added a registry key for their +# OpenAL 1.1 installer. I have added that key to the list of search paths, +# however, the key looks like it could be a little fragile depending on +# if they decide to change the 1.00.0000 number for bug fix releases. +# Also, they seem to have laid down groundwork for multiple library platforms +# which puts the library in an extra subdirectory. Currently there is only +# Win32 and I have hardcoded that here. This may need to be adjusted as +# platforms are introduced. +# The OpenAL 1.0 installer doesn't seem to have a useful key I can use. +# I do not know if the Nvidia OpenAL SDK has a registry key. +# +# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger). +# To support the framework, I originally wrote special framework detection +# code in this module which I have now removed with CMake's introduction +# of native support for frameworks. +# In addition, OpenAL is open source, and it is possible to compile on Panther. +# Furthermore, due to bugs in the initial OpenAL release, and the +# transition to OpenAL 1.1, it is common to need to override the built-in +# framework. +# Per my request, CMake should search for frameworks first in +# the following order: +# ~/Library/Frameworks/OpenAL.framework/Headers +# /Library/Frameworks/OpenAL.framework/Headers +# /System/Library/Frameworks/OpenAL.framework/Headers +# +# On OS X, this will prefer the Framework version (if found) over others. # People will have to manually change the cache values of -# OPENAL_LIBRARY to override this selection. -# Tiger will include OpenAL as part of the System. -# But for now, we have to look around. -# Other (Unix) systems should be able to utilize the non-framework paths. -FIND_PATH(OPENAL_INCLUDE_DIR NAMES al.h - PATH_SUFFIXES AL OpenAL - PATHS - $ENV{OPENALDIR}/include - ~/Library/Frameworks/OpenAL.framework/Headers - /Library/Frameworks/OpenAL.framework/Headers - /System/Library/Frameworks/OpenAL.framework/Headers # Tiger - ) +# OPENAL_LIBRARY to override this selection or set the CMake environment +# CMAKE_INCLUDE_PATH to modify the search paths. + +FIND_PATH(OPENAL_INCLUDE_DIR al.h + PATHS + $ENV{OPENALDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include/AL include/OpenAL include +) +FIND_PATH(OPENAL_INCLUDE_DIR al.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include/AL include/OpenAL include +) +FIND_PATH(OPENAL_INCLUDE_DIR al.h + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] + PATH_SUFFIXES include include/lua51 include/lua5.1 include/lua +) -# I'm not sure if I should do a special casing for Apple. It is -# unlikely that other Unix systems will find the framework path. -# But if they do ([Next|Open|GNU]Step?), -# do they want the -framework option also? -IF(${OPENAL_INCLUDE_DIR} MATCHES ".framework") - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" OPENAL_FRAMEWORK_PATH_TMP ${OPENAL_INCLUDE_DIR}) - IF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is in default search path, don't need to use -F - SET (OPENAL_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX") - ELSE("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is not /Library/Frameworks, need to use -F - SET(OPENAL_LIBRARY "-F${OPENAL_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX") - ENDIF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(OPENAL_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") +FIND_LIBRARY(OPENAL_LIBRARY + NAMES OpenAL al OpenAL32 + PATHS + $ENV{OPENALDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 +) +FIND_LIBRARY(OPENAL_LIBRARY + NAMES OpenAL al OpenAL32 + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 +) +FIND_LIBRARY(OPENAL_LIBRARY + NAMES OpenAL al OpenAL32 + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] + PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 +) -ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework") - FIND_LIBRARY(OPENAL_LIBRARY - NAMES openal al OpenAL32 - PATHS - $ENV{OPENALDIR}/lib - $ENV{OPENALDIR}/libs - ) -ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework") +SET(OPENAL_FOUND "NO") +IF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) + SET(OPENAL_FOUND "YES") +ENDIF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) -# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR) diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake new file mode 100644 index 0000000..ffbad83 --- /dev/null +++ b/Modules/FindOpenThreads.cmake @@ -0,0 +1,182 @@ +# OpenThreads is a C++ based threading library. Its largest userbase +# seems to OpenSceneGraph so you might notice I accept OSGDIR as an +# environment path. +# I consider this part of the Findosg* suite used to find OpenSceneGraph +# components. +# Each component is separate and you must opt in to each module. +# +# Locate OpenThreads +# This module defines +# OPENTHREADS_LIBRARY +# OPENTHREADS_FOUND, if false, do not try to link to OpenThreads +# OPENTHREADS_INCLUDE_DIR, where to find the headers +# +# $OPENTHREADS_DIR is an environment variable that would +# correspond to the ./configure --prefix=$OPENTHREADS_DIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <OpenThreads/Thread> + +# To make it easier for one-step automated configuration/builds, +# we leverage environmental paths. This is preferable +# to the -DVAR=value switches because it insulates the +# users from changes we may make in this script. +# It also offers a little more flexibility than setting +# the CMAKE_*_PATH since we can target specific components. +# However, the default CMake behavior will search system paths +# before anything else. This is problematic in the cases +# where you have an older (stable) version installed, but +# are trying to build a newer version. +# CMake doesn't offer a nice way to globally control this behavior +# so we have to do a nasty "double FIND_" in this module. +# The first FIND disables the CMAKE_ search paths and only checks +# the environmental paths. +# If nothing is found, then the second find will search the +# standard install paths. +# Explicit -DVAR=value arguments should still be able to override everything. +# Note: We have added an additional check for ${CMAKE_PREFIX_PATH}. +# This is not an official CMake variable, but one we are proposing be +# added to CMake. Be warned that this may go away or the variable name +# may change. + +FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread + PATHS + $ENV{OPENTHREADS_INCLUDE_DIR} + $ENV{OPENTHREADS_DIR}/include + $ENV{OPENTHREADS_DIR} + $ENV{OSG_INCLUDE_DIR} + $ENV{OSG_DIR}/include + $ENV{OSG_DIR} + $ENV{OSGDIR}/include + $ENV{OSGDIR} + NO_DEFAULT_PATH +) + +FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) + +FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread + ~/Library/Frameworks + /Library/Frameworks + /usr/local/include + /usr/include + /sw/include # Fink + /opt/local/include # DarwinPorts + /opt/csw/include # Blastwave + /opt/include + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/include + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include +) + + +FIND_LIBRARY(OPENTHREADS_LIBRARY + NAMES OpenThreads OpenThreadsWin32 + PATHS + $ENV{OPENTHREADS_LIBRARY_DIR} + $ENV{OPENTHREADS_DIR}/lib64 + $ENV{OPENTHREADS_DIR}/lib + $ENV{OPENTHREADS_DIR} + $ENV{OSG_LIBRARY_DIR} + $ENV{OSG_DIR}/lib64 + $ENV{OSG_DIR}/lib + $ENV{OSG_DIR} + $ENV{OSGDIR}/lib64 + $ENV{OSGDIR}/lib + $ENV{OSGDIR} + NO_DEFAULT_PATH +) + +FIND_LIBRARY(OPENTHREADS_LIBRARY + NAMES OpenThreads OpenThreadsWin32 + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) + +FIND_LIBRARY(OPENTHREADS_LIBRARY + NAMES OpenThreads OpenThreadsWin32 + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local/lib64 + /usr/local/lib + /usr/lib64 + /usr/lib + /sw/lib64 + /sw/lib + /opt/local/lib64 + /opt/local/lib + /opt/csw/lib64 + /opt/csw/lib + /opt/lib64 + /opt/lib + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/lib + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib +) + + +FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG + NAMES OpenThreadsd OpenThreadsWin32d + PATHS + $ENV{OPENTHREADS_DEBUG_LIBRARY_DIR} + $ENV{OPENTHREADS_LIBRARY_DIR} + $ENV{OPENTHREADS_DIR}/lib64 + $ENV{OPENTHREADS_DIR}/lib + $ENV{OPENTHREADS_DIR} + $ENV{OSG_LIBRARY_DIR} + $ENV{OSG_DIR}/lib64 + $ENV{OSG_DIR}/lib + $ENV{OSG_DIR} + $ENV{OSGDIR}/lib64 + $ENV{OSGDIR}/lib + $ENV{OSGDIR} + NO_DEFAULT_PATH +) + +FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG + NAMES OpenThreadsd OpenThreadsWin32d + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) + +FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG + NAMES OpenThreadsd OpenThreadsWin32d + PATHS + /usr/local/lib64 + /usr/local/lib + /usr/lib64 + /usr/lib + /sw/lib64 + /sw/lib + /opt/local/lib64 + /opt/local/lib + /opt/csw/lib64 + /opt/csw/lib + /opt/lib64 + /opt/lib + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/lib + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib +) + + +IF(OPENTHREADS_LIBRARY) + IF(NOT OPENTHREADS_LIBRARY_DEBUG) + #MESSAGE("-- Warning Debug OpenThreads not found, using: ${OPENTHREADS_LIBRARY}") + #SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}") + SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}" CACHE FILEPATH "Debug version of OpenThreads Library (use regular version if not available)" FORCE) + ENDIF(NOT OPENTHREADS_LIBRARY_DEBUG) +ENDIF(OPENTHREADS_LIBRARY) + +SET(OPENTHREADS_FOUND "NO") +IF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY) + SET(OPENTHREADS_FOUND "YES") + # MESSAGE("-- Found OpenThreads: "${OPENTHREADS_LIBRARY}) +ENDIF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY) + diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake index aed1a2d..6980dff 100644 --- a/Modules/FindPhysFS.cmake +++ b/Modules/FindPhysFS.cmake @@ -1,60 +1,68 @@ -# - Locate PhysFS library +# Locate PhysFS library # This module defines -# PHYSFS_LIBRARY, the name of the library to link with -# PHYSFS_FOUND, if false, do not try to link to PHYSFS -# PHYSFS_INCLUDE_DIR, where to find PHYSFS/PHYSFS.h +# PHYSFS_LIBRARY, the name of the library to link against +# PHYSFS_FOUND, if false, do not try to link to PHYSFS +# PHYSFS_INCLUDE_DIR, where to find physfs.h # # $PHYSFSDIR is an environment variable that would # correspond to the ./configure --prefix=$PHYSFSDIR # used in building PHYSFS. # -# Created by Eric Wing. This was influenced by the FindSDL.cmake -# module, but with modifications to recognize OS X frameworks. +# Created by Eric Wing. -# On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of -# PHYSFS_LIBRARY to override this selection. - -FIND_PATH(PHYSFS_INCLUDE_DIR NAMES physfs.h - PATH_SUFFIXES physfs +FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h PATHS - $ENV{PHYSFSDIR}/include - ~/Library/Frameworks/PhysFS.framework/Headers - /Library/Frameworks/PhysFS.framework/Headers - ) - -# I'm not sure if I should do a special casing for Apple. It is -# unlikely that other Unix systems will find the framework path. -# But if they do ([Next|Open|GNU]Step?), -# do they want the -framework option also? -IF(${PHYSFS_INCLUDE_DIR} MATCHES ".framework") - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" PHYSFS_FRAMEWORK_PATH_TMP ${PHYSFS_INCLUDE_DIR}) - IF("${PHYSFS_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${PHYSFS_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is in default search path, don't need to use -F - SET(PHYSFS_LIBRARY "-framework PhysFS" CACHE STRING "PhysFS framework for OSX") - ELSE("${PHYSFS_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${PHYSFS_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is not /Library/Frameworks, need to use -F - SET(PHYSFS_LIBRARY "-F${PHYSFS_FRAMEWORK_PATH_TMP} -framework PhysFS" CACHE STRING "PhysFS framework for OSX") - ENDIF("${PHYSFS_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${PHYSFS_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(PHYSFS_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") + $ENV{PHYSFSDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + PATH_SUFFIXES include/physfs include +) -ELSE(${PHYSFS_INCLUDE_DIR} MATCHES ".framework") - FIND_LIBRARY(PHYSFS_LIBRARY - NAMES physfs PhysFS - PATHS - $ENV{PHYSFSDIR}/lib - ) +FIND_LIBRARY(PHYSFS_LIBRARY + NAMES physfs + PATHS + $ENV{PHYSFSDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(PHYSFS_LIBRARY + NAMES physfs + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(PHYSFS_LIBRARY + NAMES physfs + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) -ENDIF(${PHYSFS_INCLUDE_DIR} MATCHES ".framework") +SET(PHYSFS_FOUND "NO") +IF(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR) + SET(PHYSFS_FOUND "YES") +ENDIF(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR) -# handle the QUIETLY and REQUIRED arguments and set PHYSFS_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake new file mode 100644 index 0000000..0fd5363 --- /dev/null +++ b/Modules/FindProducer.cmake @@ -0,0 +1,91 @@ +# Though Producer isn't directly part of OpenSceneGraph, its primary user +# is OSG so I consider this part of the Findosg* suite used to find +# OpenSceneGraph components. You'll notice that I accept OSGDIR as an +# environment path. +# +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL (and OpenThreads?) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate Producer +# This module defines +# PRODUCER_LIBRARY +# PRODUCER_FOUND, if false, do not try to link to Producer +# PRODUCER_INCLUDE_DIR, where to find the headers +# +# $PRODUCER_DIR is an environment variable that would +# correspond to the ./configure --prefix=$PRODUCER_DIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <Producer/CameraGroup> + +# Try the user's environment request before anything else. +FIND_PATH(PRODUCER_INCLUDE_DIR Producer/CameraGroup + PATHS + $ENV{PRODUCER_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(PRODUCER_INCLUDE_DIR Producer/CameraGroup + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(PRODUCER_INCLUDE_DIR Producer/CameraGroup + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local/include + /usr/include + /sw/include # Fink + /opt/local/include # DarwinPorts + /opt/csw/include # Blastwave + /opt/include + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT]/include + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include +) + +FIND_LIBRARY(PRODUCER_LIBRARY + NAMES Producer + PATHS + $ENV{PRODUCER_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(PRODUCER_LIBRARY + NAMES Producer + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(PRODUCER_LIBRARY + NAMES Producer + PATHS + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(PRODUCER_FOUND "NO") +IF(PRODUCER_LIBRARY AND PRODUCER_INCLUDE_DIR) + SET(PRODUCER_FOUND "YES") +ENDIF(PRODUCER_LIBRARY AND PRODUCER_INCLUDE_DIR) + + diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake new file mode 100644 index 0000000..17ae700 --- /dev/null +++ b/Modules/FindQuickTime.cmake @@ -0,0 +1,49 @@ +# Locate QuickTime +# This module defines +# QUICKTIME_LIBRARY +# QUICKTIME_FOUND, if false, do not try to link to gdal +# QUICKTIME_INCLUDE_DIR, where to find the headers +# +# $QUICKTIME_DIR is an environment variable that would +# correspond to the ./configure --prefix=$QUICKTIME_DIR +# +# Created by Eric Wing. + +# QuickTime on OS X looks different than QuickTime for Windows, +# so I am going to case the two. + +IF(APPLE) + FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime/QuickTime.h) + FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime) +ELSE(APPLE) + FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime.h + $ENV{QUICKTIME_DIR}/include + $ENV{QUICKTIME_DIR} + NO_DEFAULT_PATH + ) + FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include + ) + FIND_PATH(QUICKTIME_INCLUDE_DIR QuickTime.h) + + FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime + $ENV{QUICKTIME_DIR}/lib + $ENV{QUICKTIME_DIR} + NO_DEFAULT_PATH + ) + FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib + ) + FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime) +ENDIF(APPLE) + +SET(QUICKTIME_FOUND "NO") +IF(QUICKTIME_LIBRARY AND QUICKTIME_INCLUDE_DIR) + SET(QUICKTIME_FOUND "YES") +ENDIF(QUICKTIME_LIBRARY AND QUICKTIME_INCLUDE_DIR) + + diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 9f2bf33..c25e13c 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -1,19 +1,40 @@ -# - Locate the SDL library +# Locate SDL library # This module defines -# SDL_LIBRARY, the library to link against -# SDL_FOUND, if false, do not try to link to SDL -# SDL_INCLUDE_DIR, where to find SDL.h +# SDL_LIBRARY, the name of the library to link against +# SDL_FOUND, if false, do not try to link to SDL +# SDL_INCLUDE_DIR, where to find SDL.h +# +# This module responds to the the flag: +# SDL_BUILDING_LIBRARY +# If this is defined, then no SDL_main will be linked in because +# only applications need main(). +# Otherwise, it is assumed you are building an application and this +# module will attempt to locate and set the the proper link flags +# as part of the returned SDL_LIBRARY variable. # # Don't forget to include SDLmain.h and SDLmain.m your project for the # OS X framework based version. (Other versions link to -lSDLmain which # this module will try to find on your behalf.) Also for OS X, this # module will automatically add the -framework Cocoa on your behalf. +# +# +# Additional Note: If you see an empty SDL_LIBRARY_TEMP in your configuration +# and no SDL_LIBRARY, it means CMake did not find your SDL library +# (SDL.dll, libsdl.so, SDL.framework, etc). +# Set SDL_LIBRARY_TEMP to point to your SDL library, and configure again. +# Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this value +# as appropriate. These values are used to generate the final SDL_LIBRARY +# variable, but when these values are unset, SDL_LIBRARY does not get created. +# +# # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR # used in building SDL. # l.e.galup 9-20-02 # # Modified by Eric Wing. +# Added code to assist with automated building by using environmental variables +# and providing a more controlled/consistent search behavior. # Added new modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). # Also corrected the header search path to follow "proper" SDL guidelines. @@ -23,69 +44,109 @@ # # On OSX, this will prefer the Framework version (if found) over others. # People will have to manually change the cache values of -# SDL_LIBRARY to override this selection. +# SDL_LIBRARY to override this selection or set the CMake environment +# CMAKE_INCLUDE_PATH to modify the search paths. # # Note that the header path has changed from SDL/SDL.h to just SDL.h # This needed to change because "proper" SDL convention # is #include "SDL.h", not <SDL/SDL.h>. This is done for portability # reasons because not all systems place things in SDL/ (see FreeBSD). -FIND_PATH(SDL_INCLUDE_DIR NAMES SDL.h - PATH_SUFFIXES SDL SDL12 SDL11 +FIND_PATH(SDL_INCLUDE_DIR SDL.h + PATHS + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(SDL_INCLUDE_DIR SDL.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(SDL_INCLUDE_DIR SDL.h + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local/include/SDL + /usr/include/SDL + /usr/local/include/SDL12 + /usr/local/include/SDL11 # FreeBSD ports + /usr/include/SDL12 + /usr/include/SDL11 + /usr/local/include + /usr/include + /sw/include/SDL # Fink + /sw/include + /opt/local/include/SDL # DarwinPorts + /opt/local/include + /opt/csw/include/SDL # Blastwave + /opt/csw/include + /opt/include/SDL + /opt/include +) +#MESSAGE("SDL_INCLUDE_DIR is ${SDL_INCLUDE_DIR}") + +# SDL-1.1 is the name used by FreeBSD ports... +# don't confuse it for the version number. +FIND_LIBRARY(SDL_LIBRARY_TEMP + NAMES SDL SDL-1.1 + PATHS + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDL_LIBRARY_TEMP + NAMES SDL SDL-1.1 + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDL_LIBRARY_TEMP + NAMES SDL SDL-1.1 PATHS - $ENV{SDLDIR}/include - ~/Library/Frameworks/SDL.framework/Headers - /Library/Frameworks/SDL.framework/Headers - ) + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) -# I'm not sure if I should do a special casing for Apple. It is -# unlikely that other Unix systems will find the framework path. -# But if they do ([Next|Open|GNU]Step?), -# do they want the -framework option also? -IF(${SDL_INCLUDE_DIR} MATCHES ".framework") - # The Cocoa framework must be linked into SDL because SDL is Cocoa based. - # Remember that the OS X framework version expects you to drop in - # SDLmain.h and SDLmain.m directly into your project. - # (Cocoa link moved to bottom of this script.) - # SET (SDL_LIBRARY "-framework SDL -framework Cocoa" CACHE STRING "SDL framework for OSX") - # SET(SDL_LIBRARY "-framework SDL" CACHE STRING "SDL framework for OSX") - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" SDL_FRAMEWORK_PATH_TEMP ${SDL_INCLUDE_DIR}) - IF("${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is in default search path, don't need to use -F - SET(SDL_LIBRARY_TEMP "-framework SDL") - ELSE("${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is not /Library/Frameworks, need to use -F - SET(SDL_LIBRARY_TEMP "-F${SDL_FRAMEWORK_PATH_TEMP} -framework SDL") - ENDIF("${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(SDL_FRAMEWORK_PATH_TEMP "" CACHE INTERNAL "") +#MESSAGE("SDL_LIBRARY_TEMP is ${SDL_LIBRARY_TEMP}") -ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework") - # SDL-1.1 is the name used by FreeBSD ports... - # don't confuse it for the version number. - FIND_LIBRARY(SDL_LIBRARY_TEMP - NAMES SDL SDL-1.1 - PATHS - $ENV{SDLDIR}/lib +IF(NOT SDL_BUILDING_LIBRARY) + IF(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework") + # Non-OS X framework versions expect you to also dynamically link to + # SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms + # seem to provide SDLmain for compatibility even though they don't + # necessarily need it. + FIND_LIBRARY(SDLMAIN_LIBRARY + NAMES SDLmain SDLmain-1.1 + PATHS + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib ) - - # Non-OS X framework versions expect you to also dynamically link to - # SDLmain. This is mainly for Windows and OS X. Other platforms - # seem to provide SDLmain for compatibility even though they don't - # necessarily need it. - FIND_LIBRARY(SDLMAIN_LIBRARY - NAMES SDLmain SDLmain-1.1 - PATHS - $ENV{SDLDIR}/lib + FIND_LIBRARY(SDLMAIN_LIBRARY + NAMES SDLmain SDLmain-1.1 + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib + ) + FIND_LIBRARY(SDLMAIN_LIBRARY + NAMES SDLmain SDLmain-1.1 + PATHS + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib ) -ENDIF(${SDL_INCLUDE_DIR} MATCHES ".framework") + ENDIF(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework") +ENDIF(NOT SDL_BUILDING_LIBRARY) # SDL may require threads on your system. # The Apple build may not need an explicit flag because one of the @@ -102,23 +163,27 @@ IF(MINGW) SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") ENDIF(MINGW) +SET(SDL_FOUND "NO") IF(SDL_LIBRARY_TEMP) # For SDLmain - IF(SDLMAIN_LIBRARY) - SET(SDL_LIBRARY_TEMP ${SDLMAIN_LIBRARY} ${SDL_LIBRARY_TEMP}) - ENDIF(SDLMAIN_LIBRARY) + IF(NOT SDL_BUILDING_LIBRARY) + IF(SDLMAIN_LIBRARY) + SET(SDL_LIBRARY_TEMP ${SDLMAIN_LIBRARY} ${SDL_LIBRARY_TEMP}) + ENDIF(SDLMAIN_LIBRARY) + ENDIF(NOT SDL_BUILDING_LIBRARY) # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa. # CMake doesn't display the -framework Cocoa string in the UI even - # though it actually is there. I think it has something to do - # with the CACHE STRING. Maybe somebody else knows how to fix this. - # The problem is mainly cosmetic, and not a functional issue. + # though it actually is there if I modify a pre-used variable. + # I think it has something to do with the CACHE STRING. + # So I use a temporary variable until the end so I can set the + # "real" variable in one-shot. IF(APPLE) SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa") ENDIF(APPLE) - + # For threads, as mentioned Apple doesn't need this. - # In fact, there seems to be a problem if Find the threads package + # In fact, there seems to be a problem if I used the Threads package # and try using this line, so I'm just skipping it entirely for OS X. IF(NOT APPLE) SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) @@ -131,12 +196,11 @@ IF(SDL_LIBRARY_TEMP) # Set the final string here so the GUI reflects the final state. SET(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found") + # Set the temp variable to INTERNAL so it is not seen in the CMake GUI + SET(SDL_LIBRARY_TEMP "" CACHE INTERNAL "") + SET(SDL_FOUND "YES") ENDIF(SDL_LIBRARY_TEMP) -# handle the QUIETLY and REQUIRED arguments and set SDL_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL DEFAULT_MSG SDL_LIBRARY_TEMP) +#MESSAGE("SDL_LIBRARY is ${SDL_LIBRARY}") -MARK_AS_ADVANCED(SDL_LIBRARY_TEMP) diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake index 4cef461..e1680ea 100644 --- a/Modules/FindSDL_image.cmake +++ b/Modules/FindSDL_image.cmake @@ -1,8 +1,8 @@ -# - Locate SDL_image library +# Locate SDL_image library # This module defines -# SDLIMAGE_LIBRARY, the library to link against -# SDLIMAGE_FOUND, if false, do not try to link to SDL -# SDLIMAGE_INCLUDE_DIR, where to find SDL/SDL.h +# SDLIMAGE_LIBRARY, the name of the library to link against +# SDLIMAGE_FOUND, if false, do not try to link to SDL +# SDLIMAGE_INCLUDE_DIR, where to find SDL/SDL.h # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR @@ -12,14 +12,22 @@ # module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). -# On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of -# SDLIMAGE_LIBRARY to override this selection. FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h - $ENV{SDLIMAGEDIR}/include - $ENV{SDLDIR}/include - ~/Library/Frameworks/SDL_image.framework/Headers - /Library/Frameworks/SDL_image.framework/Headers + PATHS + $ENV{SDLIMAGEDIR} + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h + PATHS + ~/Library/Frameworks + /Library/Frameworks /usr/local/include/SDL /usr/include/SDL /usr/local/include/SDL12 @@ -36,47 +44,38 @@ FIND_PATH(SDLIMAGE_INCLUDE_DIR SDL_image.h /opt/csw/include /opt/include/SDL /opt/include - ) -# I'm not sure if I should do a special casing for Apple. It is -# unlikely that other Unix systems will find the framework path. -# But if they do ([Next|Open|GNU]Step?), -# do they want the -framework option also? -IF(${SDLIMAGE_INCLUDE_DIR} MATCHES ".framework") - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" SDLIMAGE_FRAMEWORK_PATH_TEMP ${SDLIMAGE_INCLUDE_DIR}) - IF("${SDLIMAGE_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLIMAGE_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is in default search path, don't need to use -F - SET(SDLIMAGE_LIBRARY "-framework SDL_image" CACHE STRING "SDL_image framework for OSX") - ELSE("${SDLIMAGE_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLIMAGE_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is not /Library/Frameworks, need to use -F - SET(SDLIMAGE_LIBRARY "-F${SDLIMAGE_FRAMEWORK_PATH_TEMP} -framework SDL_image" CACHE STRING "SDL_image framework for OSX") - ENDIF("${SDLIMAGE_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLIMAGE_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(SDLIMAGE_FRAMEWORK_PATH_TEMP "" CACHE INTERNAL "") +) -ELSE(${SDLIMAGE_INCLUDE_DIR} MATCHES ".framework") - FIND_LIBRARY(SDLIMAGE_LIBRARY - NAMES SDL_image - PATHS - $ENV{SDLIMAGEDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) -ENDIF(${SDLIMAGE_INCLUDE_DIR} MATCHES ".framework") +FIND_LIBRARY(SDLIMAGE_LIBRARY + NAMES SDL_image + PATHS + $ENV{SDLIMAGEDIR} + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDLIMAGE_LIBRARY + NAMES SDL_image + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDLIMAGE_LIBRARY + NAMES SDL_image + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) SET(SDLIMAGE_FOUND "NO") -IF(SDLIMAGE_LIBRARY) +IF(SDLIMAGE_LIBRARY AND SDLIMAGE_INCLUDE_DIR) SET(SDLIMAGE_FOUND "YES") -ENDIF(SDLIMAGE_LIBRARY) +ENDIF(SDLIMAGE_LIBRARY AND SDLIMAGE_INCLUDE_DIR) diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake index bea993d..a1a5423 100644 --- a/Modules/FindSDL_mixer.cmake +++ b/Modules/FindSDL_mixer.cmake @@ -1,8 +1,8 @@ -# - Locate the SDL_mixer library +# Locate SDL_mixer library # This module defines -# SDLMIXER_LIBRARY, library to link against -# SDLMIXER_FOUND, if false, do not try to link to SDL -# SDLMIXER_INCLUDE_DIR, where to find SDL/SDL.h +# SDLMIXER_LIBRARY, the name of the library to link against +# SDLMIXER_FOUND, if false, do not try to link to SDL +# SDLMIXER_INCLUDE_DIR, where to find SDL/SDL.h # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR @@ -12,14 +12,22 @@ # module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). -# On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of -# SDLMIXER_LIBRARY to override this selection. FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h - $ENV{SDLMIXERDIR}/include - $ENV{SDLDIR}/include - ~/Library/Frameworks/SDL_mixer.framework/Headers - /Library/Frameworks/SDL_mixer.framework/Headers + PATHS + $ENV{SDLMIXERDIR} + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h + PATHS + ~/Library/Frameworks + /Library/Frameworks /usr/local/include/SDL /usr/include/SDL /usr/local/include/SDL12 @@ -36,47 +44,38 @@ FIND_PATH(SDLMIXER_INCLUDE_DIR SDL_mixer.h /opt/csw/include /opt/include/SDL /opt/include - ) -# I'm not sure if I should do a special casing for Apple. It is -# unlikely that other Unix systems will find the framework path. -# But if they do ([Next|Open|GNU]Step?), -# do they want the -framework option also? -IF(${SDLMIXER_INCLUDE_DIR} MATCHES ".framework") - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" SDLMIXER_FRAMEWORK_PATH_TEMP ${SDLMIXER_INCLUDE_DIR}) - IF("${SDLMIXER_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLMIXER_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is in default search path, don't need to use -F - SET(SDLMIXER_LIBRARY "-framework SDL_mixer" CACHE STRING "SDL_mixer framework for OSX") - ELSE("${SDLMIXER_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLMIXER_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is not /Library/Frameworks, need to use -F - SET(SDLMIXER_LIBRARY "-F${SDLMIXER_FRAMEWORK_PATH_TEMP} -framework SDL_mixer" CACHE STRING "SDL_mixer framework for OSX") - ENDIF("${SDLMIXER_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLMIXER_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(SDLMIXER_FRAMEWORK_PATH_TEMP "" CACHE INTERNAL "") +) -ELSE(${SDLMIXER_INCLUDE_DIR} MATCHES ".framework") - FIND_LIBRARY(SDLMIXER_LIBRARY - NAMES SDL_mixer - PATHS - $ENV{SDLMIXERDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) -ENDIF(${SDLMIXER_INCLUDE_DIR} MATCHES ".framework") +FIND_LIBRARY(SDLMIXER_LIBRARY + NAMES SDL_mixer + PATHS + $ENV{SDLMIXERDIR} + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDLMIXER_LIBRARY + NAMES SDL_mixer + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDLMIXER_LIBRARY + NAMES SDL_mixer + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) SET(SDLMIXER_FOUND "NO") -IF(SDLMIXER_LIBRARY) +IF(SDLMIXER_LIBRARY AND SDLMIXER_INCLUDE_DIR) SET(SDLMIXER_FOUND "YES") -ENDIF(SDLMIXER_LIBRARY) +ENDIF(SDLMIXER_LIBRARY AND SDLMIXER_INCLUDE_DIR) diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake index de4d533..eebc8de 100644 --- a/Modules/FindSDL_net.cmake +++ b/Modules/FindSDL_net.cmake @@ -1,24 +1,34 @@ -# - Locate the SDL_net library +# Locate SDL_net library # This module defines -# SDLNET_LIBRARY, the library to link against -# SDLNET_FOUND, if false, do not try to link against -# SDLNET_INCLUDE_DIR, where to find the headers -# +# SDLNET_LIBRARY, the name of the library to link against +# SDLNET_FOUND, if false, do not try to link against +# SDLNET_INCLUDE_DIR, where to find the headers +# # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR # used in building SDL. -# +# # Created by Eric Wing. This was influenced by the FindSDL.cmake # module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). -# On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of -# SDLNET_LIBRARY to override this selection. + + +FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h + PATHS + $ENV{SDLNETDIR} + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h - $ENV{SDLNETDIR}/include - $ENV{SDLDIR}/include - ~/Library/Frameworks/SDL_net.framework/Headers - /Library/Frameworks/SDL_net.framework/Headers + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h + PATHS + ~/Library/Frameworks + /Library/Frameworks /usr/local/include/SDL /usr/include/SDL /usr/local/include/SDL12 @@ -35,47 +45,37 @@ FIND_PATH(SDLNET_INCLUDE_DIR SDL_net.h /opt/csw/include /opt/include/SDL /opt/include - ) -# I'm not sure if I should do a special casing for Apple. It is -# unlikely that other Unix systems will find the framework path. -# But if they do ([Next|Open|GNU]Step?), -# do they want the -framework option also? -IF(${SDLNET_INCLUDE_DIR} MATCHES ".framework") - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" SDLNET_FRAMEWORK_PATH_TEMP ${SDLNET_INCLUDE_DIR}) - IF("${SDLNET_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLNET_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is in default search path, don't need to use -F - SET(SDLNET_LIBRARY "-framework SDL_net" CACHE STRING "SDL_net framework for OSX") - ELSE("${SDLNET_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLNET_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is not /Library/Frameworks, need to use -F - SET(SDLNET_LIBRARY "-F${SDLNET_FRAMEWORK_PATH_TEMP} -framework SDL_net" CACHE STRING "SDL_net framework for OSX") - ENDIF("${SDLNET_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLNET_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(SDLNET_FRAMEWORK_PATH_TEMP "" CACHE INTERNAL "") - -ELSE(${SDLNET_INCLUDE_DIR} MATCHES ".framework") - FIND_LIBRARY(SDLNET_LIBRARY - NAMES SDL_net - PATHS - $ENV{SDLNET}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) -ENDIF(${SDLNET_INCLUDE_DIR} MATCHES ".framework") +) +FIND_LIBRARY(SDLNET_LIBRARY + NAMES SDL_net + PATHS + $ENV{SDLNETDIR} + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDLNET_LIBRARY + NAMES SDL_net + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDLNET_LIBRARY + NAMES SDL_net + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) SET(SDLNET_FOUND "NO") -IF(SDLNET_LIBRARY) +IF(SDLNET_LIBRARY AND SDLNET_INCLUDE_DIR) SET(SDLNET_FOUND "YES") -ENDIF(SDLNET_LIBRARY) +ENDIF(SDLNET_LIBRARY AND SDLNET_INCLUDE_DIR) diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 62be3ee..64a0d5f 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -1,7 +1,8 @@ -# - Locates the SDL_sound library +# Locates the SDL_sound library + # This module depends on SDL being found and # must be called AFTER FindSDL.cmake is called. -# + # This module defines # SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h # SDL_SOUND_FOUND, if false, do not try to link to SDL @@ -11,48 +12,48 @@ # flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES. # This is available mostly for cases this module failed to anticipate for # and you must add additional flags. This is marked as ADVANCED. + # # This module also defines (but you shouldn't need to use directly) # SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link # against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one. # And might define the following as needed -# MIKMOD_LIBRARY -# MODPLUG_LIBRARY -# OGG_LIBRARY -# VORBIS_LIBRARY -# SMPEG_LIBRARY -# FLAC_LIBRARY -# SPEEX_LIBRARY +# MIKMOD_LIBRARY +# MODPLUG_LIBRARY +# OGG_LIBRARY +# VORBIS_LIBRARY +# SMPEG_LIBRARY +# FLAC_LIBRARY +# SPEEX_LIBRARY # -# Typically, you should not use these variables directly, and you should use -# SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio -# libraries (if needed) to successfully compile on your system . +# Typically, you should not use these variables directly, and you should use +# SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio libraries +# (if needed) to successfully compile on your system . # # Created by Eric Wing. +# This module is a bit more complicated than the other FindSDL* family modules. +# The reason is that SDL_sound can be compiled in a large variety of different ways +# which are independent of platform. SDL_sound may dynamically link against other 3rd +# party libraries to get additional codec support, such as Ogg Vorbis, SMPEG, ModPlug, +# MikMod, FLAC, Speex, and potentially others. +# Under some circumstances which I don't fully understand, +# there seems to be a requirement +# that dependent libraries of libraries you use must also be explicitly +# linked against in order to successfully compile. SDL_sound does not currently +# have any system in place to know how it was compiled. +# So this CMake module does the hard work in trying to discover which 3rd party +# libraries are required for building (if any). +# This module uses a brute force approach to create a test program that uses SDL_sound, +# and then tries to build it. If the build fails, it parses the error output for +# known symbol names to figure out which libraries are needed. # -# This module is a bit more complicated than the other FindSDL* family -# modules. The reason is that SDL_sound can be compiled in a large variety -# of different ways which are independent of platform. SDL_sound may -# dynamically link against other 3rd party libraries to get additional codec -# support, such as Ogg Vorbis, SMPEG, ModPlug, MikMod, FLAC, Speex, and -# potentially others. Under some circumstances which I don't fully -# understand, there seems to be a requirement that dependent libraries of -# libraries you use must also be explicitly linked against in order to -# successfully compile. SDL_sound does not currently have any system in place -# to know how it was compiled. So this CMake module does the hard work in -# trying to discover which 3rd party libraries are required for building (if -# any). -# -# This module uses a brute force approach to create a test program that uses -# SDL_sound, and then tries to build it. If the build fails, it parses the -# error output for known symbol names to figure out which libraries are -# needed. Responds to the $SDLDIR and $SDLSOUNDDIR environmental variable -# that would correspond to the ./configure --prefix=$SDLDIR used in building -# SDL. +# Responds to the $SDLDIR and $SDLSOUNDDIR environmental variable that would +# correspond to the ./configure --prefix=$SDLDIR used in building SDL. # # On OSX, this will prefer the Framework version (if found) over others. # People will have to manually change the cache values of -# SDL_LIBRARY to override this selection. +# SDL_LIBRARY to override this selectionor set the CMake environment +# CMAKE_INCLUDE_PATH to modify the search paths. # @@ -62,9 +63,15 @@ MARK_AS_ADVANCED(SDL_SOUND_EXTRAS) # Find SDL_sound.h FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h $ENV{SDLSOUNDDIR}/include + $ENV{SDLSOUNDDIR} $ENV{SDLDIR}/include - ~/Library/Frameworks/SDL_sound.framework/Headers - /Library/Frameworks/SDL_sound.framework/Headers # OS X + $ENV{SDLDIR} + NO_DEFAULT_PATH +) +FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h + NO_DEFAULT_PATH +) +FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h /usr/local/include/SDL /usr/include/SDL /usr/local/include/SDL12 @@ -82,40 +89,21 @@ FIND_PATH(SDL_SOUND_INCLUDE_DIR SDL_sound.h /opt/include/SDL /opt/include ) -# Find the SDL_sound library -IF(${SDL_SOUND_INCLUDE_DIR} MATCHES ".framework") - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" SDL_SOUND_FRAMEWORK_PATH_TMP ${SDL_SOUND_INCLUDE_DIR}) - IF("${SDL_SOUND_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${SDL_SOUND_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is in default search path, don't need to use -F - SET (SDL_SOUND_LIBRARY "-framework SDL_sound" CACHE STRING "SDL_sound framework for OSX") - ELSE("${SDL_SOUND_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${SDL_SOUND_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is not /Library/Frameworks, need to use -F - SET(SDL_SOUND_LIBRARY "-F${SDL_SOUND_FRAMEWORK_PATH_TMP} -framework SDL_sound" CACHE STRING "SDL_sound framework for OSX") - ENDIF("${SDL_SOUND_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${SDL_SOUND_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(SDL_SOUND_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") -ELSE(${SDL_SOUND_INCLUDE_DIR} MATCHES ".framework") - FIND_LIBRARY(SDL_SOUND_LIBRARY - NAMES SDL_sound - PATHS - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) -ENDIF(${SDL_SOUND_INCLUDE_DIR} MATCHES ".framework") +FIND_LIBRARY(SDL_SOUND_LIBRARY + NAMES SDL_sound + PATHS + $ENV{SDLSOUNDDIR}/lib + $ENV{SDLSOUNDDIR} + $ENV{SDLDIR}/lib + $ENV{SDLDIR} + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + ) SET(SDL_SOUND_FOUND "NO") IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) @@ -147,7 +135,7 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # To minimize external dependencies, create a sdlsound test program # which will be used to figure out if additional link dependencies are # required for the link phase. - FILE(WRITE ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/DetermineSoundLibs.c + FILE(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/DetermineSoundLibs.c "#include \"SDL_sound.h\" #include \"SDL.h\" int main(int argc, char* argv[]) @@ -170,29 +158,42 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) }" ) + # Calling + # TARGET_LINK_LIBRARIES(DetermineSoundLibs "${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) + # causes problems when SDL_LIBRARY looks like + # /Library/Frameworks/SDL.framework;-framework Cocoa + # The ;-framework Cocoa seems to be confusing CMake once the OS X + # framework support was added. I was told that breaking up the list + # would fix the problem. + SET(TMP_TRY_LIBS) + FOREACH(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) + SET(TMP_TRY_LIBS "${TMP_TRY_LIBS} \"${lib}\"") + ENDFOREACH(lib) + # MESSAGE("TMP_TRY_LIBS ${TMP_TRY_LIBS}") + # Write the CMakeLists.txt and test project # Weird, this is still sketchy. If I don't quote the variables # in the TARGET_LINK_LIBRARIES, I seem to loose everything # in the SDL_LIBRARY string after the "-framework". # But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work. - FILE(WRITE ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt + FILE(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt "PROJECT(DetermineSoundLibs) INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) ADD_EXECUTABLE(DetermineSoundLibs DetermineSoundLibs.c) - TARGET_LINK_LIBRARIES(DetermineSoundLibs \"${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}\")" + TARGET_LINK_LIBRARIES(DetermineSoundLibs ${TMP_TRY_LIBS})" ) TRY_COMPILE( MY_RESULT - ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp - ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + ${PROJECT_BINARY_DIR}/CMakeTmp + ${PROJECT_BINARY_DIR}/CMakeTmp DetermineSoundLibs OUTPUT_VARIABLE MY_OUTPUT ) - #MESSAGE("${MY_RESULT}") - #MESSAGE(${MY_OUTPUT}) + # MESSAGE("${MY_RESULT}") + # MESSAGE(${MY_OUTPUT}) IF(NOT MY_RESULT) @@ -204,47 +205,22 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # Find MikMod IF("${MY_OUTPUT}" MATCHES "MikMod_") - FIND_FILE(TEMP_SDLSOUND_FIND_MIKMOD_FRAMEWORK - libmikmod-coreaudio - ~/Library/Frameworks/libmikmod-coreaudio.framework - /Library/Frameworks/libmikmod-coreaudio.framework - ) - IF(TEMP_SDLSOUND_FIND_MIKMOD_FRAMEWORK) - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" TEMP_SDLSOUND_MIKMOD_FRAMEWORK_PATH_TMP ${TEMP_SDLSOUND_FIND_MIKMOD_FRAMEWORK}) - IF("${TEMP_SDLSOUND_MIKMOD_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_MIKMOD_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's in the default search path so I don't need to use -F - SET(MIKMOD_LIBRARY "-framework libmikmod-coreaudio" CACHE STRING "MikMod framework for OSX") - ELSE("${TEMP_SDLSOUND_MIKMOD_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_MIKMOD_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's not in the default search path so I need to use -F - SET(MIKMOD_LIBRARY "-F${TEMP_SDLSOUND_MIKMOD_FRAMEWORK_PATH_TMP} -framework libmikmod-coreaudio" CACHE STRING "MikMod framework for OSX") - ENDIF("${TEMP_SDLSOUND_MIKMOD_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_MIKMOD_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_MIKMOD_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") - - ELSE(TEMP_SDLSOUND_FIND_MIKMOD_FRAMEWORK) - FIND_LIBRARY(MIKMOD_LIBRARY - NAMES mikmod - PATHS - $ENV{MIKMODDIR}/lib - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) - ENDIF(TEMP_SDLSOUND_FIND_MIKMOD_FRAMEWORK) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_FIND_MIKMOD_FRAMEWORK "" CACHE INTERNAL "") + FIND_LIBRARY(MIKMOD_LIBRARY + NAMES libmikmod-coreaudio mikmod + PATHS + $ENV{MIKMODDIR}/lib + $ENV{MIKMODDIR} + $ENV{SDLSOUNDDIR}/lib + $ENV{SDLSOUNDDIR} + $ENV{SDLDIR}/lib + $ENV{SDLDIR} + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + ) IF(MIKMOD_LIBRARY) SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY}) ENDIF(MIKMOD_LIBRARY) @@ -252,48 +228,22 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # Find ModPlug IF("${MY_OUTPUT}" MATCHES "MODPLUG_") - FIND_FILE(TEMP_SDLSOUND_FIND_MODPLUG_FRAMEWORK - modplug - ~/Library/Frameworks/modplug.framework - /Library/Frameworks/modplug.framework - ) - IF(TEMP_SDLSOUND_FIND_MODPLUG_FRAMEWORK) - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" TEMP_SDLSOUND_MODPLUG_FRAMEWORK_PATH_TMP ${TEMP_SDLSOUND_FIND_MODPLUG_FRAMEWORK}) - MESSAGE("HELLO") - IF("${TEMP_SDLSOUND_MODPLUG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_MODPLUG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's in the default search path so I don't need to use -F - SET(MODPLUG_LIBRARY "-framework modplug" CACHE STRING "MODPLUG framework for OSX") - ELSE("${TEMP_SDLSOUND_MODPLUG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_MODPLUG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's not in the default search path so I need to use -F - SET(MODPLUG_LIBRARY "-F${TEMP_SDLSOUND_MODPLUG_FRAMEWORK_PATH_TMP} -framework modplug" CACHE STRING "MODPLUG framework for OSX") - ENDIF("${TEMP_SDLSOUND_MODPLUG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_MODPLUG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_MODPLUG_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") - - ELSE(TEMP_SDLSOUND_FIND_MODPLUG_FRAMEWORK) - FIND_LIBRARY(MODPLUG_LIBRARY - NAMES modplug - PATHS - $ENV{MODPLUGDIR}/lib - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) - ENDIF(TEMP_SDLSOUND_FIND_MODPLUG_FRAMEWORK) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_FIND_MODPLUG_FRAMEWORK "" CACHE INTERNAL "") + FIND_LIBRARY(MODPLUG_LIBRARY + NAMES modplug + PATHS + $ENV{MODPLUGDIR}/lib + $ENV{MODPLUGDIR} + $ENV{SDLSOUNDDIR}/lib + $ENV{SDLSOUNDDIR} + $ENV{SDLDIR}/lib + $ENV{SDLDIR} + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + ) IF(MODPLUG_LIBRARY) SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MODPLUG_LIBRARY}) ENDIF(MODPLUG_LIBRARY) @@ -302,94 +252,47 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # Find Ogg and Vorbis IF("${MY_OUTPUT}" MATCHES "ov_") - FIND_FILE(TEMP_SDLSOUND_FIND_VORBIS_FRAMEWORK - Vorbis - ~/Library/Frameworks/Vorbis.framework - /Library/Frameworks/Vorbis.framework + FIND_LIBRARY(VORBIS_LIBRARY + NAMES vorbis Vorbis VORBIS + PATHS + $ENV{VORBISDIR}/lib + $ENV{VORBISDIR} + $ENV{OGGDIR}/lib + $ENV{OGGDIR} + $ENV{SDLSOUNDDIR}/lib + $ENV{SDLSOUNDDIR} + $ENV{SDLDIR}/lib + $ENV{SDLDIR} + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib ) - IF(TEMP_SDLSOUND_FIND_VORBIS_FRAMEWORK) - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" TEMP_SDLSOUND_VORBIS_FRAMEWORK_PATH_TMP ${TEMP_SDLSOUND_FIND_VORBIS_FRAMEWORK}) - IF("${TEMP_SDLSOUND_VORBIS_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_VORBIS_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's in the default search path so I don't need to use -F - SET(VORBIS_LIBRARY "-framework Vorbis" CACHE STRING "Vorbis framework for OSX") - ELSE("${TEMP_SDLSOUND_VORBIS_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_VORBIS_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's not in the default search path so I need to use -F - SET(VORBIS_LIBRARY "-F${TEMP_SDLSOUND_VORBIS_FRAMEWORK_PATH_TMP} -framework Vorbis" CACHE STRING "Vorbis framework for OSX") - ENDIF("${TEMP_SDLSOUND_VORBIS_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_VORBIS_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_VORBIS_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") - - ELSE(TEMP_SDLSOUND_FIND_VORBIS_FRAMEWORK) - FIND_LIBRARY(VORBIS_LIBRARY - NAMES vorbis Vorbis VORBIS - PATHS - $ENV{VORBISDIR}/lib - $ENV{OGGDIR}/lib - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) - ENDIF(TEMP_SDLSOUND_FIND_VORBIS_FRAMEWORK) - # Clear the temp variable so nobody can see it SET(TEMP_SDLSOUND_FIND_VORBIS_FRAMEWORK "" CACHE INTERNAL "") IF(VORBIS_LIBRARY) SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY}) ENDIF(VORBIS_LIBRARY) - FIND_FILE(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK - Ogg - ~/Library/Frameworks/Ogg.framework - /Library/Frameworks/Ogg.framework + FIND_LIBRARY(OGG_LIBRARY + NAMES ogg Ogg OGG + PATHS + $ENV{OGGDIR}/lib + $ENV{OGGDIR} + $ENV{VORBISDIR}/lib + $ENV{VORBISDIR} + $ENV{SDLSOUNDDIR}/lib + $ENV{SDLSOUNDDIR} + $ENV{SDLDIR}/lib + $ENV{SDLDIR} + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib ) - IF(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK) - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP ${TEMP_SDLSOUND_FIND_OGG_FRAMEWORK}) - IF("${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's in the default search path so I don't need to use -F - SET(OGG_LIBRARY "-framework Ogg" CACHE STRING "Ogg framework for OSX") - ELSE("${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's not in the default search path so I need to use -F - SET(OGG_LIBRARY "-F${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP} -framework Ogg" CACHE STRING "Ogg framework for OSX") - ENDIF("${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") - - ELSE(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK) - FIND_LIBRARY(OGG_LIBRARY - NAMES ogg Ogg OGG - PATHS - $ENV{OGGDIR}/lib - $ENV{VORBISDIR}/lib - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) - ENDIF(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK "" CACHE INTERNAL "") IF(OGG_LIBRARY) SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) ENDIF(OGG_LIBRARY) @@ -398,47 +301,22 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # Find SMPEG IF("${MY_OUTPUT}" MATCHES "SMPEG_") - FIND_FILE(TEMP_SDLSOUND_FIND_SMPEG_FRAMEWORK - SMPEG - ~/Library/Frameworks/smpeg.framework - /Library/Frameworks/smpeg.framework + FIND_LIBRARY(SMPEG_LIBRARY + NAMES smpeg SMPEG Smpeg SMpeg + PATHS + $ENV{SMPEGDIR}/lib + $ENV{SMPEGDIR} + $ENV{SDLSOUNDDIR}/lib + $ENV{SDLSOUNDDIR} + $ENV{SDLDIR}/lib + $ENV{SDLDIR} + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib ) - IF(TEMP_SDLSOUND_FIND_SMPEG_FRAMEWORK) - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" TEMP_SDLSOUND_SMPEG_FRAMEWORK_PATH_TMP ${TEMP_SDLSOUND_FIND_SMPEG_FRAMEWORK}) - IF("${TEMP_SDLSOUND_SMPEG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_SMPEG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's in the default search path so I don't need to use -F - SET(SMPEG_LIBRARY "-framework smpeg" CACHE STRING "SMPEG framework for OSX") - ELSE("${TEMP_SDLSOUND_SMPEG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_SMPEG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's not in the default search path so I need to use -F - SET(SMPEG_LIBRARY "-F${TEMP_SDLSOUND_SMPEG_FRAMEWORK_PATH_TMP} -framework smpeg" CACHE STRING "SMPEG framework for OSX") - ENDIF("${TEMP_SDLSOUND_SMPEG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_SMPEG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_SMPEG_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") - - ELSE(TEMP_SDLSOUND_FIND_SMPEG_FRAMEWORK) - FIND_LIBRARY(SMPEG_LIBRARY - NAMES smpeg SMPEG Smpeg SMpeg - PATHS - $ENV{SMPEGDIR}/lib - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) - ENDIF(TEMP_SDLSOUND_FIND_SMPEG_FRAMEWORK) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_FIND_SMPEG_FRAMEWORK "" CACHE INTERNAL "") IF(SMPEG_LIBRARY) SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SMPEG_LIBRARY}) ENDIF(SMPEG_LIBRARY) @@ -447,47 +325,22 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # Find FLAC IF("${MY_OUTPUT}" MATCHES "FLAC_") - FIND_FILE(TEMP_SDLSOUND_FIND_FLAC_FRAMEWORK - FLAC - ~/Library/Frameworks/FLAC.framework - /Library/Frameworks/FLAC.framework + FIND_LIBRARY(FLAC_LIBRARY + NAMES flac FLAC + PATHS + $ENV{FLACDIR}/lib + $ENV{FLACDIR} + $ENV{SDLSOUNDDIR}/lib + $ENV{SDLSOUNDDIR} + $ENV{SDLDIR}/lib + $ENV{SDLDIR} + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib ) - IF(TEMP_SDLSOUND_FIND_FLAC_FRAMEWORK) - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" TEMP_SDLSOUND_FLAC_FRAMEWORK_PATH_TMP ${TEMP_SDLSOUND_FIND_FLAC_FRAMEWORK}) - IF("${TEMP_SDLSOUND_FLAC_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_FLAC_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's in the default search path so I don't need to use -F - SET(FLAC_LIBRARY "-framework FLAC" CACHE STRING "FLAC framework for OSX") - ELSE("${TEMP_SDLSOUND_FLAC_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_FLAC_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's not in the default search path so I need to use -F - SET(FLAC_LIBRARY "-F${TEMP_SDLSOUND_FLAC_FRAMEWORK_PATH_TMP} -framework FLAC" CACHE STRING "FLAC framework for OSX") - ENDIF("${TEMP_SDLSOUND_FLAC_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_FLAC_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_FLAC_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") - - ELSE(TEMP_SDLSOUND_FIND_FLAC_FRAMEWORK) - FIND_LIBRARY(FLAC_LIBRARY - NAMES flac FLAC - PATHS - $ENV{FLACDIR}/lib - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) - ENDIF(TEMP_SDLSOUND_FIND_FLAC_FRAMEWORK) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_FIND_FLAC_FRAMEWORK "" CACHE INTERNAL "") IF(FLAC_LIBRARY) SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${FLAC_LIBRARY}) ENDIF(FLAC_LIBRARY) @@ -499,100 +352,55 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # in the Ogg symbols. I'm not sure if I should duplicate the ogg stuff # above for here or if two ogg entries will screw up things. IF("${MY_OUTPUT}" MATCHES "speex_") - FIND_FILE(TEMP_SDLSOUND_FIND_SPEEX_FRAMEWORK - speex - ~/Library/Frameworks/speex.framework - /Library/Frameworks/speex.framework + FIND_LIBRARY(SPEEX_LIBRARY + NAMES speex SPEEX + PATHS + $ENV{SPEEXDIR}/lib + $ENV{SPEEXDIR} + $ENV{SDLSOUNDDIR}/lib + $ENV{SDLSOUNDDIR} + $ENV{SDLDIR}/lib + $ENV{SDLDIR} + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib ) - IF(TEMP_SDLSOUND_FIND_SPEEX_FRAMEWORK) - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" TEMP_SDLSOUND_SPEEX_FRAMEWORK_PATH_TMP ${TEMP_SDLSOUND_FIND_SPEEX_FRAMEWORK}) - IF("${TEMP_SDLSOUND_SPEEX_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_SPEEX_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's in the default search path so I don't need to use -F - SET(SPEEX_LIBRARY "-framework speex" CACHE STRING "SPEEX framework for OSX") - ELSE("${TEMP_SDLSOUND_SPEEX_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_SPEEX_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's not in the default search path so I need to use -F - SET(SPEEX_LIBRARY "-F${TEMP_SDLSOUND_SPEEX_FRAMEWORK_PATH_TMP} -framework speex" CACHE STRING "SPEEX framework for OSX") - ENDIF("${TEMP_SDLSOUND_SPEEX_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_SPEEX_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_SPEEX_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") - - ELSE(TEMP_SDLSOUND_FIND_SPEEX_FRAMEWORK) - FIND_LIBRARY(SPEEX_LIBRARY - NAMES speex SPEEX - PATHS - $ENV{SPEEXDIR}/lib - $ENV{SDLSOUNDDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) - ENDIF(TEMP_SDLSOUND_FIND_SPEEX_FRAMEWORK) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_FIND_SPEEX_FRAMEWORK "" CACHE INTERNAL "") - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY}) + IF(SPEEX_LIBRARY) + SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY}) + ENDIF(SPEEX_LIBRARY) # Find OGG (needed for Speex) - FIND_FILE(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK - Ogg - ~/Library/Frameworks/Ogg.framework - /Library/Frameworks/Ogg.framework - ) - IF(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK) - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP ${TEMP_SDLSOUND_FIND_OGG_FRAMEWORK}) - IF("${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's in the default search path so I don't need to use -F - SET(OGG_LIBRARY "-framework Ogg" CACHE STRING "Ogg framework for OSX") - ELSE("${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # It's not in the default search path so I need to use -F - SET(OGG_LIBRARY "-F${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP} -framework Ogg" CACHE STRING "Ogg framework for OSX") - ENDIF("${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" - OR "${TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_OGG_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") - - ELSE(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK) + # We might have already found Ogg for Vorbis, so skip it if so. + IF(NOT OGG_LIBRARY) FIND_LIBRARY(OGG_LIBRARY NAMES ogg Ogg OGG PATHS $ENV{OGGDIR}/lib + $ENV{OGGDIR} $ENV{VORBISDIR}/lib + $ENV{VORBISDIR} $ENV{SPEEXDIR}/lib + $ENV{SPEEXDIR} $ENV{SDLSOUNDDIR}/lib + $ENV{SDLSOUNDDIR} $ENV{SDLDIR}/lib + $ENV{SDLDIR} /usr/local/lib /usr/lib /sw/lib /opt/local/lib /opt/csw/lib - /opt/lib + /opt/lib ) - ENDIF(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK) - # Clear the temp variable so nobody can see it - SET(TEMP_SDLSOUND_FIND_OGG_FRAMEWORK "" CACHE INTERNAL "") - IF(OGG_LIBRARY) - SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) - ENDIF(OGG_LIBRARY) + IF(OGG_LIBRARY) + SET(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY}) + ENDIF(OGG_LIBRARY) + ENDIF(NOT OGG_LIBRARY) ENDIF("${MY_OUTPUT}" MATCHES "speex_") - - ELSE(NOT MY_RESULT) SET(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY}" CACHE INTERNAL "SDL_sound and dependent libraries") ENDIF(NOT MY_RESULT) diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake index 39c6207..f77664e 100644 --- a/Modules/FindSDL_ttf.cmake +++ b/Modules/FindSDL_ttf.cmake @@ -1,23 +1,34 @@ -# - Locate SDL_ttf library +# Locate SDL_ttf library # This module defines -# SDLTTF_LIBRARY, the library to link against -# SDLTTF_FOUND, if false, do not try to link to SDL -# SDLTTF_INCLUDE_DIR, where to find SDL/SDL.h -# +# SDLTTF_LIBRARY, the name of the library to link against +# SDLTTF_FOUND, if false, do not try to link to SDL +# SDLTTF_INCLUDE_DIR, where to find SDL/SDL.h +# # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR # used in building SDL. +# # Created by Eric Wing. This was influenced by the FindSDL.cmake # module, but with modifications to recognize OS X frameworks and # additional Unix paths (FreeBSD, etc). -# On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of -# SDLTTF_LIBRARY to override this selection. + + +FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h + PATHS + $ENV{SDLTTFDIR} + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h - $ENV{SDLTTFDIR}/include - $ENV{SDLDIR}/include - ~/Library/Frameworks/SDL_ttf.framework/Headers - /Library/Frameworks/SDL_ttf.framework/Headers + PATHS + ~/Library/Frameworks + /Library/Frameworks /usr/local/include/SDL /usr/include/SDL /usr/local/include/SDL12 @@ -34,47 +45,38 @@ FIND_PATH(SDLTTF_INCLUDE_DIR SDL_ttf.h /opt/csw/include /opt/include/SDL /opt/include - ) -# I'm not sure if I should do a special casing for Apple. It is -# unlikely that other Unix systems will find the framework path. -# But if they do ([Next|Open|GNU]Step?), -# do they want the -framework option also? -IF(${SDLTTF_INCLUDE_DIR} MATCHES ".framework") - # Extract the path the framework resides in so we can use it for the -F flag - STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" SDLTTF_FRAMEWORK_PATH_TEMP ${SDLTTF_INCLUDE_DIR}) - IF("${SDLTTF_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLTTF_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is in default search path, don't need to use -F - SET(SDLTTF_LIBRARY "-framework SDL_ttf" CACHE STRING "SDL_ttf framework for OSX") - ELSE("${SDLTTF_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLTTF_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # String is not /Library/Frameworks, need to use -F - SET(SDLTTF_LIBRARY "-F${SDLTTF_FRAMEWORK_PATH_TEMP} -framework SDL_ttf" CACHE STRING "SDL_ttf framework for OSX") - ENDIF("${SDLTTF_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" - OR "${SDLTTF_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" - ) - # Clear the temp variable so nobody can see it - SET(SDLTTF_FRAMEWORK_PATH_TEMP "" CACHE INTERNAL "") +) -ELSE(${SDLTTF_INCLUDE_DIR} MATCHES ".framework") - FIND_LIBRARY(SDLTTF_LIBRARY - NAMES SDL_ttf - PATHS - $ENV{SDLTTFDIR}/lib - $ENV{SDLDIR}/lib - /usr/local/lib - /usr/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - ) -ENDIF(${SDLTTF_INCLUDE_DIR} MATCHES ".framework") +FIND_LIBRARY(SDLTTF_LIBRARY + NAMES SDL_ttf + PATHS + $ENV{SDLTTFDIR} + $ENV{SDLDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDLTTF_LIBRARY + NAMES SDL_ttf + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(SDLTTF_LIBRARY + NAMES SDL_ttf + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) SET(SDLTTF_FOUND "NO") -IF(SDLTTF_LIBRARY) +IF(SDLTTF_LIBRARY AND SDLTTF_INCLUDE_DIR) SET(SDLTTF_FOUND "YES") -ENDIF(SDLTTF_LIBRARY) +ENDIF(SDLTTF_LIBRARY AND SDLTTF_INCLUDE_DIR) diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake new file mode 100644 index 0000000..53fbfc3 --- /dev/null +++ b/Modules/Findosg.cmake @@ -0,0 +1,88 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osg +# This module defines +# OSG_LIBRARY +# OSG_FOUND, if false, do not try to link to osg +# OSG_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgUtil/SceneView> + +# Try the user's environment request before anything else. +FIND_PATH(OSG_INCLUDE_DIR osg/PositionAttitudeTransform + PATHS + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSG_INCLUDE_DIR osg/PositionAttitudeTransform + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSG_INCLUDE_DIR osg/PositionAttitudeTransform + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSG_LIBRARY + NAMES osg + PATHS + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSG_LIBRARY + NAMES osg + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSG_LIBRARY + NAMES osg + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSG_FOUND "NO") +IF(OSG_LIBRARY AND OSG_INCLUDE_DIR) + SET(OSG_FOUND "YES") +ENDIF(OSG_LIBRARY AND OSG_INCLUDE_DIR) + diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake new file mode 100644 index 0000000..c0d0b08 --- /dev/null +++ b/Modules/FindosgDB.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgDB +# This module defines +# OSGDB_LIBRARY +# OSGDB_FOUND, if false, do not try to link to osgDB +# OSGDB_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgDB/DatabasePager> + +# Try the user's environment request before anything else. +FIND_PATH(OSGDB_INCLUDE_DIR osgDB/DatabasePager + PATHS + $ENV{OSGDB_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGDB_INCLUDE_DIR osgDB/DatabasePager + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGDB_INCLUDE_DIR osgDB/DatabasePager + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGDB_LIBRARY + NAMES osgDB + PATHS + $ENV{OSGDB_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGDB_LIBRARY + NAMES osgDB + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGDB_LIBRARY + NAMES osgDB + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGDB_FOUND "NO") +IF(OSGDB_LIBRARY AND OSGDB_INCLUDE_DIR) + SET(OSGDB_FOUND "YES") +ENDIF(OSGDB_LIBRARY AND OSGDB_INCLUDE_DIR) + diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake new file mode 100644 index 0000000..4510460 --- /dev/null +++ b/Modules/FindosgFX.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgFX +# This module defines +# OSGFX_LIBRARY +# OSGFX_FOUND, if false, do not try to link to osgFX +# OSGFX_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgFX/BumpMapping> + +# Try the user's environment request before anything else. +FIND_PATH(OSGFX_INCLUDE_DIR osgFX/BumpMapping + PATHS + $ENV{OSGFX_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGFX_INCLUDE_DIR osgFX/BumpMapping + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGFX_INCLUDE_DIR osgFX/BumpMapping + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGFX_LIBRARY + NAMES osgFX + PATHS + $ENV{OSGFX_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGFX_LIBRARY + NAMES osgFX + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGFX_LIBRARY + NAMES osgFX + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGFX_FOUND "NO") +IF(OSGFX_LIBRARY AND OSGFX_INCLUDE_DIR) + SET(OSGFX_FOUND "YES") +ENDIF(OSGFX_LIBRARY AND OSGFX_INCLUDE_DIR) + diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake new file mode 100644 index 0000000..28473ab --- /dev/null +++ b/Modules/FindosgGA.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgGA +# This module defines +# OSGGA_LIBRARY +# OSGGA_FOUND, if false, do not try to link to osgGA +# OSGGA_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgGA/FlightManipulator> + +# Try the user's environment request before anything else. +FIND_PATH(OSGGA_INCLUDE_DIR osgGA/FlightManipulator + PATHS + $ENV{OSGGA_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGGA_INCLUDE_DIR osgGA/FlightManipulator + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGGA_INCLUDE_DIR osgGA/FlightManipulator + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGGA_LIBRARY + NAMES osgGA + PATHS + $ENV{OSGGA_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGGA_LIBRARY + NAMES osgGA + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGGA_LIBRARY + NAMES osgGA + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGGA_FOUND "NO") +IF(OSGGA_LIBRARY AND OSGGA_INCLUDE_DIR) + SET(OSGGA_FOUND "YES") +ENDIF(OSGGA_LIBRARY AND OSGGA_INCLUDE_DIR) + diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake new file mode 100644 index 0000000..16c3e86 --- /dev/null +++ b/Modules/FindosgIntrospection.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgIntrospection +# This module defines +# OSGINTROSPECTION_LIBRARY +# OSGINTROSPECTION_FOUND, if false, do not try to link to osgIntrospection +# OSGINTROSPECTION_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgIntrospection/Reflection> + +# Try the user's environment request before anything else. +FIND_PATH(OSGINTROSPECTION_INCLUDE_DIR osgIntrospection/Reflection + PATHS + $ENV{OSGINTROSPECTION_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGINTROSPECTION_INCLUDE_DIR osgIntrospection/Reflection + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGINTROSPECTION_INCLUDE_DIR osgIntrospection/Reflection + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGINTROSPECTION_LIBRARY + NAMES osgIntrospection + PATHS + $ENV{OSGINTROSPECTION_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGINTROSPECTION_LIBRARY + NAMES osgIntrospection + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGINTROSPECTION_LIBRARY + NAMES osgIntrospection + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGINTROSPECTION_FOUND "NO") +IF(OSGINTROSPECTION_LIBRARY AND OSGINTROSPECTION_INCLUDE_DIR) + SET(OSGINTROSPECTION_FOUND "YES") +ENDIF(OSGINTROSPECTION_LIBRARY AND OSGINTROSPECTION_INCLUDE_DIR) + diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake new file mode 100644 index 0000000..ac403c7 --- /dev/null +++ b/Modules/FindosgManipulator.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgManipulator +# This module defines +# OSG_LIBRARY +# OSGMANIPULATOR_FOUND, if false, do not try to link to osgManipulator +# OSGMANIPULATOR_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgManipulator/TrackballDragger> + +# Try the user's environment request before anything else. +FIND_PATH(OSGMANIPULATOR_INCLUDE_DIR osgManipulator/TrackballDragger + PATHS + $ENV{OSGMANIPULATOR_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGMANIPULATOR_INCLUDE_DIR osgManipulator/TrackballDragger + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGMANIPULATOR_INCLUDE_DIR osgManipulator/TrackballDragger + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGMANIPULATOR_LIBRARY + NAMES osgManipulator + PATHS + $ENV{OSGMANIPULATOR_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGMANIPULATOR_LIBRARY + NAMES osgManipulator + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGMANIPULATOR_LIBRARY + NAMES osgManipulator + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGMANIPULATOR_FOUND "NO") +IF(OSGMANIPULATOR_LIBRARY AND OSGMANIPULATOR_INCLUDE_DIR) + SET(OSGMANIPULATOR_FOUND "YES") +ENDIF(OSGMANIPULATOR_LIBRARY AND OSGMANIPULATOR_INCLUDE_DIR) + diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake new file mode 100644 index 0000000..e36152f --- /dev/null +++ b/Modules/FindosgParticle.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgParticle +# This module defines +# OSGPARTICLE_LIBRARY +# OSGPARTICLE_FOUND, if false, do not try to link to osgParticle +# OSGPARTICLE_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgParticle/FireEffect> + +# Try the user's environment request before anything else. +FIND_PATH(OSGPARTICLE_INCLUDE_DIR osgParticle/FireEffect + PATHS + $ENV{OSGPARTICLE_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGPARTICLE_INCLUDE_DIR osgParticle/FireEffect + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGPARTICLE_INCLUDE_DIR osgParticle/FireEffect + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGPARTICLE_LIBRARY + NAMES osgParticle + PATHS + $ENV{OSGPARTICLE_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGPARTICLE_LIBRARY + NAMES osgParticle + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGPARTICLE_LIBRARY + NAMES osgParticle + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGPARTICLE_FOUND "NO") +IF(OSGPARTICLE_LIBRARY AND OSGPARTICLE_INCLUDE_DIR) + SET(OSGPARTICLE_FOUND "YES") +ENDIF(OSGPARTICLE_LIBRARY AND OSGPARTICLE_INCLUDE_DIR) + diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake new file mode 100644 index 0000000..09f99a0 --- /dev/null +++ b/Modules/FindosgProducer.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgProducer +# This module defines +# OSGPRODUCER_LIBRARY +# OSGPRODUCER_FOUND, if false, do not try to link to osgProducer +# OSGPRODUCER_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgProducer/OsgSceneHandler> + +# Try the user's environment request before anything else. +FIND_PATH(OSGPRODUCER_INCLUDE_DIR osgProducer/OsgSceneHandler + PATHS + $ENV{OSGPRODUCER_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGPRODUCER_INCLUDE_DIR osgProducer/OsgSceneHandler + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGPRODUCER_INCLUDE_DIR osgProducer/OsgSceneHandler + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGPRODUCER_LIBRARY + NAMES osgProducer + PATHS + $ENV{OSGPRODUCER_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGPRODUCER_LIBRARY + NAMES osgProducer + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGPRODUCER_LIBRARY + NAMES osgProducer + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGPRODUCER_FOUND "NO") +IF(OSGPRODUCER_LIBRARY AND OSGPRODUCER_INCLUDE_DIR) + SET(OSGPRODUCER_FOUND "YES") +ENDIF(OSGPRODUCER_LIBRARY AND OSGPRODUCER_INCLUDE_DIR) + diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake new file mode 100644 index 0000000..1a942f3 --- /dev/null +++ b/Modules/FindosgShadow.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgShadow +# This module defines +# OSGSHADOW_LIBRARY +# OSGSHADOW_FOUND, if false, do not try to link to osgShadow +# OSGSHADOW_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgShadow/ShadowTexture> + +# Try the user's environment request before anything else. +FIND_PATH(OSGSHADOW_INCLUDE_DIR osgShadow/ShadowTexture + PATHS + $ENV{OSGSHADOW_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGSHADOW_INCLUDE_DIR osgShadow/ShadowTexture + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGSHADOW_INCLUDE_DIR osgShadow/ShadowTexture + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGSHADOW_LIBRARY + NAMES osgShadow + PATHS + $ENV{OSGSHADOW_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGSHADOW_LIBRARY + NAMES osgShadow + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGSHADOW_LIBRARY + NAMES osgShadow + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGSHADOW_FOUND "NO") +IF(OSGSHADOW_LIBRARY AND OSGSHADOW_INCLUDE_DIR) + SET(OSGSHADOW_FOUND "YES") +ENDIF(OSGSHADOW_LIBRARY AND OSGSHADOW_INCLUDE_DIR) + diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake new file mode 100644 index 0000000..f6a8b6b --- /dev/null +++ b/Modules/FindosgSim.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgSim +# This module defines +# OSGSIM_LIBRARY +# OSGSIM_FOUND, if false, do not try to link to osgSim +# OSGSIM_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgSim/ImpostorSprite> + +# Try the user's environment request before anything else. +FIND_PATH(OSGSIM_INCLUDE_DIR osgSim/ImpostorSprite + PATHS + $ENV{OSGSIM_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGSIM_INCLUDE_DIR osgSim/ImpostorSprite + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGSIM_INCLUDE_DIR osgSim/ImpostorSprite + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGSIM_LIBRARY + NAMES osgSim + PATHS + $ENV{OSGSIM_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGSIM_LIBRARY + NAMES osgSim + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGSIM_LIBRARY + NAMES osgSim + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGSIM_FOUND "NO") +IF(OSGSIM_LIBRARY AND OSGSIM_INCLUDE_DIR) + SET(OSGSIM_FOUND "YES") +ENDIF(OSGSIM_LIBRARY AND OSGSIM_INCLUDE_DIR) + diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake new file mode 100644 index 0000000..676585d --- /dev/null +++ b/Modules/FindosgTerrain.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgTerrain +# This module defines +# OSGTERRAIN_LIBRARY +# OSGTERRAIN_FOUND, if false, do not try to link to osgTerrain +# OSGTERRAIN_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgTerrain/Terrain> + +# Try the user's environment request before anything else. +FIND_PATH(OSGTERRAIN_INCLUDE_DIR osgTerrain/Terrain + PATHS + $ENV{OSGTERRAIN_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGTERRAIN_INCLUDE_DIR osgTerrain/Terrain + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGTERRAIN_INCLUDE_DIR osgTerrain/Terrain + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGTERRAIN_LIBRARY + NAMES osgTerrain + PATHS + $ENV{OSGTERRAIN_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGTERRAIN_LIBRARY + NAMES osgTerrain + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGTERRAIN_LIBRARY + NAMES osgTerrain + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGTERRAIN_FOUND "NO") +IF(OSGTERRAIN_LIBRARY AND OSGTERRAIN_INCLUDE_DIR) + SET(OSGTERRAIN_FOUND "YES") +ENDIF(OSGTERRAIN_LIBRARY AND OSGTERRAIN_INCLUDE_DIR) + diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake new file mode 100644 index 0000000..3ff90ab --- /dev/null +++ b/Modules/FindosgText.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgText +# This module defines +# OSGTEXT_LIBRARY +# OSGTEXT_FOUND, if false, do not try to link to osgText +# OSGTEXT_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgText/Text> + +# Try the user's environment request before anything else. +FIND_PATH(OSGTEXT_INCLUDE_DIR osgText/Text + PATHS + $ENV{OSGTEXT_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGTEXT_INCLUDE_DIR osgText/Text + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGTEXT_INCLUDE_DIR osgText/Text + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGTEXT_LIBRARY + NAMES osgText + PATHS + $ENV{OSGTEXT_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGTEXT_LIBRARY + NAMES osgText + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGTEXT_LIBRARY + NAMES osgText + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGTEXT_FOUND "NO") +IF(OSGTEXT_LIBRARY AND OSGTEXT_INCLUDE_DIR) + SET(OSGTEXT_FOUND "YES") +ENDIF(OSGTEXT_LIBRARY AND OSGTEXT_INCLUDE_DIR) + diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake new file mode 100644 index 0000000..9174135 --- /dev/null +++ b/Modules/FindosgUtil.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgUtil +# This module defines +# OSGUTIL_LIBRARY +# OSGUTIL_FOUND, if false, do not try to link to osgUtil +# OSGUTIL_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgUtil/SceneView> + +# Try the user's environment request before anything else. +FIND_PATH(OSGUTIL_INCLUDE_DIR osgUtil/SceneView + PATHS + $ENV{OSGUTIL_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGUTIL_INCLUDE_DIR osgUtil/SceneView + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGUTIL_INCLUDE_DIR osgUtil/SceneView + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGUTIL_LIBRARY + NAMES osgUtil + PATHS + $ENV{OSGUTIL_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGUTIL_LIBRARY + NAMES osgUtil + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGUTIL_LIBRARY + NAMES osgUtil + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGUTIL_FOUND "NO") +IF(OSGUTIL_LIBRARY AND OSGUTIL_INCLUDE_DIR) + SET(OSGUTIL_FOUND "YES") +ENDIF(OSGUTIL_LIBRARY AND OSGUTIL_INCLUDE_DIR) + diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake new file mode 100644 index 0000000..46e496c --- /dev/null +++ b/Modules/FindosgViewer.cmake @@ -0,0 +1,90 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgViewer +# This module defines +# OSGVIEWER_LIBRARY +# OSGVIEWER_FOUND, if false, do not try to link to osgViewer +# OSGVIEWER_INCLUDE_DIR, where to find the headers +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +# Header files are presumed to be included like +# #include <osg/PositionAttitudeTransform> +# #include <osgViewer/Viewer> + +# Try the user's environment request before anything else. +FIND_PATH(OSGVIEWER_INCLUDE_DIR osgViewer/Viewer + PATHS + $ENV{OSGVIEWER_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGVIEWER_INCLUDE_DIR osgViewer/Viewer + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES include +) +FIND_PATH(OSGVIEWER_INCLUDE_DIR osgViewer/Viewer + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OpenThreads_ROOT] + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT] + PATH_SUFFIXES include +) + +FIND_LIBRARY(OSGVIEWER_LIBRARY + NAMES osgViewer + PATHS + $ENV{OSGVIEWER_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGVIEWER_LIBRARY + NAMES osgViewer + PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. + NO_DEFAULT_PATH + PATH_SUFFIXES lib64 lib +) +FIND_LIBRARY(OSGVIEWER_LIBRARY + NAMES osgViewer + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + PATH_SUFFIXES lib64 lib +) + +SET(OSGVIEWER_FOUND "NO") +IF(OSGVIEWER_LIBRARY AND OSGVIEWER_INCLUDE_DIR) + SET(OSGVIEWER_FOUND "YES") +ENDIF(OSGVIEWER_LIBRARY AND OSGVIEWER_INCLUDE_DIR) + |