From b312d359cb468df54e82d5e327cae4588bb32b42 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Thu, 13 May 2010 18:13:24 -0500 Subject: [PATCH] Added internal OpenAL libs for MinGW on Windows; MSVC internal libs to come soon --- CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 360148b..a75db59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,9 +61,15 @@ set(LUGARU_SRCS ${SRCDIR}/OpenGL_Windows.cpp ${SRCDIR}/openal_wrapper.cpp ${SRCDIR}/WinInput.cpp - ${SRCDIR}/MacCompatibility.cpp ) +if(UNIX) + set(LUGARU_SRCS + ${LUGARU_SRCS} + ${SRCDIR}/MacCompatibility.cpp + ) +endif(UNIX) + set(LUGARU_H ${SRCDIR}/Constants.h ${SRCDIR}/Frustum.h @@ -145,7 +151,36 @@ find_package(OpenGL REQUIRED) # force this include dir no matter what, so we get sane headers. include_directories("${DEPDIR}/OpenGL") -find_package(OpenAL REQUIRED) # !!! FIXME: package a .dll for Windows? +option (LUGARU_FORCE_INTERNAL_OPENAL) +if (NOT LUGARU_FORCE_INTERNAL_OPENAL) + find_package(OpenAL REQUIRED) +endif (NOT LUGARU_FORCE_INTERNAL_OPENAL) + +if (NOT OPENAL_FOUND) + message(STATUS "Using internal copy of OpenAL") + set(LUGARU_MISSING_DEPS "${LUGARU_MISSING_DEPS} OpenAL") + set(OPENALDIR "${DEPDIR}/OpenAL") + set(OPENAL_INCLUDE_DIR "${OPENALDIR}/include/AL") + set(OPENAL_LIBRARY "") + + if (WINDOWS) + set(LUGARU_HAS_INTERNAL_OPENAL True) +# if (MSVC) # !!! FIXME: package MSVC .dll and .lib for Windows? +# set(OPENAL_LIBRARY +# ${OPENALDIR}/lib/win32/msvc/OpenAL32.lib +# ) +# endif (MSVC) + if (MINGW) + set(OPENAL_LIBRARY + ${OPENALDIR}/lib/win32/mingw/libOpenAL32.dll.a + ) + endif (MINGW) + endif(WINDOWS) + + if (NOT LUGARU_HAS_INTERNAL_OPENAL) + message(ERROR "We don't have a prebuilt OpenAL for this platform.") + endif (NOT LUGARU_HAS_INTERNAL_OPENAL) +endif (NOT OPENAL_FOUND) option (LUGARU_FORCE_INTERNAL_SDL "Force internal libSDL, even if there's a system version" False) if (NOT LUGARU_FORCE_INTERNAL_SDL) @@ -404,9 +439,11 @@ if(WIN32) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/Source/lugaru.exe DESTINATION ${CMAKE_INSTALL_PREFIX}) if(MSVC) install(FILES ${SDLDIR}/lib/win32/msvc/SDL.dll DESTINATION ${CMAKE_INSTALL_PREFIX}) + #install(FILES ${OPENALDIR}/lib/win32/msvc/OpenAL32.dll DESTINATION ${CMAKE_INSTALL_PREFIX}) # FIXME: Add MSVC OpenAL library! endif(MSVC) if(MINGW) install(FILES ${SDLDIR}/lib/win32/mingw/SDL.dll DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(FILES ${OPENALDIR}/lib/win32/mingw/OpenAL32.dll DESTINATION ${CMAKE_INSTALL_PREFIX}) endif(MINGW) else(WIN32) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/Source/lugaru DESTINATION ${CMAKE_INSTALL_PREFIX}) -- 2.39.5