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 # General setup
# #
cmake_minimum_required (VERSION 2.6) cmake_minimum_required(VERSION 2.6)
project (dolphin-emu) project(dolphin-emu)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
set(DOLPHIN_IS_STABLE FALSE) set(DOLPHIN_IS_STABLE FALSE)
set(prefix ${CMAKE_INSTALL_PREFIX} CACHE PATH "prefix") set(prefix ${CMAKE_INSTALL_PREFIX} CACHE PATH "prefix")
@ -181,6 +182,35 @@ else()
message("Xrandr NOT found") message("Xrandr NOT found")
endif(XRANDR_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) # 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) find_path(LZO_INCLUDE lzo/lzo1x.h)
if(LZO AND LZO_INCLUDE) if(LZO AND LZO_INCLUDE)
message("Using shared lzo") message("Using shared lzo")
include_directories(LZO_INCLUDE) include_directories(${LZO_INCLUDE})
else() else()
message("Shared lzo not found, falling back to the static library") message("Shared lzo not found, falling back to the static library")
add_subdirectory(Externals/LZO) add_subdirectory(Externals/LZO)
@ -233,7 +263,7 @@ endif(LZO AND LZO_INCLUDE)
include(FindSDL OPTIONAL) include(FindSDL OPTIONAL)
if(SDL_FOUND) if(SDL_FOUND)
message("Using shared SDL") message("Using shared SDL")
include_directories(SDL_INCLUDE_DIR) include_directories(${SDL_INCLUDE_DIR})
else(SDL_FOUND) else(SDL_FOUND)
# TODO: No CMakeLists.txt there, yet... # TODO: No CMakeLists.txt there, yet...
message("Shared SDL not found, falling back to the static library") 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) find_path(SFML_INCLUDE SFML/Network/Ftp.hpp)
if(SFML_NETWORK AND SFML_INCLUDE) if(SFML_NETWORK AND SFML_INCLUDE)
message("Using shared sfml-network") message("Using shared sfml-network")
include_directories(SFML_INCLUDE) include_directories(${SFML_INCLUDE})
else() else()
message("Shared sfml-network not found, falling back to the static library") message("Shared sfml-network not found, falling back to the static library")
add_subdirectory(Externals/SFML) add_subdirectory(Externals/SFML)
@ -256,7 +286,7 @@ find_library(SOIL SOIL)
find_path(SOIL_INCLUDE SOIL/SOIL.h) find_path(SOIL_INCLUDE SOIL/SOIL.h)
if(SOIL AND SOIL_INCLUDE) if(SOIL AND SOIL_INCLUDE)
message("Using shared SOIL") message("Using shared SOIL")
include_directories(SOIL_INCLUDE) include_directories(${SOIL_INCLUDE})
else() else()
message("Shared SOIL not found, falling back to the static library") message("Shared SOIL not found, falling back to the static library")
add_subdirectory(Externals/SOIL) add_subdirectory(Externals/SOIL)
@ -265,7 +295,7 @@ endif(SOIL AND SOIL_INCLUDE)
include(FindZLIB OPTIONAL) # TODO: Move to top include(FindZLIB OPTIONAL) # TODO: Move to top
if(ZLIB_FOUND) if(ZLIB_FOUND)
include_directories(ZLIB_INCLUDE_DIRS) include_directories(${ZLIB_INCLUDE_DIRS})
else(ZLIB_FOUND) else(ZLIB_FOUND)
# TODO: No CMakeLists.txt there, yet... # TODO: No CMakeLists.txt there, yet...
add_subdirectory(Externals/zlib) add_subdirectory(Externals/zlib)

View File

@ -139,6 +139,12 @@ elseif(UNIX)
set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Unix.cpp) set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Unix.cpp)
endif() endif()
add_library(core STATIC ${SRCS}) set(LIBS bdisasm inputcommon lua sfml-network wiiuse)
target_link_libraries(core 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 MicButton = false;
bool IsOpen; 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 #if !HAVE_PORTAUDIO
void SetMic(bool Value){} void SetMic(bool Value){}

View File

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

View File

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