cmake_modules/FindOggVorbis.cmake
author unc0rr
Sun, 30 Aug 2009 08:04:59 +0000
changeset 2337 723f1cbe2ef3
parent 2336 66c751f7a28e
child 2395 d01d3bf3e1de
permissions -rw-r--r--
Some preparation for room control delegation support
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2214
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
     1
### SuperTux - Removed unused vorbisenc library
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents: 2194
diff changeset
     2
2214
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
     3
# - Try to find the OggVorbis libraries
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
     4
# Once done this will define
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
     5
#
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
     6
#  OGGVORBIS_FOUND - system has OggVorbis
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
     7
#  OGGVORBIS_VERSION - set either to 1 or 2
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
     8
#  OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
     9
#  OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    10
#  OGG_LIBRARY         - The Ogg library
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    11
#  VORBIS_LIBRARY      - The Vorbis library
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    12
#  VORBISFILE_LIBRARY  - The VorbisFile library
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    13
# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se>
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    14
#
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    15
# Redistribution and use is allowed according to the terms of the BSD license.
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    16
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
2194
1597710c6118 koda adds threading for fadein/out. Untested under windows, but works beautifully under Linux (and presumably OSX, right koda?)
nemo
parents:
diff changeset
    17
2214
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    18
include (CheckLibraryExists)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    19
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    20
find_library(OGG_LIBRARY NAMES ogg)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    21
find_library(VORBIS_LIBRARY NAMES vorbis)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    22
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
2336
66c751f7a28e fix windows compilation with dll (frontend and engine)
koda
parents: 2214
diff changeset
    23
if (OGG_LIBRARY AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
2214
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    24
   set(OGGVORBIS_FOUND TRUE)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    25
#  [sommer] (for SuperTux) reversed order of libraries, so that cmake 2.4.5 for Windows generates an MSYS Makefile that will link correctly
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    26
#  set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    27
   set(OGGVORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    28
   set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    29
   set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    30
   check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    31
   set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    32
   if (HAVE_LIBVORBISENC2)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    33
      set (OGGVORBIS_VERSION 2)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    34
   else (HAVE_LIBVORBISENC2)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    35
      set (OGGVORBIS_VERSION 1)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    36
   endif (HAVE_LIBVORBISENC2)
2336
66c751f7a28e fix windows compilation with dll (frontend and engine)
koda
parents: 2214
diff changeset
    37
else ()
2214
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    38
   set (OGGVORBIS_VERSION)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    39
   set(OGGVORBIS_FOUND FALSE)
2336
66c751f7a28e fix windows compilation with dll (frontend and engine)
koda
parents: 2214
diff changeset
    40
endif ()
2214
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    41
if (OGGVORBIS_FOUND)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    42
   if (NOT OggVorbis_FIND_QUIETLY)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    43
      message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    44
   endif (NOT OggVorbis_FIND_QUIETLY)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    45
else (OGGVORBIS_FOUND)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    46
   if (OggVorbis_FIND_REQUIRED)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    47
      message(FATAL_ERROR "Could NOT find OggVorbis libraries")
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    48
   endif (OggVorbis_FIND_REQUIRED)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    49
   if (NOT OggVorbis_FIND_QUIETLY)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    50
      message(STATUS "Could NOT find OggVorbis libraries")
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    51
   endif (NOT OggVorbis_FIND_QUIETLY)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    52
endif (OGGVORBIS_FOUND)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    53
#check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    54
#check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    55
#check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    56
#check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    57
#check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    58
#if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    59
#    message(STATUS "Ogg/Vorbis found")
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    60
#    set (VORBIS_LIBS "-lvorbis -logg")
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    61
#    set (VORBISFILE_LIBS "-lvorbisfile")
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    62
#    set (OGGVORBIS_FOUND TRUE)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    63
#    if (HAVE_LIBVORBISENC2)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    64
#        set (HAVE_VORBIS 2)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    65
#    else (HAVE_LIBVORBISENC2)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    66
#        set (HAVE_VORBIS 1)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    67
#    endif (HAVE_LIBVORBISENC2)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    68
#else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE)
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    69
#    message(STATUS "Ogg/Vorbis not found")
eacb5b19d587 -new FindOggVorbis, should work everywhere now
koda
parents: 2211
diff changeset
    70
#endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE)
2194
1597710c6118 koda adds threading for fadein/out. Untested under windows, but works beautifully under Linux (and presumably OSX, right koda?)
nemo
parents:
diff changeset
    71
1597710c6118 koda adds threading for fadein/out. Untested under windows, but works beautifully under Linux (and presumably OSX, right koda?)
nemo
parents:
diff changeset
    72