/[pcsx2_0.9.7]/trunk/cmake/SearchForStuff.cmake
ViewVC logotype

Diff of /trunk/cmake/SearchForStuff.cmake

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/cmake/SearchForStuff.cmake	2010/09/07 03:24:11	31
+++ trunk/cmake/SearchForStuff.cmake	2010/09/07 11:08:22	62
@@ -1,378 +1,174 @@
-# Search for additional software.
-
 #-------------------------------------------------------------------------------
-# Minmal required version of libraries
+#						Search all libraries on the system
 #-------------------------------------------------------------------------------
-set(minimal_wxWidgets_version 2.8.0)
-set(minimal_GTK2_version 2.10)
-set(minimal_SDL_version 1.2)
-
-# to set the proper dependencies and decide which plugins should be build we
-# need to know on which OS we are currenty working/running
-detectOperatingSystem()
+# Do not search Lib in /usr/lib64. Hope it is not overwritten in find_package or others macro
+SET(FIND_LIBRARY_USE_LIB64_PATHS FALSE)
 
-SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS " ")
-SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS " ")
-
-#-------------------------------------------------------------------------------
-#									FindStuff
-#-------------------------------------------------------------------------------
-#----------------------------------------
-#						Required
-#----------------------------------------
-if(Linux)			# Linux only
-	# gtk required
-	find_package(GTK2 REQUIRED gtk)
-
-	# gtk found
-	if(GTK2_FOUND)
-		# add gtk include directories
-		include_directories(${GTK2_INCLUDE_DIRS})
-	#else(GTK2_FOUND)
-	#	message(FATAL_ERROR "GTK2 libraries and include files not found. 
-	#			Please install GTK2 version ${minimal_GTK2_version} or higher.")
-	endif(GTK2_FOUND)
+## Linux only libraries
+if(Linux)
+    # Most plugins (if not all) and PCSX2 core need gtk2, so 
+    # set the required flags
+    find_package(GTK2 REQUIRED gtk)
+    if(GTK2_FOUND)
+        # From version 2.21.3 gtk moved gdk-pixbuf into a separate module
+        # Cmake need to be fixed. For the moment uses a manual detection.
+        find_path(GDK_PIXBUF_INCLUDE_DIRS NAMES gdk-pixbuf/gdk-pixbuf.h PATHS
+            /usr/include/gdk-pixbuf-2.0
+            /usr/include)
+        if (GDK_PIXBUF_INCLUDE_DIRS)
+            set(GTK2_INCLUDE_DIRS "${GDK_PIXBUF_INCLUDE_DIRS}" "${GTK2_INCLUDE_DIRS}")
+            # Remove duplicates when cmake will be fixed
+            list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS)
+        endif (GDK_PIXBUF_INCLUDE_DIRS)
+    endif(GTK2_FOUND)
 
+    find_package(X11)
+    # Manually find Xxf86vm because it is not done in the module...
+    FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm       ${X11_LIB_SEARCH_PATH})
+    MARK_AS_ADVANCED(X11_Xxf86vm_LIB)
 endif(Linux)
 
