diff --git a/CMakeLists.txt b/CMakeLists.txt index a7c070c905..c3cdad79a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 1f66798555..59c3caef74 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -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}) diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp index 6a77965874..78cf22651a 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp @@ -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){} diff --git a/Source/Core/VideoCommon/CMakeLists.txt b/Source/Core/VideoCommon/CMakeLists.txt index a52aff9493..3fb43bee8d 100644 --- a/Source/Core/VideoCommon/CMakeLists.txt +++ b/Source/Core/VideoCommon/CMakeLists.txt @@ -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) diff --git a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt index f67aa1f27e..58f974952e 100644 --- a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt +++ b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt @@ -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})