Added checks for portaudio and opencl to the cmake build system.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6351 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-11-06 03:49:18 +00:00
parent 7864f3c087
commit d0afc20596
5 changed files with 49 additions and 14 deletions

View File

@ -1,8 +1,9 @@
########################################
# General setup
#
cmake_minimum_required (VERSION 2.6)
project (dolphin-emu)
cmake_minimum_required(VERSION 2.6)
project(dolphin-emu)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
set(DOLPHIN_IS_STABLE FALSE)
set(prefix ${CMAKE_INSTALL_PREFIX} CACHE PATH "prefix")
@ -181,6 +182,35 @@ else()
message("Xrandr NOT found")
endif(XRANDR_FOUND)
find_library(PORTAUDIO portaudio)
if(PORTAUDIO)
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES portaudio)
CHECK_FUNCTION_EXISTS(Pa_GetVersion PORTAUDIO_VERSION_CHECK)
endif(PORTAUDIO)
if(PORTAUDIO AND PORTAUDIO_VERSION_CHECK)
message("PortAudio found, enabling mic support")
add_definitions(-DHAVE_PORTAUDIO=1)
set(PORTAUDIO_FOUND TRUE)
else()
message("PortAudio not found, disabling mic support")
add_definitions(-DHAVE_PORTAUDIO=0)
set(PORTAUDIO_FOUND FALSE)
endif(PORTAUDIO AND PORTAUDIO_VERSION_CHECK)
find_library(OPENCL OpenCL)
find_path(OPENCL_INCLUDE CL/cl.h)
if(OPENCL AND OPENCL_INCLUDE)
message("OpenCL found")
add_definitions(-DHAVE_OPENCL=1)
include_directories(${OPENCL_INCLUDE})
set(OPENCL_FOUND TRUE)
else()
message("OpenCL not found")
add_definitions(-DHAVE_OPENCL=0)
set(OPENCL_FOUND FALSE)
endif(OPENCL AND OPENCL_INCLUDE)
########################################
# Setup include directories (and make sure they are preferred over the Externals)
@ -223,7 +253,7 @@ find_library(LZO lzo2)
find_path(LZO_INCLUDE lzo/lzo1x.h)
if(LZO AND LZO_INCLUDE)
message("Using shared lzo")
include_directories(LZO_INCLUDE)
include_directories(${LZO_INCLUDE})
else()
message("Shared lzo not found, falling back to the static library")
add_subdirectory(Externals/LZO)
@ -233,7 +263,7 @@ endif(LZO AND LZO_INCLUDE)
include(FindSDL OPTIONAL)
if(SDL_FOUND)
message("Using shared SDL")
include_directories(SDL_INCLUDE_DIR)
include_directories(${SDL_INCLUDE_DIR})
else(SDL_FOUND)
# TODO: No CMakeLists.txt there, yet...
message("Shared SDL not found, falling back to the static library")
@ -245,7 +275,7 @@ find_library(SFML_NETWORK sfml-network)
find_path(SFML_INCLUDE SFML/Network/Ftp.hpp)
if(SFML_NETWORK AND SFML_INCLUDE)
message("Using shared sfml-network")
include_directories(SFML_INCLUDE)
include_directories(${SFML_INCLUDE})
else()
message("Shared sfml-network not found, falling back to the static library")
add_subdirectory(Externals/SFML)
@ -256,7 +286,7 @@ find_library(SOIL SOIL)
find_path(SOIL_INCLUDE SOIL/SOIL.h)
if(SOIL AND SOIL_INCLUDE)
message("Using shared SOIL")
include_directories(SOIL_INCLUDE)
include_directories(${SOIL_INCLUDE})
else()
message("Shared SOIL not found, falling back to the static library")
add_subdirectory(Externals/SOIL)
@ -265,7 +295,7 @@ endif(SOIL AND SOIL_INCLUDE)
include(FindZLIB OPTIONAL) # TODO: Move to top
if(ZLIB_FOUND)
include_directories(ZLIB_INCLUDE_DIRS)
include_directories(${ZLIB_INCLUDE_DIRS})
else(ZLIB_FOUND)
# TODO: No CMakeLists.txt there, yet...
add_subdirectory(Externals/zlib)

View File

@ -139,6 +139,12 @@ elseif(UNIX)
set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Unix.cpp)
endif()
add_library(core STATIC ${SRCS})
target_link_libraries(core bdisasm inputcommon lua sfml-network wiiuse)
set(LIBS bdisasm inputcommon lua sfml-network wiiuse)
if(PORTAUDIO_FOUND)
set(LIBS ${LIBS} portaudio)
endif(PORTAUDIO_FOUND)
add_library(core STATIC ${SRCS})
target_link_libraries(core ${LIBS})

View File

@ -27,7 +27,7 @@
bool MicButton = false;
bool IsOpen;
// Unfortunately this must be enabled in Common.h for windows users. Scons should enable it otherwise7
// Unfortunately this must be enabled in Common.h for windows users. Scons should enable it otherwise
#if !HAVE_PORTAUDIO
void SetMic(bool Value){}

View File

@ -33,7 +33,6 @@ set(SRCS Src/BPMemory.cpp
Src/XFMemory.cpp
Src/XFStructs.cpp)
# TODO?
if(OPENCL_FOUND)
set(SRCS ${SRCS} Src/OpenCL/OCLTextureDecoder.cpp)
endif(OPENCL_FOUND)

View File

@ -28,10 +28,10 @@ endif(wxWidgets_FOUND)
if(APPLE AND NOT wxWidgets_FOUND)
set(SRCS ${SRCS} cocoaGL.m)
elif(WIN32)
elseif(WIN32)
set(SRCS ${SRCS} OS/Win32.cpp)
#elif(NOT APPLE AND OPENCL_FOUND) # TODO: Add OpenCL support
# set(LIBS ${LIBS} OpenCL)
elseif(NOT APPLE AND OPENCL_FOUND)
set(LIBS ${LIBS} OpenCL)
endif()
add_library(Plugin_VideoOGL SHARED ${SRCS})