-#------------------------------------------------------------
-
-# wx required
-find_package(wxWidgets REQUIRED base core adv)
-
-# wx found
-if(wxWidgets_FOUND)
-    if(Linux)			# Linux only
-        # Force the use of 32 bit library
-        STRING(REGEX REPLACE "/usr/lib/wx" "${32_LD_LIBRARY_PATH}/wx"
-            wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")
-    endif(Linux)
-	include(${wxWidgets_USE_FILE})
-#else(wxWidgets_FOUND)
-#	message(FATAL_ERROR "wxWidgets libraries and include files not found.\
-#			Please install wxWidgets version ${minimal_wxWidgets_version} \
-#			or higher.")
-endif(wxWidgets_FOUND)
-
-#------------------------------------------------------------
-
-# zlib required (no require flag, because we can use project one as fallback)
-find_package(ZLIB)
+## Use cmake package to find module
+find_package(ALSA)
+find_package(BZip2)
+find_package(JPEG)
+find_package(OpenGL)
+# Tell cmake that we use SDL as a library and not as an application
+set(SDL_BUILDING_LIBRARY TRUE)
+find_package(SDL)
+find_package(Subversion)
+# The requierement of wxWidgets is checked in SelectPcsx2Plugins module
+# Does not requier the module (allow to compile non-wx plugins)
+find_package(wxWidgets COMPONENTS base core adv)
+if(NOT FORCE_INTERNAL_ZLIB)
+    find_package(ZLIB)
+endif(NOT FORCE_INTERNAL_ZLIB)
 
-# if we found zlib on the system, use it else use project one
-if(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)
-	# add zlib include directories
-	include_directories(${ZLIB_INCLUDE_DIRS})
-else(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)
+## Use pcsx2 package to find module
+include(FindA52)
+include(FindCg)
+include(FindGlew)
+include(FindPortAudio)
+if(NOT FORCE_INTERNAL_SOUNDTOUCH)
+    include(FindSoundTouch)
+endif(NOT FORCE_INTERNAL_SOUNDTOUCH)
+include(FindSparseHash)
+
+# Note for include_directory: The order is important to avoid a mess between include file from your system and the one of pcsx2
+# If you include first 3rdparty, all 3rdpary include will have a higer priority...
+# If you include first /usr/include, all system include will have a higer priority over the pcsx2 one...
+# Current implementation: 
+# 1/ include 3rdparty sub-directory that we will used (either request or fallback)
+# 2/ include system one
+#----------------------------------------
+#         Fallback on 3rdparty libraries
+#----------------------------------------
+# Note to avoid some conflict with system include, we must include 3rdparty first
+if(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB)
 	# use project one
 	set(projectZLIB TRUE)
-endif(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)
-
-#------------------------------------------------------------
+    set(ZLIB_FOUND TRUE)
+    # Set path
+    set(ZLIB_LIBRARIES pcsx2_zlib)
+    include_directories(${PROJECT_SOURCE_DIR}/3rdparty/zlib)
+    message(STATUS "Use internal pcsx2 zlib library")
+endif(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB)
 
+if(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH)
+	# use project one
+	set(projectSoundTouch TRUE)
+	set(SOUNDTOUCH_FOUND TRUE)
+    # Set path
+	set(SOUNDTOUCH_LIBRARIES pcsx2_SoundTouch)
+    include_directories(${PROJECT_SOURCE_DIR}/3rdparty/soundtouch_linux_include)
+    message(STATUS "Use internal pcsx2 SoundTouch library")
+endif(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH)
 
 #----------------------------------------
-#						Optional
+#		    Use system include (if not 3rdparty one)
 #----------------------------------------
-if(Linux)			# Linux only
-	# x11 optional
-	find_package(X11)
+if(Linux)
+    # GTK2
+	if(GTK2_FOUND)
+		include_directories(${GTK2_INCLUDE_DIRS})
+	endif(GTK2_FOUND)
 
-	# x11 found
+	# x11
 	if(X11_FOUND)
-		# add x11 include directories
 		include_directories(${X11_INCLUDE_DIR})
-	#else(X11_FOUND)
-	#	message(FATAL_ERROR "X11 libraries and include files not found. 
-	#			Please install X11.")
 	endif(X11_FOUND)
 endif(Linux)
 
-    # Manually find Xxf86vm because it is not done in the module...
-    FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm       ${X11_LIB_SEARCH_PATH})
-    MARK_AS_ADVANCED(X11_Xxf86vm_LIB)
-
-#------------------------------------------------------------
-
-# 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
+# A52
+if(A52_FOUND)
 	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)
-
+endif(A52_FOUND)
 
-# ALSA optional
-find_package(ALSA)
-
-# ALSA found
+# ALSA
 if(ALSA_FOUND)
-	# add ALSA include directories
 	include_directories(${ALSA_INCLUDE_DIRS})
 endif(ALSA_FOUND)
 
-#------------------------------------------------------------
-
-# bzip2 optional
-find_package(BZip2)
-
-# if we found bzip2 on the system,
-# use it else use project one
-if(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2)
-	# add zlib include directories
+# bzip2
+if(BZIP2_FOUND)
 	include_directories(${BZIP2_INCLUDE_DIR})
