Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 4, 2010, 9:39:17 PM (14 years ago)
Author:
youngk
Message:

ALUT is now automatically found on the Mac

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ois_update/cmake/tools/FindALUT.cmake

    r7163 r7615  
    1 # - Locate FreeAlut
     1# Find ALUT includes and library
     2#
    23# This module defines
    3 #  ALUT_LIBRARY
    4 #  ALUT_FOUND, if false, do not try to link against Alut
    5 #  ALUT_INCLUDE_DIR, where to find the headers
     4#  ALUT_INCLUDE_DIR
     5#  ALUT_LIBRARY, the library to link against to use ALUT.
     6#  ALUT_FOUND, If false, do not try to use ALUT
    67#
    7 # $ALUTDIR is an environment variable that would
    8 # correspond to the ./configure --prefix=$ALUTDIR
    9 # used in building Alut.
     8# Copyright © 2007, Matt Williams
     9# Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture
     10# of the ETH Zurich (removed later on)
    1011#
    11 # Created by Eric Wing. This was influenced by the FindSDL.cmake module.
    12 # On OSX, this will prefer the Framework version (if found) over others.
    13 # People will have to manually change the cache values of
    14 # ALUT_LIBRARY to override this selection.
    15 # Tiger will include OpenAL as part of the System.
    16 # But for now, we have to look around.
    17 # Other (Unix) systems should be able to utilize the non-framework paths.
     12# Redistribution and use is allowed according to the terms of the BSD license.
    1813#
    1914# Several changes and additions by Fabian 'x3n' Landau
    20 # Some simplifications by Adrian Friedli and Reto Grieder
     15# Lots of simplifications by Adrian Friedli
     16# Version checking by Reto Grieder
     17# Adaption of the OGRE find script to ALUT by Kevin Young
    2118#                 > www.orxonox.net <
    2219
    23 INCLUDE(FindPackageHandleStandardArgs)
     20INCLUDE(FindPackageHandleAdvancedArgs)
    2421INCLUDE(HandleLibraryTypes)
    2522
    26 FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
    27   PATHS
    28   $ENV{ALUTDIR}
    29   ~/Library/Frameworks/OpenAL.framework
    30   /Library/Frameworks/OpenAL.framework
    31   /System/Library/Frameworks/OpenAL.framework # Tiger
    32   PATH_SUFFIXES include include/OpenAL include/AL Headers
     23FIND_PATH(ALUT_INCLUDE_DIR alut.h
     24  PATHS $ENV{ALUTDIR}
     25  PATH_SUFFIXES include include/AL ALUT
     26)
     27FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
     28  NAMES ALUT
     29  PATHS $ENV{ALUTDIR}
     30  PATH_SUFFIXES lib bin/Release bin/release Release release ALUT
     31)
     32FIND_LIBRARY(ALUT_LIBRARY_DEBUG
     33  NAMES ALUTD alutd alut_d alutD alut_D
     34  PATHS $ENV{ALUTDIR}
     35  PATH_SUFFIXES lib bin/Debug bin/debug Debug debug ALUT
    3336)
    3437
    35 # I'm not sure if I should do a special casing for Apple. It is
    36 # unlikely that other Unix systems will find the framework path.
    37 # But if they do ([Next|Open|GNU]Step?),
    38 # do they want the -framework option also?
    39 IF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
    40 
    41   STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR})
    42   IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
    43       OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
    44       )
    45     # String is in default search path, don't need to use -F
    46     SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
    47   ELSE()
    48     # String is not /Library/Frameworks, need to use -F
    49     SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
    50   ENDIF()
    51   # Clear the temp variable so nobody can see it
    52   SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
    53 
    54 ELSE()
    55   FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
    56     NAMES alut
    57     PATHS $ENV{ALUTDIR}
    58     PATH_SUFFIXES lib libs
    59   )
    60   FIND_LIBRARY(ALUT_LIBRARY_DEBUG
    61     NAMES alutd alut_d alutD alut_D
    62     PATHS $ENV{ALUTDIR}
    63     PATH_SUFFIXES lib libs
    64   )
    65 ENDIF()
    66 
    6738# Handle the REQUIRED argument and set ALUT_FOUND
    68 FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG
    69     ALUT_LIBRARY_OPTIMIZED
    70     ALUT_INCLUDE_DIR
     39# Also check the version requirements
     40FIND_PACKAGE_HANDLE_ADVANCED_ARGS(ALUT DEFAULT_MSG
     41  ALUT_LIBRARY_OPTIMIZED
     42  ALUT_INCLUDE_DIR
    7143)
    7244
     
    7547
    7648MARK_AS_ADVANCED(
    77     ALUT_INCLUDE_DIR
    78     ALUT_LIBRARY_OPTIMIZED
    79     ALUT_LIBRARY_DEBUG
     49  ALUT_INCLUDE_DIR
     50  ALUT_LIBRARY_OPTIMIZED
     51  ALUT_LIBRARY_DEBUG
    8052)
Note: See TracChangeset for help on using the changeset viewer.