cmake: commit some cleanup work (done by gregory).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3061 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-05-23 07:51:43 +00:00
parent a0d7e4a1b8
commit 58786f8218
6 changed files with 96 additions and 31 deletions

View File

@ -26,10 +26,6 @@ endif (UNIX)
# set module path # set module path
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
# include modules
include(Pcsx2Utils)
include(SearchForStuff)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# if no build type is set, use Devel as default # if no build type is set, use Devel as default
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -54,6 +50,46 @@ endif(NOT DEFINED CMAKE_BUILD_STRIP)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Force the choice of 3rd party library either system one or pcsx2 one
# Use all internal lib: -DFORCE_INTERNAL_ALL=TRUE
# Use a52 internal lib: -DFORCE_INTERNAL_A52=TRUE
# Use bzip internal lib: -DFORCE_INTERNAL_BZIP2=TRUE
# Use soundtouch internal lib: -DFORCE_INTERNAL_SOUNDTOUCH=TRUE
# Use zlib internal lib: -DFORCE_INTERNAL_ZLIB=TRUE
#-------------------------------------------------------------------------------
# There have been issues in the past with sound quality depending on the version
# of Soundtouch, so for the moment, we'll use the internal version.
set(FORCE_INTERNAL_SOUNDTOUCH TRUE)
if(FORCE_INTERNAL_ALL)
set(FORCE_INTERNAL_A52 TRUE)
set(FORCE_INTERNAL_BZIP2 TRUE)
set(FORCE_INTERNAL_SOUNDTOUCH TRUE)
set(FORCE_INTERNAL_ZLIB TRUE)
endif(FORCE_INTERNAL_ALL)
if(NOT DEFINED FORCE_INTERNAL_A52)
set(FORCE_INTERNAL_A52 FALSE)
endif(NOT DEFINED FORCE_INTERNAL_A52)
if(NOT DEFINED FORCE_INTERNAL_BZIP2)
set(FORCE_INTERNAL_BZIP2 FALSE)
endif(NOT DEFINED FORCE_INTERNAL_BZIP2)
if(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH)
set(FORCE_INTERNAL_SOUNDTOUCH FALSE)
endif(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH)
if(NOT DEFINED FORCE_INTERNAL_ZLIB)
set(FORCE_INTERNAL_ZLIB FALSE)
endif(NOT DEFINED FORCE_INTERNAL_ZLIB)
#-------------------------------------------------------------------------------
# include modules
include(Pcsx2Utils)
include(SearchForStuff)
# add additional project-wide include directories # add additional project-wide include directories
include_directories(${PROJECT_SOURCE_DIR}/3rdparty include_directories(${PROJECT_SOURCE_DIR}/3rdparty
${PROJECT_SOURCE_DIR}/common/include ${PROJECT_SOURCE_DIR}/common/include

24
cmake/FindA52.cmake Normal file
View File

@ -0,0 +1,24 @@
# Try to find A52
# Once done, this will define
#
# A52_FOUND - system has A52
# A52_INCLUDE_DIR - the A52 include directories
# A52_LIBRARIES - link these to use A52
if(A52_INCLUDE_DIR AND A52_LIBRARIES)
set(A52_FIND_QUIETLY TRUE)
endif(A52_INCLUDE_DIR AND A52_LIBRARIES)
# include dir
find_path(A52_INCLUDE_DIR a52dec/a52.h)
# finally the library itself
find_library(libA52 NAMES a52)
set(A52_LIBRARIES ${libA52})
# handle the QUIETLY and REQUIRED arguments and set A52_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(A52 DEFAULT_MSG A52_LIBRARIES A52_INCLUDE_DIR)
mark_as_advanced(A52_LIBRARIES A52_INCLUDE_DIR)

View File

@ -60,13 +60,13 @@ endif(wxWidgets_FOUND)
find_package(ZLIB) find_package(ZLIB)
# if we found zlib on the system, use it else use project one # if we found zlib on the system, use it else use project one
if(ZLIB_FOUND) if(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)
# add zlib include directories # add zlib include directories
include_directories(${ZLIB_INCLUDE_DIRS}) include_directories(${ZLIB_INCLUDE_DIRS})
else(ZLIB_FOUND) else(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)
# use project one # use project one
set(projectZLIB TRUE) set(projectZLIB TRUE)
endif(ZLIB_FOUND) endif(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)
#------------------------------------------------------------ #------------------------------------------------------------
@ -94,6 +94,21 @@ endif(Linux)
#------------------------------------------------------------ #------------------------------------------------------------
# A52 optional
include(FindA52)
# if we found A52 on the system,
# use it else use project one
if(A52_FOUND AND NOT FORCE_INTERNAL_A52)
# add a52 include directories
include_directories(${A52_INCLUDE_DIR})
else(A52_FOUND AND NOT FORCE_INTERNAL_A52)
# use project one
set(projectA52 TRUE)
set(A52_LIBRARIES A52)
endif(A52_FOUND AND NOT FORCE_INTERNAL_A52)
# ALSA optional # ALSA optional
find_package(ALSA) find_package(ALSA)
@ -110,13 +125,14 @@ find_package(BZip2)
# if we found bzip2 on the system, # if we found bzip2 on the system,
# use it else use project one # use it else use project one
if(BZIP2_FOUND) if(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2)
# add zlib include directories # add zlib include directories
include_directories(${BZIP2_INCLUDE_DIR}) include_directories(${BZIP2_INCLUDE_DIR})
else(BZIP2_FOUND) else(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2)
# use project one # use project one
set(projectBZip2 TRUE) set(projectBZip2 TRUE)
endif(BZIP2_FOUND) set(BZIP2_LIBRARIES bzip2)
endif(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2)
#------------------------------------------------------------ #------------------------------------------------------------
@ -180,16 +196,17 @@ endif(SDL_FOUND)
#include(FindSoundTouch) #include(FindSoundTouch)
# found SoundTouch # found SoundTouch
#if(SOUNDTOUCH_FOUND) if(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH)
# # add SoundTouch include directories # add SoundTouch include directories
# include_directories(${SOUNDTOUCH_INCLUDE_DIR}) include_directories(${SOUNDTOUCH_INCLUDE_DIR})
#else(SOUNDTOUCH_FOUND) else(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH)
# use project one # use project one
set(projectSoundTouch TRUE) set(projectSoundTouch TRUE)
set(SOUNDTOUCH_LIBRARIES SoundTouch)
# found # found
set(SOUNDTOUCH_FOUND TRUE) set(SOUNDTOUCH_FOUND TRUE)
#endif(SOUNDTOUCH_FOUND) endif(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH)
#------------------------------------------------------------ #------------------------------------------------------------

View File

@ -643,11 +643,7 @@ if(Linux)
endif(Linux) endif(Linux)
# link target with zlib # link target with zlib
if(projectZLIB) target_link_libraries(${pcsx2Name} ${ZLIB_LIBRARIES})
target_link_libraries(${pcsx2Name} zlib)
else(projectZLIB)
target_link_libraries(${pcsx2Name} ${ZLIB_LIBRARIES})
endif(projectZLIB)
# Force the linker into 32 bits mode # Force the linker into 32 bits mode
target_link_libraries(${pcsx2Name} -m32) target_link_libraries(${pcsx2Name} -m32)

View File

@ -119,14 +119,10 @@ if(PORTAUDIO_FOUND)
endif(PORTAUDIO_FOUND) endif(PORTAUDIO_FOUND)
# link target with SoundTouch # link target with SoundTouch
if(projectSoundTouch) target_link_libraries(${spu2xName} ${SOUNDTOUCH_LIBRARIES})
target_link_libraries(${spu2xName} SoundTouch)
else(projectSoundTouch)
target_link_libraries(${spu2xName} ${SOUNDTOUCH_LIBRARIES})
endif(projectSoundTouch)
# link target with A52 # link target with A52
target_link_libraries(${spu2xName} a52) target_link_libraries(${spu2xName} ${A52_LIBRARIES})
# Force the linker into 32 bits mode # Force the linker into 32 bits mode
target_link_libraries(${spu2xName} -m32) target_link_libraries(${spu2xName} -m32)

View File

@ -95,11 +95,7 @@ if(PORTAUDIO_FOUND)
endif(PORTAUDIO_FOUND) endif(PORTAUDIO_FOUND)
# link target with SoundTouch # link target with SoundTouch
if(projectSoundTouch) target_link_libraries(${zerospu2Name} ${SOUNDTOUCH_LIBRARIES})
target_link_libraries(${zerospu2Name} SoundTouch)
else(projectSoundTouch)
target_link_libraries(${zerospu2Name} ${SOUNDTOUCH_LIBRARIES})
endif(projectSoundTouch)
# Force the linker into 32 bits mode # Force the linker into 32 bits mode
target_link_libraries(${zerospu2Name} -m32) target_link_libraries(${zerospu2Name} -m32)