annotate CMakeLists.txt @ 13:92b416b4e027

fixed all problems for 16 bit mono output
author Robert McIntyre <rlm@mit.edu>
date Mon, 31 Oct 2011 07:44:02 -0700
parents 17ace5a879b2
children
rev   line source
rlm@0 1 # CMake build file list for OpenAL
rlm@0 2
rlm@0 3 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
rlm@0 4
rlm@0 5 IF(COMMAND CMAKE_POLICY)
rlm@0 6 CMAKE_POLICY(SET CMP0003 NEW)
rlm@0 7 ENDIF(COMMAND CMAKE_POLICY)
rlm@0 8
rlm@0 9 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
rlm@0 10
rlm@0 11 INCLUDE(CheckFunctionExists)
rlm@0 12 INCLUDE(CheckLibraryExists)
rlm@0 13 INCLUDE(CheckSharedFunctionExists)
rlm@0 14 INCLUDE(CheckIncludeFile)
rlm@0 15 INCLUDE(CheckIncludeFiles)
rlm@0 16 INCLUDE(CheckSymbolExists)
rlm@0 17 INCLUDE(CheckCCompilerFlag)
rlm@0 18 INCLUDE(CheckCSourceCompiles)
rlm@0 19 INCLUDE(CheckTypeSize)
rlm@0 20
rlm@0 21
rlm@0 22 PROJECT(OpenAL C)
rlm@0 23
rlm@0 24
rlm@0 25 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
rlm@0 26
rlm@0 27
rlm@0 28 OPTION(SEND "Enable Send Backend" ON)
rlm@0 29
rlm@0 30 OPTION(DLOPEN "Check for the dlopen API for loading optional libs" ON)
rlm@0 31
rlm@0 32 OPTION(WERROR "Treat compile warnings as errors" OFF)
rlm@0 33
rlm@0 34 OPTION(UTILS "Build and install utility programs" ON)
rlm@0 35
rlm@0 36
rlm@0 37 IF(WIN32)
rlm@0 38 SET(LIBNAME OpenAL32)
rlm@0 39 ADD_DEFINITIONS("-D_WIN32")
rlm@0 40 ELSE()
rlm@0 41 SET(LIBNAME openal)
rlm@0 42 ENDIF()
rlm@0 43
rlm@0 44 IF(NOT LIBTYPE)
rlm@0 45 SET(LIBTYPE SHARED)
rlm@0 46 ENDIF()
rlm@0 47
rlm@0 48 SET(LIB_MAJOR_VERSION "1")
rlm@0 49 SET(LIB_MINOR_VERSION "13")
rlm@0 50 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}")
rlm@0 51
rlm@0 52 SET(EXPORT_DECL "")
rlm@0 53
rlm@0 54
rlm@0 55 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
rlm@0 56 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
rlm@0 57 CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT)
rlm@0 58 CHECK_TYPE_SIZE("void*" SIZEOF_VOIDP)
rlm@0 59
rlm@0 60
rlm@0 61 CHECK_C_SOURCE_COMPILES("int *restrict foo;
rlm@0 62 int main() {return 0;}" HAVE_RESTRICT)
rlm@0 63 CHECK_C_SOURCE_COMPILES("int *__restrict foo;
rlm@0 64 int main() {return 0;}" HAVE___RESTRICT)
rlm@0 65
rlm@0 66
rlm@0 67 # Add definitions, compiler switches, etc.
rlm@7 68 INCLUDE_DIRECTORIES(OpenAL32/Include include "${OpenAL_BINARY_DIR}" java/headers)
rlm@0 69
rlm@0 70 IF(NOT CMAKE_BUILD_TYPE)
rlm@0 71 SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
rlm@0 72 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
rlm@0 73 FORCE)
rlm@0 74 ENDIF()
rlm@0 75 IF(NOT CMAKE_DEBUG_POSTFIX)
rlm@0 76 SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
rlm@0 77 "Library postfix for debug builds. Normally left blank."
rlm@0 78 FORCE)
rlm@0 79 ENDIF()
rlm@0 80
rlm@0 81
rlm@0 82
rlm@0 83 IF(MSVC)
rlm@0 84 # ???
rlm@0 85 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_DEBUG")
rlm@0 86 SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG")
rlm@0 87 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
rlm@0 88 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
rlm@0 89 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
rlm@0 90 ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
rlm@0 91
rlm@0 92 IF(NOT DXSDK_DIR)
rlm@0 93 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
rlm@0 94 ELSE()
rlm@0 95 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
rlm@0 96 ENDIF()
rlm@0 97 IF(DXSDK_DIR)
rlm@0 98 MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
rlm@0 99 SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${DXSDK_DIR}/Include")
rlm@0 100 INCLUDE_DIRECTORIES("${DXSDK_DIR}/Include")
rlm@0 101 LINK_DIRECTORIES("${DXSDK_DIR}/Lib")
rlm@0 102 ENDIF()
rlm@0 103
rlm@0 104 OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
rlm@0 105 IF(FORCE_STATIC_VCRT)
rlm@0 106 FOREACH(flag_var
rlm@0 107 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
rlm@0 108 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
rlm@0 109 IF(${flag_var} MATCHES "/MD")
rlm@0 110 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
rlm@0 111 ENDIF()
rlm@0 112 ENDFOREACH(flag_var)
rlm@0 113 ENDIF()
rlm@0 114 ELSE()
rlm@0 115 ADD_DEFINITIONS(-Winline -Wall)
rlm@0 116 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
rlm@0 117 IF(HAVE_W_EXTRA)
rlm@0 118 ADD_DEFINITIONS(-Wextra)
rlm@0 119 ENDIF()
rlm@0 120
rlm@0 121 IF(WERROR)
rlm@0 122 ADD_DEFINITIONS(-Werror)
rlm@0 123 ENDIF()
rlm@0 124
rlm@0 125 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -D_DEBUG" CACHE STRING
rlm@0 126 "Flags used by the compiler during Release with Debug Info builds."
rlm@0 127 FORCE)
rlm@0 128 SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING
rlm@0 129 "Flags used by the compiler during release minsize builds."
rlm@0 130 FORCE)
rlm@0 131 SET(CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -DNDEBUG" CACHE STRING
rlm@0 132 "Flags used by the compiler during release builds"
rlm@0 133 FORCE)
rlm@0 134 SET(CMAKE_C_FLAGS_DEBUG "-g3 -D_DEBUG" CACHE STRING
rlm@0 135 "Flags used by the compiler during debug builds."
rlm@0 136 FORCE)
rlm@0 137
rlm@0 138 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
rlm@0 139 int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
rlm@0 140 ENDIF()
rlm@0 141
rlm@0 142 # Set visibility/export options if available
rlm@0 143 IF(WIN32)
rlm@0 144 SET(EXPORT_DECL "__declspec(dllexport)")
rlm@0 145
rlm@0 146 OPTION(WINE "Enable use of Wine headers when compiling" OFF)
rlm@0 147 IF(WINE)
rlm@0 148 FIND_PATH(WINE_INCLUDE_DIR library.h
rlm@0 149 PATHS
rlm@0 150 /usr/include/wine
rlm@0 151 /usr/local/include/wine
rlm@0 152 CMAKE_FIND_ROOT_PATH_BOTH)
rlm@0 153 IF(WINE_INCLUDE_DIR)
rlm@0 154 MESSAGE(STATUS "Found Wine header files - ${WINE_INCLUDE_DIR}" )
rlm@0 155 INCLUDE_DIRECTORIES("${WINE_INCLUDE_DIR}/windows")
rlm@0 156 SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${WINE_INCLUDE_DIR}/windows")
rlm@0 157 ELSE()
rlm@0 158 MESSAGE(STATUS "Could not find Wine header files" )
rlm@0 159 ENDIF()
rlm@0 160 ENDIF()
rlm@0 161 ELSE()
rlm@0 162 CHECK_C_COMPILER_FLAG(-fvisibility=internal HAVE_VISIBILITY_SWITCH)
rlm@0 163 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
rlm@0 164 int main() {return 0;}" HAVE_GCC_VISIBILITY)
rlm@0 165 IF(HAVE_VISIBILITY_SWITCH AND HAVE_GCC_VISIBILITY)
rlm@0 166 #ADD_DEFINITIONS(-fvisibility=internal)
rlm@0 167 #SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
rlm@0 168 ENDIF()
rlm@0 169 ENDIF()
rlm@0 170
rlm@0 171 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
rlm@0 172 int main() {return 0;}" HAVE_GCC_FORMAT)
rlm@0 173
rlm@0 174 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
rlm@0 175 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
rlm@0 176 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
rlm@0 177 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
rlm@0 178 IF(NOT HAVE_GUIDDEF_H)
rlm@0 179 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
rlm@0 180 ENDIF()
rlm@0 181 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H)
rlm@0 182
rlm@0 183 CHECK_LIBRARY_EXISTS(m powf "" HAVE_POWF)
rlm@0 184 CHECK_LIBRARY_EXISTS(m sqrtf "" HAVE_SQRTF)
rlm@0 185 CHECK_LIBRARY_EXISTS(m acosf "" HAVE_ACOSF)
rlm@0 186 CHECK_LIBRARY_EXISTS(m atanf "" HAVE_ATANF)
rlm@0 187 CHECK_LIBRARY_EXISTS(m fabsf "" HAVE_FABSF)
rlm@0 188 IF(HAVE_FENV_H)
rlm@0 189 CHECK_LIBRARY_EXISTS(m fesetround "" HAVE_FESETROUND)
rlm@0 190 ENDIF()
rlm@0 191 IF(HAVE_SQRTF OR HAVE_ACOSF OR HAVE_ATANF OR HAVE_FABSF OR HAVE_FESETROUND)
rlm@0 192 SET(EXTRA_LIBS m ${EXTRA_LIBS})
rlm@0 193 ENDIF()
rlm@0 194 CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
rlm@0 195 CHECK_FUNCTION_EXISTS(_controlfp HAVE__CONTROLFP)
rlm@0 196
rlm@0 197 CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
rlm@0 198 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
rlm@0 199 IF(NOT HAVE_STRCASECMP)
rlm@0 200 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
rlm@0 201 IF(NOT HAVE__STRICMP)
rlm@0 202 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
rlm@0 203 ENDIF()
rlm@0 204
rlm@0 205 ADD_DEFINITIONS(-Dstrcasecmp=_stricmp)
rlm@0 206 ENDIF()
rlm@0 207
rlm@0 208 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
rlm@0 209 IF(NOT HAVE_STRNCASECMP)
rlm@0 210 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
rlm@0 211 IF(NOT HAVE__STRNICMP)
rlm@0 212 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
rlm@0 213 ENDIF()
rlm@0 214
rlm@0 215 ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp)
rlm@0 216 ENDIF()
rlm@0 217
rlm@0 218 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
rlm@0 219 IF(NOT HAVE_SNPRINTF)
rlm@0 220 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
rlm@0 221 IF(NOT HAVE__SNPRINTF)
rlm@0 222 MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
rlm@0 223 ENDIF()
rlm@0 224
rlm@0 225 ADD_DEFINITIONS(-Dsnprintf=_snprintf)
rlm@0 226 ENDIF()
rlm@0 227
rlm@0 228 CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF)
rlm@0 229 IF(NOT HAVE_VSNPRINTF)
rlm@0 230 CHECK_FUNCTION_EXISTS(_vsnprintf HAVE__VSNPRINTF)
rlm@0 231 IF(NOT HAVE__VSNPRINTF)
rlm@0 232 MESSAGE(FATAL_ERROR "No vsnprintf function found, please report!")
rlm@0 233 ENDIF()
rlm@0 234
rlm@0 235 ADD_DEFINITIONS(-Dvsnprintf=_vsnprintf)
rlm@0 236 ENDIF()
rlm@0 237
rlm@0 238 CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
rlm@0 239 IF(NOT HAVE_ISFINITE)
rlm@0 240 CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
rlm@0 241 IF(NOT HAVE_FINITE)
rlm@0 242 CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE)
rlm@0 243 IF(NOT HAVE__FINITE)
rlm@0 244 MESSAGE(FATAL_ERROR "No isfinite function found, please report!")
rlm@0 245 ENDIF()
rlm@0 246 ADD_DEFINITIONS(-Disfinite=_finite)
rlm@0 247 ELSE()
rlm@0 248 ADD_DEFINITIONS(-Disfinite=finite)
rlm@0 249 ENDIF()
rlm@0 250 ENDIF()
rlm@0 251
rlm@0 252 CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
rlm@0 253 IF(NOT HAVE_ISNAN)
rlm@0 254 CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN)
rlm@0 255 IF(NOT HAVE__ISNAN)
rlm@0 256 MESSAGE(FATAL_ERROR "No isnan function found, please report!")
rlm@0 257 ENDIF()
rlm@0 258
rlm@0 259 ADD_DEFINITIONS(-Disnan=_isnan)
rlm@0 260 ENDIF()
rlm@0 261
rlm@0 262
rlm@0 263 # Check for the dlopen API (for dynamicly loading backend libs)
rlm@0 264 IF(DLOPEN)
rlm@0 265 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
rlm@0 266 IF(HAVE_DLFCN_H)
rlm@0 267 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
rlm@0 268 IF(HAVE_LIBDL)
rlm@0 269 SET(EXTRA_LIBS dl ${EXTRA_LIBS})
rlm@0 270 ENDIF()
rlm@0 271 ENDIF()
rlm@0 272 ENDIF()
rlm@0 273
rlm@0 274 # Check if we have Windows headers
rlm@0 275 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0500)
rlm@0 276 IF(NOT HAVE_WINDOWS_H)
rlm@0 277 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
rlm@0 278 IF(NOT HAVE_GETTIMEOFDAY)
rlm@0 279 MESSAGE(FATAL_ERROR "No timing function found!")
rlm@0 280 ENDIF()
rlm@0 281
rlm@0 282 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
rlm@0 283 IF(NOT HAVE_NANOSLEEP)
rlm@0 284 MESSAGE(FATAL_ERROR "No sleep function found!")
rlm@0 285 ENDIF()
rlm@0 286
rlm@0 287 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
rlm@0 288 IF(HAVE_PTHREAD)
rlm@0 289 ADD_DEFINITIONS(-pthread)
rlm@0 290 SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread)
rlm@0 291 ENDIF()
rlm@0 292
rlm@0 293 # We need pthreads outside of Windows
rlm@0 294 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
rlm@0 295 IF(NOT HAVE_PTHREAD_H)
rlm@0 296 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
rlm@0 297 ENDIF()
rlm@0 298 # Some systems need pthread_np.h to get recursive mutexes
rlm@0 299 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
rlm@0 300
rlm@0 301 # _GNU_SOURCE is needed on some systems for extra attributes, and
rlm@0 302 # _REENTRANT is needed for libc thread-safety
rlm@0 303 ADD_DEFINITIONS(-D_GNU_SOURCE=1)
rlm@0 304 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
rlm@0 305 IF(HAVE_LIBPTHREAD)
rlm@0 306 SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
rlm@0 307 ENDIF()
rlm@0 308
rlm@0 309 CHECK_LIBRARY_EXISTS(pthread pthread_setschedparam "" HAVE_PTHREAD_SETSCHEDPARAM)
rlm@0 310
rlm@0 311 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
rlm@0 312 IF(HAVE_LIBRT)
rlm@0 313 SET(EXTRA_LIBS rt ${EXTRA_LIBS})
rlm@0 314 ENDIF()
rlm@0 315 ENDIF()
rlm@0 316
rlm@0 317 # Check for a 64-bit type
rlm@0 318 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
rlm@0 319 IF(NOT HAVE_STDINT_H)
rlm@0 320 IF(HAVE_WINDOWS_H)
rlm@0 321 CHECK_C_SOURCE_COMPILES("\#define _WIN32_WINNT 0x0500
rlm@0 322 \#include <windows.h>
rlm@0 323 __int64 foo;
rlm@0 324 int main() {return 0;}" HAVE___INT64)
rlm@0 325 ENDIF()
rlm@0 326 IF(NOT HAVE___INT64)
rlm@0 327 IF(NOT SIZEOF_LONG MATCHES "8")
rlm@0 328 IF(NOT SIZEOF_LONG_LONG MATCHES "8")
rlm@0 329 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
rlm@0 330 ENDIF()
rlm@0 331 ENDIF()
rlm@0 332 ENDIF()
rlm@0 333 ENDIF()
rlm@0 334
rlm@0 335 # Windows needs winmm for timeGetTime, even if the backend is disabled
rlm@0 336 CHECK_SHARED_FUNCTION_EXISTS(timeGetTime "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
rlm@0 337 IF(HAVE_LIBWINMM)
rlm@0 338 SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
rlm@0 339 SET(PKG_CONFIG_LIBS ${PKG_CONFIG_LIBS} -lwinmm)
rlm@0 340 ENDIF()
rlm@0 341
rlm@0 342
rlm@0 343 SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c
rlm@0 344 OpenAL32/alBuffer.c
rlm@0 345 OpenAL32/alEffect.c
rlm@0 346 OpenAL32/alError.c
rlm@0 347 OpenAL32/alExtension.c
rlm@0 348 OpenAL32/alFilter.c
rlm@0 349 OpenAL32/alListener.c
rlm@0 350 OpenAL32/alSource.c
rlm@0 351 OpenAL32/alState.c
rlm@0 352 OpenAL32/alThunk.c
rlm@0 353 )
rlm@0 354 SET(ALC_OBJS Alc/ALc.c
rlm@0 355 Alc/ALu.c
rlm@0 356 Alc/alcConfig.c
rlm@0 357 Alc/alcDedicated.c
rlm@0 358 Alc/alcEcho.c
rlm@0 359 Alc/alcModulator.c
rlm@0 360 Alc/alcReverb.c
rlm@0 361 Alc/alcRing.c
rlm@0 362 Alc/alcThread.c
rlm@0 363 Alc/bs2b.c
rlm@0 364 Alc/helpers.c
rlm@0 365 Alc/hrtf.c
rlm@0 366 Alc/mixer.c
rlm@0 367 Alc/panning.c
rlm@0 368 # Default backends, always available
rlm@0 369 Alc/backends/loopback.c
rlm@0 370 Alc/backends/null.c
rlm@0 371 # RLM: add send device
rlm@0 372 Alc/backends/send.c
rlm@0 373 )
rlm@0 374
rlm@0 375 SET(BACKENDS "")
rlm@0 376
rlm@0 377
rlm@0 378
rlm@0 379 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/send.c)
rlm@0 380 SET(BACKENDS "${BACKENDS} Send,")
rlm@0 381
rlm@0 382
rlm@0 383 # This is always available
rlm@0 384 SET(BACKENDS "${BACKENDS} Null")
rlm@0 385
rlm@0 386 IF(LIBTYPE STREQUAL "STATIC")
rlm@0 387 ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC)
rlm@0 388 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS})
rlm@0 389 ENDIF()
rlm@0 390
rlm@0 391 # Needed for openal.pc.in
rlm@0 392 SET(prefix ${CMAKE_INSTALL_PREFIX})
rlm@0 393 SET(exec_prefix "\${prefix}")
rlm@0 394 SET(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
rlm@0 395 SET(bindir "\${exec_prefix}/bin")
rlm@0 396 SET(includedir "\${prefix}/include")
rlm@0 397 SET(PACKAGE_VERSION "${LIB_VERSION}")
rlm@0 398
rlm@0 399 # End configuration
rlm@0 400 CONFIGURE_FILE(
rlm@0 401 "${OpenAL_SOURCE_DIR}/config.h.in"
rlm@0 402 "${OpenAL_BINARY_DIR}/config.h")
rlm@0 403 CONFIGURE_FILE(
rlm@0 404 "${OpenAL_SOURCE_DIR}/openal.pc.in"
rlm@0 405 "${OpenAL_BINARY_DIR}/openal.pc"
rlm@0 406 @ONLY)
rlm@0 407
rlm@0 408 # Build a library
rlm@0 409 ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS})
rlm@0 410 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES DEFINE_SYMBOL AL_BUILD_LIBRARY
rlm@0 411 COMPILE_FLAGS -DAL_ALEXT_PROTOTYPES
rlm@0 412 VERSION ${LIB_VERSION}.0
rlm@0 413 SOVERSION ${LIB_MAJOR_VERSION})
rlm@0 414 IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC")
rlm@0 415 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
rlm@0 416 ENDIF()
rlm@0 417
rlm@0 418
rlm@11 419 # RLM: link java
rlm@8 420 find_package (JNI REQUIRED)
rlm@8 421 if (JNI_FOUND)
rlm@8 422 include_directories(${JNI_INCLUDE_DIRS})
rlm@8 423 endif (JNI_FOUND)
rlm@8 424
rlm@0 425 TARGET_LINK_LIBRARIES(${LIBNAME} ${EXTRA_LIBS})
rlm@0 426
rlm@0 427 # Add an install target here
rlm@0 428 INSTALL(TARGETS ${LIBNAME}
rlm@0 429 RUNTIME DESTINATION bin
rlm@0 430 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
rlm@0 431 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
rlm@0 432 )
rlm@0 433 INSTALL(FILES include/AL/al.h
rlm@0 434 include/AL/alc.h
rlm@0 435 include/AL/alext.h
rlm@0 436 include/AL/efx.h
rlm@0 437 include/AL/efx-creative.h
rlm@0 438 DESTINATION include/AL
rlm@0 439 )
rlm@0 440 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
rlm@0 441 DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
rlm@0 442
rlm@0 443
rlm@0 444 MESSAGE(STATUS "")
rlm@0 445 MESSAGE(STATUS "Building OpenAL with support for the following backends:")
rlm@0 446 MESSAGE(STATUS " ${BACKENDS}")
rlm@0 447 MESSAGE(STATUS "")
rlm@0 448
rlm@0 449
rlm@0 450 IF(UTILS)
rlm@0 451 ADD_EXECUTABLE(openal-info utils/openal-info.c)
rlm@0 452 TARGET_LINK_LIBRARIES(openal-info ${LIBNAME})
rlm@0 453 INSTALL(TARGETS openal-info
rlm@0 454 RUNTIME DESTINATION bin
rlm@0 455 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
rlm@0 456 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
rlm@0 457 )
rlm@0 458 MESSAGE(STATUS "Building utility programs")
rlm@0 459 MESSAGE(STATUS "")
rlm@0 460 ENDIF()
rlm@0 461
rlm@0 462