Remove old CMake find files
This commit is contained in:
parent
ab2e6e5ea2
commit
e8b7d45cfa
@ -1,115 +0,0 @@
|
|||||||
# - Try to find Allegro
|
|
||||||
# Configs for lookup
|
|
||||||
# ALLEGRO_PATH_SUFFIX - suffix for include path, allegro or alllegro5
|
|
||||||
#
|
|
||||||
# Once done this will define
|
|
||||||
#
|
|
||||||
# ALLEGRO_FOUND - system has Allegro
|
|
||||||
# ALLEGRO_INCLUDE_DIRS - the Allegro include directory
|
|
||||||
# ALLEGRO_LIBRARIES - Link these to use Allegro
|
|
||||||
# ALLEGRO_DEFINITIONS - Compiler switches required for using Allegro
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Olof Naessen <olof.naessen@gmail.com>
|
|
||||||
#
|
|
||||||
# Redistribution and use is allowed according to the terms of the New
|
|
||||||
# BSD license.
|
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
||||||
#
|
|
||||||
if (ALLEGRO_LIBRARIES AND ALLEGRO_INCLUDE_DIRS)
|
|
||||||
# in cache already
|
|
||||||
set(ALLEGRO_FOUND TRUE)
|
|
||||||
else (ALLEGRO_LIBRARIES AND ALLEGRO_INCLUDE_DIRS)
|
|
||||||
if (NOT DEFINED ALLEGRO_PATH_SUFFIX)
|
|
||||||
set(ALLEGRO_PATH_SUFFIX allegro)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_path(ALLEGRO_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
allegro.h
|
|
||||||
allegro_image.h
|
|
||||||
PATHS
|
|
||||||
/usr/include
|
|
||||||
/usr/local/include
|
|
||||||
/opt/local/include
|
|
||||||
/sw/include
|
|
||||||
/usr/include/allegro5
|
|
||||||
/usr/local/include/allegro5
|
|
||||||
/opt/local/include/allegro5
|
|
||||||
/sw/include/allegro5
|
|
||||||
PATH_SUFFIXES
|
|
||||||
"${ALLEGRO_PATH_SUFFIX}"
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(ALLEGRO_LIBRARY
|
|
||||||
NAMES
|
|
||||||
allegro
|
|
||||||
PATHS
|
|
||||||
/usr/lib
|
|
||||||
/usr/lib/x86_64-linux-gnu
|
|
||||||
/usr/local/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(ALLEGRO_AUDIO_LIBRARY
|
|
||||||
NAMES
|
|
||||||
allegro_audio
|
|
||||||
PATHS
|
|
||||||
/usr/lib
|
|
||||||
/usr/lib/x86_64-linux-gnu
|
|
||||||
/usr/local/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(ALLEGRO_FONT_LIBRARY
|
|
||||||
NAMES
|
|
||||||
allegro_font
|
|
||||||
PATHS
|
|
||||||
/usr/lib
|
|
||||||
/usr/lib/x86_64-linux-gnu
|
|
||||||
/usr/local/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(ALLEGRO_TTF_LIBRARY
|
|
||||||
NAMES
|
|
||||||
allegro_ttf
|
|
||||||
PATHS
|
|
||||||
/usr/lib
|
|
||||||
/usr/lib/x86_64-linux-gnu
|
|
||||||
/usr/local/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(ALLEGRO_IMAGE_LIBRARY
|
|
||||||
NAMES
|
|
||||||
allegro_image
|
|
||||||
PATHS
|
|
||||||
/usr/lib
|
|
||||||
/usr/lib/x86_64-linux-gnu
|
|
||||||
/usr/local/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
set(ALLEGRO_LIBRARIES ${ALLEGRO_LIBRARY} ${ALLEGRO_IMAGE_LIBRARY})
|
|
||||||
set(ALLEGRO_INCLUDE_DIRS ${ALLEGRO_INCLUDE_DIR})
|
|
||||||
|
|
||||||
if (ALLEGRO_INCLUDE_DIRS AND ALLEGRO_LIBRARIES)
|
|
||||||
set(ALLEGRO_FOUND TRUE)
|
|
||||||
endif (ALLEGRO_INCLUDE_DIRS AND ALLEGRO_LIBRARIES)
|
|
||||||
|
|
||||||
if (NOT ALLEGRO_FOUND)
|
|
||||||
if (Allegro_FIND_REQUIRED)
|
|
||||||
message(FATAL_ERROR "Could not find Allegro")
|
|
||||||
endif (Allegro_FIND_REQUIRED)
|
|
||||||
endif (NOT ALLEGRO_FOUND)
|
|
||||||
|
|
||||||
# show the ALLEGRO_INCLUDE_DIRS and ALLEGRO_LIBRARIES variables only in the advanced view
|
|
||||||
mark_as_advanced(ALLEGRO_INCLUDE_DIRS ALLEGRO_LIBRARIES)
|
|
||||||
|
|
||||||
endif (ALLEGRO_LIBRARIES AND ALLEGRO_INCLUDE_DIRS)
|
|
||||||
|
|
@ -1,178 +0,0 @@
|
|||||||
# - 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
|
|
||||||
# SDL_VERSION_STRING, human-readable string containing the version of SDL
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
# Copyright 2012 Benjamin Eikel
|
|
||||||
#
|
|
||||||
# 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/SDL2 include/SDL include
|
|
||||||
)
|
|
||||||
|
|
||||||
# SDL-1.1 is the name used by FreeBSD ports...
|
|
||||||
# don't confuse it for the version number.
|
|
||||||
find_library(SDL_LIBRARY_TEMP
|
|
||||||
NAMES SDL2
|
|
||||||
HINTS
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES 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 SDL2main
|
|
||||||
HINTS
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
PATHS
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
if(SDL_LIBRARY_TEMP)
|
|
||||||
# For SDLmain
|
|
||||||
if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY)
|
|
||||||
list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX)
|
|
||||||
if(_SDL_MAIN_INDEX EQUAL -1)
|
|
||||||
set(SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" ${SDL_LIBRARY_TEMP})
|
|
||||||
endif()
|
|
||||||
unset(_SDL_MAIN_INDEX)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
# For MinGW library
|
|
||||||
if(MINGW)
|
|
||||||
set(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# 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 "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SDL_INCLUDE_DIR AND EXISTS "${SDL_INCLUDE_DIR}/SDL_version.h")
|
|
||||||
file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MAJOR "${SDL_VERSION_MAJOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MINOR "${SDL_VERSION_MINOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_VERSION_PATCH "${SDL_VERSION_PATCH_LINE}")
|
|
||||||
set(SDL_VERSION_STRING ${SDL_VERSION_MAJOR}.${SDL_VERSION_MINOR}.${SDL_VERSION_PATCH})
|
|
||||||
unset(SDL_VERSION_MAJOR_LINE)
|
|
||||||
unset(SDL_VERSION_MINOR_LINE)
|
|
||||||
unset(SDL_VERSION_PATCH_LINE)
|
|
||||||
unset(SDL_VERSION_MAJOR)
|
|
||||||
unset(SDL_VERSION_MINOR)
|
|
||||||
unset(SDL_VERSION_PATCH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
|
|
||||||
REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR
|
|
||||||
VERSION_VAR SDL_VERSION_STRING)
|
|
@ -1,88 +0,0 @@
|
|||||||
# - Locate SDL_image library
|
|
||||||
# This module defines:
|
|
||||||
# SDL_IMAGE_LIBRARIES, the name of the library to link against
|
|
||||||
# SDL_IMAGE_INCLUDE_DIRS, where to find the headers
|
|
||||||
# SDL_IMAGE_FOUND, if false, do not try to link against
|
|
||||||
# SDL_IMAGE_VERSION_STRING - human-readable string containing the version of SDL_image
|
|
||||||
#
|
|
||||||
# For backward compatiblity the following variables are also set:
|
|
||||||
# SDLIMAGE_LIBRARY (same value as SDL_IMAGE_LIBRARIES)
|
|
||||||
# SDLIMAGE_INCLUDE_DIR (same value as SDL_IMAGE_INCLUDE_DIRS)
|
|
||||||
# SDLIMAGE_FOUND (same value as SDL_IMAGE_FOUND)
|
|
||||||
#
|
|
||||||
# $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).
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2005-2009 Kitware, Inc.
|
|
||||||
# Copyright 2012 Benjamin Eikel
|
|
||||||
#
|
|
||||||
# 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.)
|
|
||||||
|
|
||||||
if(NOT SDL_IMAGE_INCLUDE_DIR AND SDLIMAGE_INCLUDE_DIR)
|
|
||||||
set(SDL_IMAGE_INCLUDE_DIR ${SDLIMAGE_INCLUDE_DIR} CACHE PATH "directory cache
|
|
||||||
entry initialized from old variable name")
|
|
||||||
endif()
|
|
||||||
find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
|
|
||||||
HINTS
|
|
||||||
ENV SDLIMAGEDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES include/SDL2 include
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY)
|
|
||||||
set(SDL_IMAGE_LIBRARY ${SDLIMAGE_LIBRARY} CACHE FILEPATH "file cache entry
|
|
||||||
initialized from old variable name")
|
|
||||||
endif()
|
|
||||||
find_library(SDL_IMAGE_LIBRARY
|
|
||||||
NAMES SDL2_image
|
|
||||||
HINTS
|
|
||||||
ENV SDLIMAGEDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
)
|
|
||||||
|
|
||||||
if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h")
|
|
||||||
file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MAJOR "${SDL_IMAGE_VERSION_MAJOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MINOR "${SDL_IMAGE_VERSION_MINOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_PATCH "${SDL_IMAGE_VERSION_PATCH_LINE}")
|
|
||||||
set(SDL_IMAGE_VERSION_STRING ${SDL_IMAGE_VERSION_MAJOR}.${SDL_IMAGE_VERSION_MINOR}.${SDL_IMAGE_VERSION_PATCH})
|
|
||||||
unset(SDL_IMAGE_VERSION_MAJOR_LINE)
|
|
||||||
unset(SDL_IMAGE_VERSION_MINOR_LINE)
|
|
||||||
unset(SDL_IMAGE_VERSION_PATCH_LINE)
|
|
||||||
unset(SDL_IMAGE_VERSION_MAJOR)
|
|
||||||
unset(SDL_IMAGE_VERSION_MINOR)
|
|
||||||
unset(SDL_IMAGE_VERSION_PATCH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SDL_IMAGE_LIBRARIES ${SDL_IMAGE_LIBRARY})
|
|
||||||
set(SDL_IMAGE_INCLUDE_DIRS ${SDL_IMAGE_INCLUDE_DIR})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_image
|
|
||||||
REQUIRED_VARS SDL_IMAGE_LIBRARIES SDL_IMAGE_INCLUDE_DIRS
|
|
||||||
VERSION_VAR SDL_IMAGE_VERSION_STRING)
|
|
||||||
|
|
||||||
# for backward compatiblity
|
|
||||||
set(SDLIMAGE_LIBRARY ${SDL_IMAGE_LIBRARIES})
|
|
||||||
set(SDLIMAGE_INCLUDE_DIR ${SDL_IMAGE_INCLUDE_DIRS})
|
|
||||||
set(SDLIMAGE_FOUND ${SDL_IMAGE_FOUND})
|
|
||||||
|
|
||||||
mark_as_advanced(SDL_IMAGE_LIBRARY SDL_IMAGE_INCLUDE_DIR)
|
|
@ -1,88 +0,0 @@
|
|||||||
# - Locate SDL_mixer library
|
|
||||||
# This module defines:
|
|
||||||
# SDL_MIXER_LIBRARIES, the name of the library to link against
|
|
||||||
# SDL_MIXER_INCLUDE_DIRS, where to find the headers
|
|
||||||
# SDL_MIXER_FOUND, if false, do not try to link against
|
|
||||||
# SDL_MIXER_VERSION_STRING - human-readable string containing the version of SDL_mixer
|
|
||||||
#
|
|
||||||
# For backward compatiblity the following variables are also set:
|
|
||||||
# SDLMIXER_LIBRARY (same value as SDL_MIXER_LIBRARIES)
|
|
||||||
# SDLMIXER_INCLUDE_DIR (same value as SDL_MIXER_INCLUDE_DIRS)
|
|
||||||
# SDLMIXER_FOUND (same value as SDL_MIXER_FOUND)
|
|
||||||
#
|
|
||||||
# $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).
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2005-2009 Kitware, Inc.
|
|
||||||
# Copyright 2012 Benjamin Eikel
|
|
||||||
#
|
|
||||||
# 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.)
|
|
||||||
|
|
||||||
if(NOT SDL_MIXER_INCLUDE_DIR AND SDLMIXER_INCLUDE_DIR)
|
|
||||||
set(SDL_MIXER_INCLUDE_DIR ${SDLMIXER_INCLUDE_DIR} CACHE PATH "directory cache
|
|
||||||
entry initialized from old variable name")
|
|
||||||
endif()
|
|
||||||
find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
|
|
||||||
HINTS
|
|
||||||
ENV SDLMIXERDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY)
|
|
||||||
set(SDL_MIXER_LIBRARY ${SDLMIXER_LIBRARY} CACHE FILEPATH "file cache entry
|
|
||||||
initialized from old variable name")
|
|
||||||
endif()
|
|
||||||
find_library(SDL_MIXER_LIBRARY
|
|
||||||
NAMES SDL_mixer
|
|
||||||
HINTS
|
|
||||||
ENV SDLMIXERDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
)
|
|
||||||
|
|
||||||
if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h")
|
|
||||||
file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+[0-9]+$")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MAJOR "${SDL_MIXER_VERSION_MAJOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MINOR "${SDL_MIXER_VERSION_MINOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_PATCH "${SDL_MIXER_VERSION_PATCH_LINE}")
|
|
||||||
set(SDL_MIXER_VERSION_STRING ${SDL_MIXER_VERSION_MAJOR}.${SDL_MIXER_VERSION_MINOR}.${SDL_MIXER_VERSION_PATCH})
|
|
||||||
unset(SDL_MIXER_VERSION_MAJOR_LINE)
|
|
||||||
unset(SDL_MIXER_VERSION_MINOR_LINE)
|
|
||||||
unset(SDL_MIXER_VERSION_PATCH_LINE)
|
|
||||||
unset(SDL_MIXER_VERSION_MAJOR)
|
|
||||||
unset(SDL_MIXER_VERSION_MINOR)
|
|
||||||
unset(SDL_MIXER_VERSION_PATCH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SDL_MIXER_LIBRARIES ${SDL_MIXER_LIBRARY})
|
|
||||||
set(SDL_MIXER_INCLUDE_DIRS ${SDL_MIXER_INCLUDE_DIR})
|
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
|
||||||
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_mixer
|
|
||||||
REQUIRED_VARS SDL_MIXER_LIBRARIES SDL_MIXER_INCLUDE_DIRS
|
|
||||||
VERSION_VAR SDL_MIXER_VERSION_STRING)
|
|
||||||
|
|
||||||
# for backward compatiblity
|
|
||||||
set(SDLMIXER_LIBRARY ${SDL_MIXER_LIBRARIES})
|
|
||||||
set(SDLMIXER_INCLUDE_DIR ${SDL_MIXER_INCLUDE_DIRS})
|
|
||||||
set(SDLMIXER_FOUND ${SDL_MIXER_FOUND})
|
|
||||||
|
|
||||||
mark_as_advanced(SDL_MIXER_LIBRARY SDL_MIXER_INCLUDE_DIR)
|
|
@ -1,88 +0,0 @@
|
|||||||
# - Locate SDL_net library
|
|
||||||
# This module defines:
|
|
||||||
# SDL_NET_LIBRARIES, the name of the library to link against
|
|
||||||
# SDL_NET_INCLUDE_DIRS, where to find the headers
|
|
||||||
# SDL_NET_FOUND, if false, do not try to link against
|
|
||||||
# SDL_NET_VERSION_STRING - human-readable string containing the version of SDL_net
|
|
||||||
#
|
|
||||||
# For backward compatiblity the following variables are also set:
|
|
||||||
# SDLNET_LIBRARY (same value as SDL_NET_LIBRARIES)
|
|
||||||
# SDLNET_INCLUDE_DIR (same value as SDL_NET_INCLUDE_DIRS)
|
|
||||||
# SDLNET_FOUND (same value as SDL_NET_FOUND)
|
|
||||||
#
|
|
||||||
# $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).
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2005-2009 Kitware, Inc.
|
|
||||||
# Copyright 2012 Benjamin Eikel
|
|
||||||
#
|
|
||||||
# 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.)
|
|
||||||
|
|
||||||
if(NOT SDL_NET_INCLUDE_DIR AND SDLNET_INCLUDE_DIR)
|
|
||||||
set(SDL_NET_INCLUDE_DIR ${SDLNET_INCLUDE_DIR} CACHE PATH "directory cache
|
|
||||||
entry initialized from old variable name")
|
|
||||||
endif()
|
|
||||||
find_path(SDL_NET_INCLUDE_DIR SDL_net.h
|
|
||||||
HINTS
|
|
||||||
ENV SDLNETDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY)
|
|
||||||
set(SDL_NET_LIBRARY ${SDLNET_LIBRARY} CACHE FILEPATH "file cache entry
|
|
||||||
initialized from old variable name")
|
|
||||||
endif()
|
|
||||||
find_library(SDL_NET_LIBRARY
|
|
||||||
NAMES SDL_net
|
|
||||||
HINTS
|
|
||||||
ENV SDLNETDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
)
|
|
||||||
|
|
||||||
if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h")
|
|
||||||
file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+[0-9]+$")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MAJOR "${SDL_NET_VERSION_MAJOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MINOR "${SDL_NET_VERSION_MINOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_PATCH "${SDL_NET_VERSION_PATCH_LINE}")
|
|
||||||
set(SDL_NET_VERSION_STRING ${SDL_NET_VERSION_MAJOR}.${SDL_NET_VERSION_MINOR}.${SDL_NET_VERSION_PATCH})
|
|
||||||
unset(SDL_NET_VERSION_MAJOR_LINE)
|
|
||||||
unset(SDL_NET_VERSION_MINOR_LINE)
|
|
||||||
unset(SDL_NET_VERSION_PATCH_LINE)
|
|
||||||
unset(SDL_NET_VERSION_MAJOR)
|
|
||||||
unset(SDL_NET_VERSION_MINOR)
|
|
||||||
unset(SDL_NET_VERSION_PATCH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SDL_NET_LIBRARIES ${SDL_NET_LIBRARY})
|
|
||||||
set(SDL_NET_INCLUDE_DIRS ${SDL_NET_INCLUDE_DIR})
|
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
|
||||||
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_net
|
|
||||||
REQUIRED_VARS SDL_NET_LIBRARIES SDL_NET_INCLUDE_DIRS
|
|
||||||
VERSION_VAR SDL_NET_VERSION_STRING)
|
|
||||||
|
|
||||||
# for backward compatiblity
|
|
||||||
set(SDLNET_LIBRARY ${SDL_NET_LIBRARIES})
|
|
||||||
set(SDLNET_INCLUDE_DIR ${SDL_NET_INCLUDE_DIRS})
|
|
||||||
set(SDLNET_FOUND ${SDL_NET_FOUND})
|
|
||||||
|
|
||||||
mark_as_advanced(SDL_NET_LIBRARY SDL_NET_INCLUDE_DIR)
|
|
@ -1,384 +0,0 @@
|
|||||||
# - 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_sound
|
|
||||||
# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need
|
|
||||||
# to link against. This is a read-only variable and is marked INTERNAL.
|
|
||||||
# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own
|
|
||||||
# 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.
|
|
||||||
# SDL_SOUND_VERSION_STRING, human-readable string containing the version of SDL_sound
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
# 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 selectionor set the CMake environment
|
|
||||||
# CMAKE_INCLUDE_PATH to modify the search paths.
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2005-2009 Kitware, Inc.
|
|
||||||
# Copyright 2012 Benjamin Eikel
|
|
||||||
#
|
|
||||||
# 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.)
|
|
||||||
|
|
||||||
set(SDL_SOUND_EXTRAS "" CACHE STRING "SDL_sound extra flags")
|
|
||||||
mark_as_advanced(SDL_SOUND_EXTRAS)
|
|
||||||
|
|
||||||
# Find SDL_sound.h
|
|
||||||
find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
|
|
||||||
HINTS
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(SDL_SOUND_LIBRARY
|
|
||||||
NAMES SDL_sound
|
|
||||||
HINTS
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
)
|
|
||||||
|
|
||||||
if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
|
|
||||||
|
|
||||||
# CMake is giving me problems using TRY_COMPILE with the CMAKE_FLAGS
|
|
||||||
# for the :STRING syntax if I have multiple values contained in a
|
|
||||||
# single variable. This is a problem for the SDL_LIBRARY variable
|
|
||||||
# because it does just that. When I feed this variable to the command,
|
|
||||||
# only the first value gets the appropriate modifier (e.g. -I) and
|
|
||||||
# the rest get dropped.
|
|
||||||
# To get multiple single variables to work, I must separate them with a "\;"
|
|
||||||
# I could go back and modify the FindSDL.cmake module, but that's kind of painful.
|
|
||||||
# The solution would be to try something like:
|
|
||||||
# set(SDL_TRY_COMPILE_LIBRARY_LIST "${SDL_TRY_COMPILE_LIBRARY_LIST}\;${CMAKE_THREAD_LIBS_INIT}")
|
|
||||||
# Instead, it was suggested on the mailing list to write a temporary CMakeLists.txt
|
|
||||||
# with a temporary test project and invoke that with TRY_COMPILE.
|
|
||||||
# See message thread "Figuring out dependencies for a library in order to build"
|
|
||||||
# 2005-07-16
|
|
||||||
# try_compile(
|
|
||||||
# MY_RESULT
|
|
||||||
# ${CMAKE_BINARY_DIR}
|
|
||||||
# ${PROJECT_SOURCE_DIR}/DetermineSoundLibs.c
|
|
||||||
# CMAKE_FLAGS
|
|
||||||
# -DINCLUDE_DIRECTORIES:STRING=${SDL_INCLUDE_DIR}\;${SDL_SOUND_INCLUDE_DIR}
|
|
||||||
# -DLINK_LIBRARIES:STRING=${SDL_SOUND_LIBRARY}\;${SDL_LIBRARY}
|
|
||||||
# OUTPUT_VARIABLE MY_OUTPUT
|
|
||||||
# )
|
|
||||||
|
|
||||||
# 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}/CMakeTmp/DetermineSoundLibs.c
|
|
||||||
"#include \"SDL_sound.h\"
|
|
||||||
#include \"SDL.h\"
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
Sound_AudioInfo desired;
|
|
||||||
Sound_Sample* sample;
|
|
||||||
|
|
||||||
SDL_Init(0);
|
|
||||||
Sound_Init();
|
|
||||||
|
|
||||||
/* This doesn't actually have to work, but Init() is a no-op
|
|
||||||
* for some of the decoders, so this should force more symbols
|
|
||||||
* to be pulled in.
|
|
||||||
*/
|
|
||||||
sample = Sound_NewSampleFromFile(argv[1], &desired, 4096);
|
|
||||||
|
|
||||||
Sound_Quit();
|
|
||||||
SDL_Quit();
|
|
||||||
return 0;
|
|
||||||
}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
# 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}/CMakeTmp/CMakeLists.txt
|
|
||||||
"cmake_minimum_required(VERSION 2.8)
|
|
||||||
project(DetermineSoundLibs)
|
|
||||||
include_directories(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
|
|
||||||
add_executable(DetermineSoundLibs DetermineSoundLibs.c)
|
|
||||||
target_link_libraries(DetermineSoundLibs ${TMP_TRY_LIBS})"
|
|
||||||
)
|
|
||||||
|
|
||||||
try_compile(
|
|
||||||
MY_RESULT
|
|
||||||
${PROJECT_BINARY_DIR}/CMakeTmp
|
|
||||||
${PROJECT_BINARY_DIR}/CMakeTmp
|
|
||||||
DetermineSoundLibs
|
|
||||||
OUTPUT_VARIABLE MY_OUTPUT
|
|
||||||
)
|
|
||||||
|
|
||||||
# message("${MY_RESULT}")
|
|
||||||
# message(${MY_OUTPUT})
|
|
||||||
|
|
||||||
if(NOT MY_RESULT)
|
|
||||||
|
|
||||||
# I expect that MPGLIB, VOC, WAV, AIFF, and SHN are compiled in statically.
|
|
||||||
# I think Timidity is also compiled in statically.
|
|
||||||
# I've never had to explcitly link against Quicktime, so I'll skip that for now.
|
|
||||||
|
|
||||||
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARY})
|
|
||||||
|
|
||||||
# Find MikMod
|
|
||||||
if("${MY_OUTPUT}" MATCHES "MikMod_")
|
|
||||||
find_library(MIKMOD_LIBRARY
|
|
||||||
NAMES libmikmod-coreaudio mikmod
|
|
||||||
PATHS
|
|
||||||
ENV MIKMODDIR
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib
|
|
||||||
)
|
|
||||||
if(MIKMOD_LIBRARY)
|
|
||||||
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY})
|
|
||||||
endif(MIKMOD_LIBRARY)
|
|
||||||
endif("${MY_OUTPUT}" MATCHES "MikMod_")
|
|
||||||
|
|
||||||
# Find ModPlug
|
|
||||||
if("${MY_OUTPUT}" MATCHES "MODPLUG_")
|
|
||||||
find_library(MODPLUG_LIBRARY
|
|
||||||
NAMES modplug
|
|
||||||
PATHS
|
|
||||||
ENV MODPLUGDIR
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib
|
|
||||||
)
|
|
||||||
if(MODPLUG_LIBRARY)
|
|
||||||
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MODPLUG_LIBRARY})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Find Ogg and Vorbis
|
|
||||||
if("${MY_OUTPUT}" MATCHES "ov_")
|
|
||||||
find_library(VORBIS_LIBRARY
|
|
||||||
NAMES vorbis Vorbis VORBIS
|
|
||||||
PATHS
|
|
||||||
ENV VORBISDIR
|
|
||||||
ENV OGGDIR
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib
|
|
||||||
)
|
|
||||||
if(VORBIS_LIBRARY)
|
|
||||||
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_library(OGG_LIBRARY
|
|
||||||
NAMES ogg Ogg OGG
|
|
||||||
PATHS
|
|
||||||
ENV OGGDIR
|
|
||||||
ENV VORBISDIR
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib
|
|
||||||
)
|
|
||||||
if(OGG_LIBRARY)
|
|
||||||
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Find SMPEG
|
|
||||||
if("${MY_OUTPUT}" MATCHES "SMPEG_")
|
|
||||||
find_library(SMPEG_LIBRARY
|
|
||||||
NAMES smpeg SMPEG Smpeg SMpeg
|
|
||||||
PATHS
|
|
||||||
ENV SMPEGDIR
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib
|
|
||||||
)
|
|
||||||
if(SMPEG_LIBRARY)
|
|
||||||
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SMPEG_LIBRARY})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Find FLAC
|
|
||||||
if("${MY_OUTPUT}" MATCHES "FLAC_")
|
|
||||||
find_library(FLAC_LIBRARY
|
|
||||||
NAMES flac FLAC
|
|
||||||
PATHS
|
|
||||||
ENV FLACDIR
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib
|
|
||||||
)
|
|
||||||
if(FLAC_LIBRARY)
|
|
||||||
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${FLAC_LIBRARY})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Hmmm...Speex seems to depend on Ogg. This might be a problem if
|
|
||||||
# the TRY_COMPILE attempt gets blocked at SPEEX before it can pull
|
|
||||||
# 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_library(SPEEX_LIBRARY
|
|
||||||
NAMES speex SPEEX
|
|
||||||
PATHS
|
|
||||||
ENV SPEEXDIR
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
PATH_SUFFIXES
|
|
||||||
lib
|
|
||||||
)
|
|
||||||
if(SPEEX_LIBRARY)
|
|
||||||
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Find OGG (needed for Speex)
|
|
||||||
# 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
|
|
||||||
ENV VORBISDIR
|
|
||||||
ENV SPEEXDIR
|
|
||||||
ENV SDLSOUNDDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
)
|
|
||||||
if(OGG_LIBRARY)
|
|
||||||
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
else()
|
|
||||||
set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY}" CACHE INTERNAL "SDL_sound and dependent libraries")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SDL_SOUND_INCLUDE_DIR AND EXISTS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h")
|
|
||||||
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SOUND_VER_MAJOR[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MINOR_LINE REGEX "^#define[ \t]+SOUND_VER_MINOR[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_PATCH_LINE REGEX "^#define[ \t]+SOUND_VER_PATCH[ \t]+[0-9]+$")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MAJOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MAJOR "${SDL_SOUND_VERSION_MAJOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MINOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MINOR "${SDL_SOUND_VERSION_MINOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_PATCH[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_PATCH "${SDL_SOUND_VERSION_PATCH_LINE}")
|
|
||||||
set(SDL_SOUND_VERSION_STRING ${SDL_SOUND_VERSION_MAJOR}.${SDL_SOUND_VERSION_MINOR}.${SDL_SOUND_VERSION_PATCH})
|
|
||||||
unset(SDL_SOUND_VERSION_MAJOR_LINE)
|
|
||||||
unset(SDL_SOUND_VERSION_MINOR_LINE)
|
|
||||||
unset(SDL_SOUND_VERSION_PATCH_LINE)
|
|
||||||
unset(SDL_SOUND_VERSION_MAJOR)
|
|
||||||
unset(SDL_SOUND_VERSION_MINOR)
|
|
||||||
unset(SDL_SOUND_VERSION_PATCH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
|
||||||
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_sound
|
|
||||||
REQUIRED_VARS SDL_SOUND_LIBRARY SDL_SOUND_INCLUDE_DIR
|
|
||||||
VERSION_VAR SDL_SOUND_VERSION_STRING)
|
|
@ -1,88 +0,0 @@
|
|||||||
# - Locate SDL_ttf library
|
|
||||||
# This module defines:
|
|
||||||
# SDL_TTF_LIBRARIES, the name of the library to link against
|
|
||||||
# SDL_TTF_INCLUDE_DIRS, where to find the headers
|
|
||||||
# SDL_TTF_FOUND, if false, do not try to link against
|
|
||||||
# SDL_TTF_VERSION_STRING - human-readable string containing the version of SDL_ttf
|
|
||||||
#
|
|
||||||
# For backward compatiblity the following variables are also set:
|
|
||||||
# SDLTTF_LIBRARY (same value as SDL_TTF_LIBRARIES)
|
|
||||||
# SDLTTF_INCLUDE_DIR (same value as SDL_TTF_INCLUDE_DIRS)
|
|
||||||
# SDLTTF_FOUND (same value as SDL_TTF_FOUND)
|
|
||||||
#
|
|
||||||
# $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).
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2005-2009 Kitware, Inc.
|
|
||||||
# Copyright 2012 Benjamin Eikel
|
|
||||||
#
|
|
||||||
# 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.)
|
|
||||||
|
|
||||||
if(NOT SDL_TTF_INCLUDE_DIR AND SDLTTF_INCLUDE_DIR)
|
|
||||||
set(SDL_TTF_INCLUDE_DIR ${SDLTTF_INCLUDE_DIR} CACHE PATH "directory cache
|
|
||||||
entry initialized from old variable name")
|
|
||||||
endif()
|
|
||||||
find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
|
|
||||||
HINTS
|
|
||||||
ENV SDLTTFDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES include/SDL2 include
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY)
|
|
||||||
set(SDL_TTF_LIBRARY ${SDLTTF_LIBRARY} CACHE FILEPATH "file cache entry
|
|
||||||
initialized from old variable name")
|
|
||||||
endif()
|
|
||||||
find_library(SDL_TTF_LIBRARY
|
|
||||||
NAMES SDL2_ttf
|
|
||||||
HINTS
|
|
||||||
ENV SDLTTFDIR
|
|
||||||
ENV SDLDIR
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
)
|
|
||||||
|
|
||||||
if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h")
|
|
||||||
file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+[0-9]+$")
|
|
||||||
file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+[0-9]+$")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MAJOR "${SDL_TTF_VERSION_MAJOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MINOR "${SDL_TTF_VERSION_MINOR_LINE}")
|
|
||||||
string(REGEX REPLACE "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_PATCH "${SDL_TTF_VERSION_PATCH_LINE}")
|
|
||||||
set(SDL_TTF_VERSION_STRING ${SDL_TTF_VERSION_MAJOR}.${SDL_TTF_VERSION_MINOR}.${SDL_TTF_VERSION_PATCH})
|
|
||||||
unset(SDL_TTF_VERSION_MAJOR_LINE)
|
|
||||||
unset(SDL_TTF_VERSION_MINOR_LINE)
|
|
||||||
unset(SDL_TTF_VERSION_PATCH_LINE)
|
|
||||||
unset(SDL_TTF_VERSION_MAJOR)
|
|
||||||
unset(SDL_TTF_VERSION_MINOR)
|
|
||||||
unset(SDL_TTF_VERSION_PATCH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SDL_TTF_LIBRARIES ${SDL_TTF_LIBRARY})
|
|
||||||
set(SDL_TTF_INCLUDE_DIRS ${SDL_TTF_INCLUDE_DIR})
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_ttf
|
|
||||||
REQUIRED_VARS SDL_TTF_LIBRARIES SDL_TTF_INCLUDE_DIRS
|
|
||||||
VERSION_VAR SDL_TTF_VERSION_STRING)
|
|
||||||
|
|
||||||
# for backward compatiblity
|
|
||||||
set(SDLTTF_LIBRARY ${SDL_TTF_LIBRARIES})
|
|
||||||
set(SDLTTF_INCLUDE_DIR ${SDL_TTF_INCLUDE_DIRS})
|
|
||||||
set(SDLTTF_FOUND ${SDL_TTF_FOUND})
|
|
||||||
|
|
||||||
mark_as_advanced(SDL_TTF_LIBRARY SDL_TTF_INCLUDE_DIR)
|
|
Loading…
Reference in New Issue
Block a user