diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cb802bc6b..523e986a11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,10 +26,6 @@ endif (UNIX) # set module path set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -# include modules -include(Pcsx2Utils) -include(SearchForStuff) - #------------------------------------------------------------------------------- # 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 include_directories(${PROJECT_SOURCE_DIR}/3rdparty ${PROJECT_SOURCE_DIR}/common/include diff --git a/cmake/FindA52.cmake b/cmake/FindA52.cmake new file mode 100644 index 0000000000..f1c1fff8ea --- /dev/null +++ b/cmake/FindA52.cmake @@ -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) \ No newline at end of file diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 8696f5c011..65d51ad5b1 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -60,13 +60,13 @@ endif(wxWidgets_FOUND) find_package(ZLIB) # 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 include_directories(${ZLIB_INCLUDE_DIRS}) -else(ZLIB_FOUND) +else(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB) # use project one 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 find_package(ALSA) @@ -110,13 +125,14 @@ find_package(BZip2) # if we found bzip2 on the system, # use it else use project one -if(BZIP2_FOUND) +if(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2) # add zlib include directories include_directories(${BZIP2_INCLUDE_DIR}) -else(BZIP2_FOUND) +else(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2) # use project one 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) # found SoundTouch -#if(SOUNDTOUCH_FOUND) -# # add SoundTouch include directories -# include_directories(${SOUNDTOUCH_INCLUDE_DIR}) -#else(SOUNDTOUCH_FOUND) +if(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH) + # add SoundTouch include directories + include_directories(${SOUNDTOUCH_INCLUDE_DIR}) +else(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH) # use project one set(projectSoundTouch TRUE) + set(SOUNDTOUCH_LIBRARIES SoundTouch) # found set(SOUNDTOUCH_FOUND TRUE) -#endif(SOUNDTOUCH_FOUND) +endif(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH) #------------------------------------------------------------ diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 63b6597d6e..584839431a 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -643,11 +643,7 @@ if(Linux) endif(Linux) # link target with zlib -if(projectZLIB) - target_link_libraries(${pcsx2Name} zlib) -else(projectZLIB) - target_link_libraries(${pcsx2Name} ${ZLIB_LIBRARIES}) -endif(projectZLIB) +target_link_libraries(${pcsx2Name} ${ZLIB_LIBRARIES}) # Force the linker into 32 bits mode target_link_libraries(${pcsx2Name} -m32) diff --git a/plugins/spu2-x/src/CMakeLists.txt b/plugins/spu2-x/src/CMakeLists.txt index 8f292039c2..1d491c47ee 100644 --- a/plugins/spu2-x/src/CMakeLists.txt +++ b/plugins/spu2-x/src/CMakeLists.txt @@ -119,14 +119,10 @@ if(PORTAUDIO_FOUND) endif(PORTAUDIO_FOUND) # link target with SoundTouch -if(projectSoundTouch) - target_link_libraries(${spu2xName} SoundTouch) -else(projectSoundTouch) - target_link_libraries(${spu2xName} ${SOUNDTOUCH_LIBRARIES}) -endif(projectSoundTouch) +target_link_libraries(${spu2xName} ${SOUNDTOUCH_LIBRARIES}) # link target with A52 -target_link_libraries(${spu2xName} a52) +target_link_libraries(${spu2xName} ${A52_LIBRARIES}) # Force the linker into 32 bits mode target_link_libraries(${spu2xName} -m32) diff --git a/plugins/zerospu2/CMakeLists.txt b/plugins/zerospu2/CMakeLists.txt index b2ed22b1d5..6d2f7bd823 100644 --- a/plugins/zerospu2/CMakeLists.txt +++ b/plugins/zerospu2/CMakeLists.txt @@ -95,11 +95,7 @@ if(PORTAUDIO_FOUND) endif(PORTAUDIO_FOUND) # link target with SoundTouch -if(projectSoundTouch) - target_link_libraries(${zerospu2Name} SoundTouch) -else(projectSoundTouch) - target_link_libraries(${zerospu2Name} ${SOUNDTOUCH_LIBRARIES}) -endif(projectSoundTouch) +target_link_libraries(${zerospu2Name} ${SOUNDTOUCH_LIBRARIES}) # Force the linker into 32 bits mode target_link_libraries(${zerospu2Name} -m32)