cmake: Some patches from athos and gregory. spu2-x builds in cmake.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3020 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-05-15 23:36:13 +00:00
parent c34210dc78
commit de91c8f30b
7 changed files with 81 additions and 20 deletions

View File

@ -16,3 +16,6 @@ if(projectSoundTouch)
add_subdirectory(SoundTouch)
endif(projectSoundTouch)
# make liba52
add_subdirectory(liba52)

45
3rdparty/liba52/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,45 @@
# a52 library
# library name
set(a52Name a52)
# Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug)
# add defines
add_definitions(-g -Wall)
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# Devel - Build
if(CMAKE_BUILD_TYPE STREQUAL Devel)
# add defines
add_definitions(-O2 -Wall -g -Os)
endif(CMAKE_BUILD_TYPE STREQUAL Devel)
# Release - Build
if(CMAKE_BUILD_TYPE STREQUAL Release)
# add defines
add_definitions(-O2 -Wall -g -Os)
endif(CMAKE_BUILD_TYPE STREQUAL Release)
# variable with all sources of this library
set(a52Sources
bit_allocate.c
bitstream.c
downmix.c
imdct.c
parse.c)
# variable with all headers of this library
set(a52Headers
a52.h
a52_internal.h
attributes.h
bitstream.h
config.h
inttypes.h
mm_accel.h
tables.h
tendra.h)
# add library
add_library(${a52Name} STATIC ${a52Sources} ${a52Headers})

View File

@ -5,9 +5,12 @@ project(Pcsx2)
# need cmake version >=2.6
cmake_minimum_required(VERSION 2.6)
# set module path
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
# include modules
include(${PROJECT_SOURCE_DIR}/cmake/Pcsx2Utils.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/SearchForStuff.cmake)
include(Pcsx2Utils)
include(SearchForStuff)
set(CMAKE_BUILD_TYPE Devel)

View File

@ -116,7 +116,7 @@ endif(BZIP2_FOUND)
#------------------------------------------------------------
# Cg optional
include(${PROJECT_SOURCE_DIR}/cmake/FindCg.cmake)
include(FindCg)
# found Cg
if(CG_FOUND)
@ -127,7 +127,7 @@ endif(CG_FOUND)
#------------------------------------------------------------
# GLEW optional
include(${PROJECT_SOURCE_DIR}/cmake/FindGlew.cmake)
include(FindGlew)
# found GLEW
if(GLEW_FOUND)
@ -149,7 +149,7 @@ endif(OPENGL_FOUND)
#------------------------------------------------------------
# PortAudio optional
include(${PROJECT_SOURCE_DIR}/cmake/FindPortAudio.cmake)
include(FindPortAudio)
# found PortAudio
if(PORTAUDIO_FOUND)
@ -172,7 +172,7 @@ endif(SDL_FOUND)
#------------------------------------------------------------
# SoundTouch optional
#include(${PROJECT_SOURCE_DIR}/cmake/FindSoundTouch.cmake)
#include(FindSoundTouch)
# found SoundTouch
#if(SOUNDTOUCH_FOUND)
@ -190,10 +190,6 @@ endif(SDL_FOUND)
# Subversion optional
find_package(Subversion)
# Liba52 optional
# Must be fixed properly
set(A52_LIBRARIES liba52.so)
# subversion found
if(Subversion_FOUND)

View File

@ -81,9 +81,9 @@ if(SPU2null)
endif(SPU2null)
# make spu2-x
#if(spu2-x)
# add_subdirectory(spu2-x)
#endif(spu2-x)
if(spu2-x)
add_subdirectory(spu2-x)
endif(spu2-x)
# make SSSPSXPAD
#if(SSSPSXPAD)

View File

@ -108,7 +108,7 @@ set_target_properties(${spu2xName} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/plugins)
# link target with project internal libraries
target_link_libraries(${spu2xName} Utilities x86emitter)
target_link_libraries(${spu2xName} Utilities x86emitter Utilities)
# link target with ALSA
target_link_libraries(${spu2xName} ${ALSA_LIBRARIES})
@ -126,6 +126,5 @@ else(projectSoundTouch)
endif(projectSoundTouch)
# link target with A52
target_link_libraries(${spu2xName} ${A52_LIBRARIES})
target_link_libraries(${spu2xName} -m32)
target_link_libraries(${spu2xName} a52)
target_link_libraries(${spu2xName} -m32)

View File

@ -46,9 +46,9 @@ static const s32 tbl_XA_Factor[5][2] =
// precision.
//
#ifdef MSC_VER
__forceinline // gcc can't inline this function, presumably because of it's exceeding complexity?
#endif
s32 MulShr32( s32 srcval, s32 mulval )
// gcc can't inline this function, presumably because of it's exceeding complexity?
__forceinline s32 MulShr32( s32 srcval, s32 mulval )
{
s64 tmp = ((s64)srcval * mulval );
@ -58,6 +58,21 @@ s32 MulShr32( s32 srcval, s32 mulval )
return ((s32*)&tmp)[1];
}
#else
// gcc can't inline this function, presumably because of it's exceeding complexity?
s32 MulShr32( s32 srcval, s32 mulval )
{
s32 tmp;
__asm__(
".att_syntax\n"
"imull %2\n" // do eax*%2 -> edx contains high 32 bits and eax contains low 32 bits
".att_syntax\n" : "=d" (tmp) : "a" (srcval), "g" (mulval)
);
return tmp;
}
#endif
__forceinline s32 clamp_mix( s32 x, u8 bitshift )
{
return GetClamped( x, -0x8000<<bitshift, 0x7fff<<bitshift );