Merge branch 'master' into sdl_input
commit
6449f68d61
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,52 @@
|
|||||||
|
#ifndef VIDEOPLAYER_H
|
||||||
|
#define VIDEOPLAYER_H
|
||||||
|
|
||||||
|
#include <OgreMaterial.h>
|
||||||
|
|
||||||
|
namespace Ogre
|
||||||
|
{
|
||||||
|
class SceneManager;
|
||||||
|
class SceneNode;
|
||||||
|
class Rectangle2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWRender
|
||||||
|
{
|
||||||
|
struct VideoState;
|
||||||
|
|
||||||
|
class VideoPlayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VideoPlayer(Ogre::SceneManager* sceneMgr);
|
||||||
|
~VideoPlayer();
|
||||||
|
|
||||||
|
void playVideo (const std::string& resourceName, bool allowSkipping);
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
|
void close();
|
||||||
|
void stopVideo();
|
||||||
|
|
||||||
|
bool isPlaying();
|
||||||
|
|
||||||
|
void setResolution (int w, int h) { mWidth = w; mHeight = h; }
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
VideoState* mState;
|
||||||
|
|
||||||
|
bool mAllowSkipping;
|
||||||
|
|
||||||
|
Ogre::SceneManager* mSceneMgr;
|
||||||
|
Ogre::MaterialPtr mVideoMaterial;
|
||||||
|
Ogre::Rectangle2D* mRectangle;
|
||||||
|
Ogre::Rectangle2D* mBackgroundRectangle;
|
||||||
|
Ogre::SceneNode* mNode;
|
||||||
|
Ogre::SceneNode* mBackgroundNode;
|
||||||
|
|
||||||
|
int mWidth;
|
||||||
|
int mHeight;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,105 +0,0 @@
|
|||||||
# Find the FFmpeg library
|
|
||||||
#
|
|
||||||
# Sets
|
|
||||||
# FFMPEG_FOUND. If false, don't try to use ffmpeg
|
|
||||||
# FFMPEG_INCLUDE_DIR
|
|
||||||
# FFMPEG_LIBRARIES
|
|
||||||
#
|
|
||||||
# Modified by Nicolay Korslund for OpenMW
|
|
||||||
|
|
||||||
SET( FFMPEG_FOUND "NO" )
|
|
||||||
|
|
||||||
FIND_PATH( FFMPEG_general_INCLUDE_DIR libavcodec/avcodec.h libavformat/avformat.h
|
|
||||||
HINTS
|
|
||||||
PATHS
|
|
||||||
/usr/include
|
|
||||||
/usr/local/include
|
|
||||||
/usr/include/ffmpeg
|
|
||||||
/usr/local/include/ffmpeg
|
|
||||||
/usr/include/ffmpeg/libavcodec
|
|
||||||
/usr/local/include/ffmpeg/libavcodec
|
|
||||||
/usr/include/libavcodec
|
|
||||||
/usr/local/include/libavcodec
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_PATH( FFMPEG_avcodec_INCLUDE_DIR avcodec.h
|
|
||||||
HINTS
|
|
||||||
PATHS
|
|
||||||
${FFMPEG_general_INCLUDE_DIR}/libavcodec
|
|
||||||
/usr/include
|
|
||||||
/usr/local/include
|
|
||||||
/usr/include/ffmpeg
|
|
||||||
/usr/local/include/ffmpeg
|
|
||||||
/usr/include/ffmpeg/libavcodec
|
|
||||||
/usr/local/include/ffmpeg/libavcodec
|
|
||||||
/usr/include/libavcodec
|
|
||||||
/usr/local/include/libavcodec
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_PATH( FFMPEG_avformat_INCLUDE_DIR avformat.h
|
|
||||||
HINTS
|
|
||||||
PATHS
|
|
||||||
${FFMPEG_general_INCLUDE_DIR}/libavformat
|
|
||||||
/usr/include
|
|
||||||
/usr/local/include
|
|
||||||
/usr/include/ffmpeg
|
|
||||||
/usr/local/include/ffmpeg
|
|
||||||
/usr/include/ffmpeg/libavformat
|
|
||||||
/usr/local/include/ffmpeg/libavformat
|
|
||||||
/usr/include/libavformat
|
|
||||||
/usr/local/include/libavformat
|
|
||||||
)
|
|
||||||
|
|
||||||
set(FFMPEG_INCLUDE_DIR ${FFMPEG_general_INCLUDE_DIR} ${FFMPEG_avcodec_INCLUDE_DIR} ${FFMPEG_avformat_INCLUDE_DIR})
|
|
||||||
|
|
||||||
IF( FFMPEG_INCLUDE_DIR )
|
|
||||||
|
|
||||||
FIND_PROGRAM( FFMPEG_CONFIG ffmpeg-config
|
|
||||||
/usr/bin
|
|
||||||
/usr/local/bin
|
|
||||||
${HOME}/bin
|
|
||||||
)
|
|
||||||
|
|
||||||
IF( FFMPEG_CONFIG )
|
|
||||||
EXEC_PROGRAM( ${FFMPEG_CONFIG} ARGS "--libs avformat" OUTPUT_VARIABLE FFMPEG_LIBS )
|
|
||||||
SET( FFMPEG_FOUND "YES" )
|
|
||||||
SET( FFMPEG_LIBRARIES "${FFMPEG_LIBS}" )
|
|
||||||
|
|
||||||
ELSE( FFMPEG_CONFIG )
|
|
||||||
|
|
||||||
FIND_LIBRARY( FFMPEG_avcodec_LIBRARY avcodec
|
|
||||||
/usr/lib
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib64
|
|
||||||
/usr/local/lib64
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY( FFMPEG_avformat_LIBRARY avformat
|
|
||||||
/usr/lib
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib64
|
|
||||||
/usr/local/lib64
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY( FFMPEG_avutil_LIBRARY avutil
|
|
||||||
/usr/lib
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib64
|
|
||||||
/usr/local/lib64
|
|
||||||
)
|
|
||||||
|
|
||||||
IF( FFMPEG_avcodec_LIBRARY )
|
|
||||||
IF( FFMPEG_avformat_LIBRARY )
|
|
||||||
|
|
||||||
SET( FFMPEG_FOUND "YES" )
|
|
||||||
SET( FFMPEG_LIBRARIES ${FFMPEG_avformat_LIBRARY} ${FFMPEG_avcodec_LIBRARY} )
|
|
||||||
IF( FFMPEG_avutil_LIBRARY )
|
|
||||||
SET( FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_avutil_LIBRARY} )
|
|
||||||
ENDIF( FFMPEG_avutil_LIBRARY )
|
|
||||||
|
|
||||||
ENDIF( FFMPEG_avformat_LIBRARY )
|
|
||||||
ENDIF( FFMPEG_avcodec_LIBRARY )
|
|
||||||
|
|
||||||
ENDIF( FFMPEG_CONFIG )
|
|
||||||
|
|
||||||
ENDIF( FFMPEG_INCLUDE_DIR )
|
|
@ -0,0 +1,148 @@
|
|||||||
|
# vim: ts=2 sw=2
|
||||||
|
# - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
|
||||||
|
#
|
||||||
|
# Once done this will define
|
||||||
|
# FFMPEG_FOUND - System has the all required components.
|
||||||
|
# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers.
|
||||||
|
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
|
||||||
|
# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components.
|
||||||
|
#
|
||||||
|
# For each of the components it will additionaly set.
|
||||||
|
# - AVCODEC
|
||||||
|
# - AVDEVICE
|
||||||
|
# - AVFORMAT
|
||||||
|
# - AVUTIL
|
||||||
|
# - POSTPROCESS
|
||||||
|
# - SWSCALE
|
||||||
|
# the following variables will be defined
|
||||||
|
# <component>_FOUND - System has <component>
|
||||||
|
# <component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
|
||||||
|
# <component>_LIBRARIES - Link these to use <component>
|
||||||
|
# <component>_DEFINITIONS - Compiler switches required for using <component>
|
||||||
|
# <component>_VERSION - The components version
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
|
||||||
|
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
|
||||||
|
# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
# The default components were taken from a survey over other FindFFMPEG.cmake files
|
||||||
|
if (NOT FFmpeg_FIND_COMPONENTS)
|
||||||
|
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
#
|
||||||
|
### Macro: set_component_found
|
||||||
|
#
|
||||||
|
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
|
||||||
|
#
|
||||||
|
macro(set_component_found _component )
|
||||||
|
if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
|
||||||
|
# message(STATUS " - ${_component} found.")
|
||||||
|
set(${_component}_FOUND TRUE)
|
||||||
|
else ()
|
||||||
|
# message(STATUS " - ${_component} not found.")
|
||||||
|
endif ()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#
|
||||||
|
### Macro: find_component
|
||||||
|
#
|
||||||
|
# Checks for the given component by invoking pkgconfig and then looking up the libraries and
|
||||||
|
# include directories.
|
||||||
|
#
|
||||||
|
macro(find_component _component _pkgconfig _library _header)
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
# use pkg-config to get the directories and then use these values
|
||||||
|
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||||
|
find_package(PkgConfig)
|
||||||
|
if (PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(PC_${_component} ${_pkgconfig})
|
||||||
|
endif ()
|
||||||
|
endif (NOT WIN32)
|
||||||
|
|
||||||
|
find_path(${_component}_INCLUDE_DIRS ${_header}
|
||||||
|
HINTS
|
||||||
|
${PC_LIB${_component}_INCLUDEDIR}
|
||||||
|
${PC_LIB${_component}_INCLUDE_DIRS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
ffmpeg
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(${_component}_LIBRARIES NAMES ${_library}
|
||||||
|
HINTS
|
||||||
|
${PC_LIB${_component}_LIBDIR}
|
||||||
|
${PC_LIB${_component}_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
|
||||||
|
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
|
||||||
|
|
||||||
|
set_component_found(${_component})
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
${_component}_INCLUDE_DIRS
|
||||||
|
${_component}_LIBRARIES
|
||||||
|
${_component}_DEFINITIONS
|
||||||
|
${_component}_VERSION)
|
||||||
|
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
# Check for cached results. If there are skip the costly part.
|
||||||
|
if (NOT FFMPEG_LIBRARIES)
|
||||||
|
|
||||||
|
# Check for all possible component.
|
||||||
|
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
|
||||||
|
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
|
||||||
|
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
|
||||||
|
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
|
||||||
|
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
|
||||||
|
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
|
||||||
|
|
||||||
|
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
|
||||||
|
foreach (_component ${FFmpeg_FIND_COMPONENTS})
|
||||||
|
if (${_component}_FOUND)
|
||||||
|
# message(STATUS "Required component ${_component} present.")
|
||||||
|
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
|
||||||
|
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
|
||||||
|
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
|
||||||
|
else ()
|
||||||
|
# message(STATUS "Required component ${_component} missing.")
|
||||||
|
endif ()
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
# Build the include path with duplicates removed.
|
||||||
|
if (FFMPEG_INCLUDE_DIRS)
|
||||||
|
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# cache the vars.
|
||||||
|
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE)
|
||||||
|
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE)
|
||||||
|
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE)
|
||||||
|
|
||||||
|
mark_as_advanced(FFMPEG_INCLUDE_DIRS
|
||||||
|
FFMPEG_LIBRARIES
|
||||||
|
FFMPEG_DEFINITIONS)
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Now set the noncached _FOUND vars for the components.
|
||||||
|
foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE)
|
||||||
|
set_component_found(${_component})
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
# Compile the list of required vars
|
||||||
|
set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
|
||||||
|
foreach (_component ${FFmpeg_FIND_COMPONENTS})
|
||||||
|
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
# Give a nice error message if some of the required vars are missing.
|
||||||
|
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
|
@ -0,0 +1,177 @@
|
|||||||
|
# Locate SDL library
|
||||||
|
# This module defines
|
||||||
|
# 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.
|
||||||
|
# Added a search for SDLmain which is needed by some platforms.
|
||||||
|
# Added a search for threads which is needed by some platforms.
|
||||||
|
# Added needed compile switches for MinGW.
|
||||||
|
#
|
||||||
|
# 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 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).
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2003-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
FIND_PATH(SDL_INCLUDE_DIR SDL.h
|
||||||
|
HINTS
|
||||||
|
$ENV{SDLDIR}
|
||||||
|
PATH_SUFFIXES include/SDL include
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local/include/SDL12
|
||||||
|
/usr/local/include/SDL11 # FreeBSD ports
|
||||||
|
/usr/include/SDL12
|
||||||
|
/usr/include/SDL11
|
||||||
|
/sw # Fink
|
||||||
|
/opt/local # DarwinPorts
|
||||||
|
/opt/csw # Blastwave
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
#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
|
||||||
|
HINTS
|
||||||
|
$ENV{SDLDIR}
|
||||||
|
PATH_SUFFIXES lib64 lib
|
||||||
|
PATHS
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
|
||||||
|
#MESSAGE("SDL_LIBRARY_TEMP is ${SDL_LIBRARY_TEMP}")
|
||||||
|
|
||||||
|
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
|
||||||
|
HINTS
|
||||||
|
$ENV{SDLDIR}
|
||||||
|
PATH_SUFFIXES lib64 lib
|
||||||
|
PATHS
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
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
|
||||||
|
# frameworks may already provide it.
|
||||||
|
# But for non-OSX systems, I will use the CMake Threads package.
|
||||||
|
IF(NOT APPLE)
|
||||||
|
FIND_PACKAGE(Threads)
|
||||||
|
ENDIF(NOT APPLE)
|
||||||
|
|
||||||
|
# MinGW needs an additional library, mwindows
|
||||||
|
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
|
||||||
|
# (Actually on second look, I think it only needs one of the m* libraries.)
|
||||||
|
IF(MINGW)
|
||||||
|
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
|
||||||
|
ENDIF(MINGW)
|
||||||
|
|
||||||
|
SET(SDL_FOUND "NO")
|
||||||
|
IF(SDL_LIBRARY_TEMP)
|
||||||
|
# For SDLmain
|
||||||
|
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 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 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})
|
||||||
|
ENDIF(NOT APPLE)
|
||||||
|
|
||||||
|
# For MinGW library
|
||||||
|
IF(MINGW)
|
||||||
|
SET(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP})
|
||||||
|
ENDIF(MINGW)
|
||||||
|
|
||||||
|
# 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 "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "")
|
||||||
|
|
||||||
|
SET(SDL_FOUND "YES")
|
||||||
|
ENDIF(SDL_LIBRARY_TEMP)
|
||||||
|
|
||||||
|
#MESSAGE("SDL_LIBRARY is ${SDL_LIBRARY}")
|
||||||
|
|
Loading…
Reference in New Issue