-else(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2)
-	# use project one
-	set(projectBZip2 TRUE)
-	set(BZIP2_LIBRARIES bzip2)
-endif(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2)
-
-#------------------------------------------------------------
-
-# Cg optional
-include(FindCg)
+endif(BZIP2_FOUND)
 
-# found Cg
+# Cg
 if(CG_FOUND)
-	# add Cg include directories
-	include_directories(${CG_INCLUDE_DIR})
+	include_directories(${CG_INCLUDE_DIRS})
 endif(CG_FOUND)
 
-#------------------------------------------------------------
+# Jpeg
+if(JPEG_FOUND)
+	include_directories(${JPEG_INCLUDE_DIR})
+endif(JPEG_FOUND)
 
-# GLEW optional
-include(FindGlew)
-
-# found GLEW
+# GLEW
 if(GLEW_FOUND)
-	# add GLEW include directories
 	include_directories(${GLEW_INCLUDE_PATH})
 endif(GLEW_FOUND)
 
-#------------------------------------------------------------
-
-# OpenGL optional
-find_package(OpenGL)
-
-# opengl found
+# OpenGL
 if(OPENGL_FOUND)
-	# add OpenGL include directories
 	include_directories(${OPENGL_INCLUDE_DIR})
 endif(OPENGL_FOUND)
 
-#------------------------------------------------------------
-
-# PortAudio optional
-include(FindPortAudio)
-
-# found PortAudio
+# PortAudio
 if(PORTAUDIO_FOUND)
-	# add PortAudio include directories
 	include_directories(${PORTAUDIO_INCLUDE_DIR})
 endif(PORTAUDIO_FOUND)
 
-#------------------------------------------------------------
-
-# SDL optional
-set(SDL_BUILDING_LIBRARY TRUE)
-find_package(SDL)
-
-# SDL found
+# SDL
 if(SDL_FOUND)
-	# add SDL include directories
 	include_directories(${SDL_INCLUDE_DIR})
 endif(SDL_FOUND)
 
-#------------------------------------------------------------
-
-# SoundTouch optional
-#include(FindSoundTouch)
-
-# found SoundTouch	
-if(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH)
-	# add SoundTouch include directories
+# SoundTouch
+if(SOUNDTOUCH_FOUND AND NOT projectSoundTouch)
 	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 AND NOT FORCE_INTERNAL_SOUNDTOUCH)
+endif(SOUNDTOUCH_FOUND AND NOT projectSoundTouch)
 
-#------------------------------------------------------------
+# SPARSEHASH
+if(SPARSEHASH_FOUND)
+	include_directories(${SPARSEHASH_INCLUDE_DIR})
+endif(SPARSEHASH_FOUND)
 
-# Subversion optional
-find_package(Subversion)
-
-# subversion found
-if(Subversion_FOUND)
-	set(SVN TRUE)
-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
-#---------------------------------------
-if(SOUNDTOUCH_FOUND)
-	set(spu2-x TRUE)
-else(SOUNDTOUCH_FOUND)
-	set(spu2-x FALSE)
-endif(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)
-#---------------------------------------
+# Wx
+if(wxWidgets_FOUND)
+    if(Linux)
+        # Force the use of 32 bit library configuration on
+        # 64 bits machine with 32 bits library in /usr/lib32
+        if(CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32")
+            STRING(REGEX REPLACE "/usr/lib/wx" "/usr/lib32/wx"
+                wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")
+        endif(CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32")
+    endif(Linux)
 
-#-------------------------------------------------------------------------------
-#			[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)
-#-------------------------------------------------------------------------------
+	include(${wxWidgets_USE_FILE})
+endif(wxWidgets_FOUND)
 
+# Zlib
+if(ZLIB_FOUND AND NOT projectZLIB)
+	include_directories(${ZLIB_INCLUDE_DIRS})
+endif(ZLIB_FOUND AND NOT projectZLIB)

 

  ViewVC Help
Powered by ViewVC 1.1.22