1 2### SuperTux - Removed unused vorbisenc library 3 4# - Try to find the OggVorbis libraries 5# Once done this will define 6# 7# OGGVORBIS_FOUND - system has OggVorbis 8# OGGVORBIS_VERSION - set either to 1 or 2 9# OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory 10# OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis 11# OGG_LIBRARY - The Ogg library 12# VORBIS_LIBRARY - The Vorbis library 13# VORBISFILE_LIBRARY - The VorbisFile library 14# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se> 15# 16# Redistribution and use is allowed according to the terms of the BSD license. 17# For details see the accompanying COPYING-CMAKE-SCRIPTS file. 18 19include (CheckLibraryExists) 20find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) 21find_path(VORBIS_INCLUDE_DIR NAMES vorbis/vorbisfile.h PATHS "${VORBIS_INCLUDE_DIR}" "${DEPENDENCY_FOLDER}/include") 22 23find_library(OGG_LIBRARY NAMES ogg) 24find_library(VORBIS_LIBRARY NAMES vorbis) 25find_library(VORBISFILE_LIBRARY NAMES vorbisfile) 26find_library(OGG_LIBRARY NAMES ogg Ogg libogg PATHS "${DEPENDENCY_FOLDER}/lib") 27find_library(VORBIS_LIBRARY NAMES vorbis Vorbis libvorbis PATHS "${DEPENDENCY_FOLDER}/lib") 28find_library(VORBISFILE_LIBRARY NAMES vorbisfile libvorbisfile PATHS "${DEPENDENCY_FOLDER}/lib") 29 30if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY) 31 set(OGGVORBIS_FOUND TRUE) 32# [sommer] (for SuperTux) reversed order of libraries, so that cmake 2.4.5 for Windows generates an MSYS Makefile that will link correctly 33# set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY}) 34 set(OGGVORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY}) 35 set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES}) 36 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES}) 37 check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) 38 set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP}) 39 if (HAVE_LIBVORBISENC2) 40 set (OGGVORBIS_VERSION 2) 41 else (HAVE_LIBVORBISENC2) 42 set (OGGVORBIS_VERSION 1) 43 endif (HAVE_LIBVORBISENC2) 44else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY) 45 set (OGGVORBIS_VERSION) 46 set(OGGVORBIS_FOUND FALSE) 47endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY) 48if (OGGVORBIS_FOUND) 49 if (NOT OggVorbis_FIND_QUIETLY) 50 message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}") 51 endif (NOT OggVorbis_FIND_QUIETLY) 52else (OGGVORBIS_FOUND) 53 if (OggVorbis_FIND_REQUIRED) 54 message(FATAL_ERROR "Could NOT find OggVorbis libraries") 55 endif (OggVorbis_FIND_REQUIRED) 56 if (NOT OggVorbis_FIND_QUIETLY) 57 message(STATUS "Could NOT find OggVorbis libraries") 58 endif (NOT OggVorbis_FIND_QUIETLY) 59endif (OGGVORBIS_FOUND) 60#check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H) 61#check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG) 62#check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS) 63#check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE) 64#check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) 65#if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE) 66# message(STATUS "Ogg/Vorbis found") 67# set (VORBIS_LIBS "-lvorbis -logg") 68# set (VORBISFILE_LIBS "-lvorbisfile") 69# set (OGGVORBIS_FOUND TRUE) 70# if (HAVE_LIBVORBISENC2) 71# set (HAVE_VORBIS 2) 72# else (HAVE_LIBVORBISENC2) 73# set (HAVE_VORBIS 1) 74# endif (HAVE_LIBVORBISENC2) 75#else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE) 76# message(STATUS "Ogg/Vorbis not found") 77#endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE) 78 79