From 5932b130bd725f4034fa1d8dd9d2a4223d78a074 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut" Date: Thu, 3 Jun 2010 17:28:20 +0000 Subject: [PATCH] * separate build parameter and selection of plugins into new modules. Add comment and status messages git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3148 96395faa-99c1-11dd-bbfe-3dabce05a288 --- CMakeLists.txt | 81 +++------------- cmake/BuildParameters.cmake | 62 +++++++++++++ cmake/SearchForStuff.cmake | 162 +------------------------------- cmake/SelectPcsx2Plugins.cmake | 164 +++++++++++++++++++++++++++++++++ 4 files changed, 239 insertions(+), 230 deletions(-) create mode 100644 cmake/BuildParameters.cmake create mode 100644 cmake/SelectPcsx2Plugins.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 523e986a1..2427a819e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,88 +7,29 @@ cmake_minimum_required(VERSION 2.6) #------------------------------------------------------------------------------- # Detect the 32bit/64bit and set the 32bit library path 32_LD_LIBRARY_PATH +# Note: Must be done before SearchForStuff #------------------------------------------------------------------------------- if (UNIX) - if (CMAKE_SIZEOF_VOID_P MATCHES "8") - # 64 bits machine - if (EXISTS /usr/lib32) - # 32 bits library in /usr/lib32 + if (CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32") + # 64 bits machine with 32 bits library in /usr/lib32 set(32_LD_LIBRARY_PATH /usr/lib32) - else (EXISTS /usr/lib32) - set(32_LD_LIBRARY_PATH /usr/lib) - endif (EXISTS /usr/lib32) - else (CMAKE_SIZEOF_VOID_P MATCHES "8") - # 32 bits machine + else (CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32") + # default case set(32_LD_LIBRARY_PATH /usr/lib) - endif (CMAKE_SIZEOF_VOID_P MATCHES "8") + endif (CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32") endif (UNIX) # set module path set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -#------------------------------------------------------------------------------- -# if no build type is set, use Devel as default -#------------------------------------------------------------------------------- -if(CMAKE_BUILD_TYPE STREQUAL "") - set(CMAKE_BUILD_TYPE Devel) - message(STATUS "BuildType set to ${CMAKE_BUILD_TYPE} by default") -endif(CMAKE_BUILD_TYPE STREQUAL "") -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# Set default strip option. Can be set with -DCMAKE_BUILD_STRIP=TRUE/FALSE -#------------------------------------------------------------------------------- -if(NOT DEFINED CMAKE_BUILD_STRIP) - if(CMAKE_BUILD_TYPE STREQUAL "Release") - set(CMAKE_BUILD_STRIP TRUE) - message(STATUS "Enable the stripping by default in ${CMAKE_BUILD_TYPE} build !!!") - else(CMAKE_BUILD_TYPE STREQUAL "Release") - set(CMAKE_BUILD_STRIP FALSE) - message(STATUS "Disable the stripping by default in ${CMAKE_BUILD_TYPE} build !!!") - endif(CMAKE_BUILD_TYPE STREQUAL "Release") -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) +# BuildParameters Must be done before SearchForStuff +include(BuildParameters) +# SearchForStuff be done before SelectPcsx2Plugins include(SearchForStuff) +include(SelectPcsx2Plugins) # add additional project-wide include directories include_directories(${PROJECT_SOURCE_DIR}/3rdparty @@ -131,7 +72,7 @@ set(resourceList AppIcon16.png ConfigIcon_Speedhacks.png ConfigIcon_Video.png Dualshock.jpg) - + createResourceTarget(${resourceList}) #------------------------------------------------------------------------------- diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake new file mode 100644 index 000000000..eb8179535 --- /dev/null +++ b/cmake/BuildParameters.cmake @@ -0,0 +1,62 @@ +### Select the build type +# Use Release/Devel/Debug : -DCMAKE_BUILD_TYPE=Release|Devel|Debug +# Enable/disable the stipping : -DCMAKE_BUILD_STRIP=TRUE|FALSE +### Force the choice of 3rd party library in pcsx2 over system libraries +# 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 +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# if no build type is set, use Devel as default +#------------------------------------------------------------------------------- +if(CMAKE_BUILD_TYPE STREQUAL "") + set(CMAKE_BUILD_TYPE Devel) + message(STATUS "BuildType set to ${CMAKE_BUILD_TYPE} by default") +endif(CMAKE_BUILD_TYPE STREQUAL "") +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Set default strip option. Can be set with -DCMAKE_BUILD_STRIP=TRUE/FALSE +#------------------------------------------------------------------------------- +if(NOT DEFINED CMAKE_BUILD_STRIP) + if(CMAKE_BUILD_TYPE STREQUAL "Release") + set(CMAKE_BUILD_STRIP TRUE) + message(STATUS "Enable the stripping by default in ${CMAKE_BUILD_TYPE} build !!!") + else(CMAKE_BUILD_TYPE STREQUAL "Release") + set(CMAKE_BUILD_STRIP FALSE) + message(STATUS "Disable the stripping by default in ${CMAKE_BUILD_TYPE} build !!!") + endif(CMAKE_BUILD_TYPE STREQUAL "Release") +endif(NOT DEFINED CMAKE_BUILD_STRIP) + + #------------------------------------------------------------------------------- + + +# 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) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index dbc437257..ae768d2e8 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -11,6 +11,8 @@ set(minimal_SDL_version 1.2) # need to know on which OS we are currenty working/running detectOperatingSystem() +# These lines remove some defaults options that can cause some failure later. +# In particular, it remove the build option -rdynamic SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS " ") SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS " ") @@ -223,163 +225,3 @@ if(Subversion_FOUND) else(Subversion_FOUND) set(SVN FALSE) endif(Subversion_FOUND) - -#------------------------------------------------------------------------------- -# Plugins -#------------------------------------------------------------------------------- -# Check all plugins for additional dependencies. -# If all dependencies of a plugin are available, including OS, the plugin will -# be build. -#------------------------------------------------------------------------------- -# null plugins should work on every platform, enable them all -#--------------------------------------- -# CDVDnull -#--------------------------------------- -set(CDVDnull TRUE) -#--------------------------------------- - -#--------------------------------------- -# CDVDiso -#--------------------------------------- -# requires: -BZip2 -#--------------------------------------- -if(BZIP2_FOUND) - set(CDVDiso TRUE) -else(BZIP2_FOUND) - set(CDVDiso FALSE) -endif(BZIP2_FOUND) - -#--------------------------------------- -# dev9null -#--------------------------------------- -set(dev9null TRUE) -#--------------------------------------- - -#--------------------------------------- -# FWnull -#--------------------------------------- -set(FWnull TRUE) -#--------------------------------------- - -#--------------------------------------- -# GSnull -#--------------------------------------- -set(GSnull TRUE) -#--------------------------------------- - -#--------------------------------------- -# PadNull -#--------------------------------------- -set(PadNull TRUE) -#--------------------------------------- - -#--------------------------------------- -# SPU2null -#--------------------------------------- -set(SPU2null TRUE) -#--------------------------------------- - -#--------------------------------------- -# USBnull -#--------------------------------------- -set(USBnull TRUE) -#--------------------------------------- - -#--------------------------------------- -# onepad -#--------------------------------------- -# requires: -SDL -#--------------------------------------- -if(SDL_FOUND) - set(onepad TRUE) -else(SDL_FOUND) - set(onepad FALSE) -endif(SDL_FOUND) -#--------------------------------------- - -#--------------------------------------- -# zeropad -#--------------------------------------- -# requires: -SDL -#--------------------------------------- -if(SDL_FOUND) - set(zeropad TRUE) -else(SDL_FOUND) - set(zeropad FALSE) -endif(SDL_FOUND) -#--------------------------------------- - -#--------------------------------------- -# spu2-x -#--------------------------------------- -# requires: -SoundTouch -# -ALSA -# -Portaudio -# -A52 -#--------------------------------------- -if(A52_FOUND AND ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND) - set(spu2-x TRUE) -else(A52_FOUND AND ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND) - set(spu2-x FALSE) -endif(A52_FOUND AND ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND) -#--------------------------------------- - -#--------------------------------------- -# zerogs -#--------------------------------------- -# requires: -GLEW -# -OpenGL -# -X11 -# -CG -#--------------------------------------- -if(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) - set(zerogs TRUE) -else(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) - set(zerogs FALSE) -endif(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) -#--------------------------------------- - -#--------------------------------------- -# zzogl-pg -#--------------------------------------- -# requires: -GLEW -# -OpenGL -# -X11 -# -CG -#--------------------------------------- -if(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) - set(zzogl TRUE) -else(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) - set(zzogl FALSE) -endif(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) - -#--------------------------------------- -# zerospu2 -#--------------------------------------- -# requires: -SoundTouch -# -ALSA -# -PortAudio -#--------------------------------------- -if(SOUNDTOUCH_FOUND AND ALSA_FOUND) - set(zerospu2 TRUE) -else(SOUNDTOUCH_FOUND AND ALSA_FOUND) - set(zerospu2 FALSE) -endif(SOUNDTOUCH_FOUND AND ALSA_FOUND) -#--------------------------------------- - -#------------------------------------------------------------------------------- -# [TODO] Write CMakeLists.txt for these plugins. -set(cdvdGigaherz FALSE) -#set(CDVDiso FALSE) -set(CDVDisoEFP FALSE) -set(CDVDlinuz FALSE) -set(CDVDolio FALSE) -set(CDVDpeops FALSE) -set(GSdx FALSE) -set(LilyPad FALSE) -set(PeopsSPU2 FALSE) -set(SSSPSXPAD FALSE) -set(xpad FALSE) -#set(zeropad FALSE) -#------------------------------------------------------------------------------- - diff --git a/cmake/SelectPcsx2Plugins.cmake b/cmake/SelectPcsx2Plugins.cmake new file mode 100644 index 000000000..8874e87d1 --- /dev/null +++ b/cmake/SelectPcsx2Plugins.cmake @@ -0,0 +1,164 @@ +#------------------------------------------------------------------------------- +# Plugins +#------------------------------------------------------------------------------- +# Check all plugins for additional dependencies. +# If all dependencies of a plugin are available, including OS, the plugin will +# be build. +#------------------------------------------------------------------------------- + +#--------------------------------------- +# CDVDnull +#--------------------------------------- +set(CDVDnull TRUE) +#--------------------------------------- + +#--------------------------------------- +# CDVDiso +#--------------------------------------- +# requires: -BZip2 +#--------------------------------------- +if(BZIP2_FOUND) + set(CDVDiso TRUE) +else(BZIP2_FOUND) + set(CDVDiso FALSE) + message(STATUS "Skip build of CDVDiso: miss some dependencies") +endif(BZIP2_FOUND) + +#--------------------------------------- +# dev9null +#--------------------------------------- +set(dev9null TRUE) +#--------------------------------------- + +#--------------------------------------- +# FWnull +#--------------------------------------- +set(FWnull TRUE) +#--------------------------------------- + +#--------------------------------------- +# GSnull +#--------------------------------------- +set(GSnull TRUE) +#--------------------------------------- + +#--------------------------------------- +# zerogs +#--------------------------------------- +# requires: -GLEW +# -OpenGL +# -X11 +# -CG +#--------------------------------------- +if(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) + set(zerogs TRUE) +else(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) + set(zerogs FALSE) + message(STATUS "Skip build of zerogs: miss some dependencies") +endif(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) +#--------------------------------------- + +#--------------------------------------- +# zzogl-pg +#--------------------------------------- +# requires: -GLEW +# -OpenGL +# -X11 +# -CG +#--------------------------------------- +if(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) + set(zzogl TRUE) +else(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) + set(zzogl FALSE) + message(STATUS "Skip build of zzogl: miss some dependencies") +endif(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND) +#--------------------------------------- + +#--------------------------------------- +# PadNull +#--------------------------------------- +set(PadNull TRUE) +#--------------------------------------- + +#--------------------------------------- +# onepad +#--------------------------------------- +# requires: -SDL +#--------------------------------------- +if(SDL_FOUND) + set(onepad TRUE) +else(SDL_FOUND) + set(onepad FALSE) + message(STATUS "Skip build of onepad: miss some dependencies") +endif(SDL_FOUND) +#--------------------------------------- + +#--------------------------------------- +# zeropad +#--------------------------------------- +# requires: -SDL +#--------------------------------------- +if(SDL_FOUND) + set(zeropad TRUE) +else(SDL_FOUND) + set(zeropad FALSE) + message(STATUS "Skip build of zeropad: miss some dependencies") +endif(SDL_FOUND) +#--------------------------------------- + +#--------------------------------------- +# SPU2null +#--------------------------------------- +set(SPU2null TRUE) +#--------------------------------------- + +#--------------------------------------- +# spu2-x +#--------------------------------------- +# requires: -SoundTouch +# -ALSA +# -Portaudio +# -A52 +#--------------------------------------- +if(A52_FOUND AND ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND) + set(spu2-x TRUE) +else(A52_FOUND AND ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND) + set(spu2-x FALSE) + message(STATUS "Skip build of spu2-x: miss some dependencies") +endif(A52_FOUND AND ALSA_FOUND AND PORTAUDIO_FOUND AND SOUNDTOUCH_FOUND) +#--------------------------------------- + +#--------------------------------------- +# zerospu2 +#--------------------------------------- +# requires: -SoundTouch +# -ALSA +# -PortAudio +#--------------------------------------- +if(SOUNDTOUCH_FOUND AND ALSA_FOUND) + set(zerospu2 TRUE) +else(SOUNDTOUCH_FOUND AND ALSA_FOUND) + set(zerospu2 FALSE) + message(STATUS "Skip build of zerospu2: miss some dependencies") +endif(SOUNDTOUCH_FOUND AND ALSA_FOUND) +#--------------------------------------- + +#--------------------------------------- +# USBnull +#--------------------------------------- +set(USBnull TRUE) +#--------------------------------------- + +#------------------------------------------------------------------------------- +# [TODO] Write CMakeLists.txt for these plugins. +set(cdvdGigaherz FALSE) +set(CDVDisoEFP FALSE) +set(CDVDlinuz TRUE) +set(CDVDolio FALSE) +set(CDVDpeops FALSE) +set(GSdx FALSE) +set(LilyPad FALSE) +set(PeopsSPU2 FALSE) +set(SSSPSXPAD FALSE) +set(xpad FALSE) +#-------------------------------------------------------------------------------