/[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

revision 31 by william, Tue Sep 7 03:24:11 2010 UTC revision 62 by william, Tue Sep 7 11:08:22 2010 UTC
# Line 1  Line 1 
 # Search for additional software.  
   
1  #-------------------------------------------------------------------------------  #-------------------------------------------------------------------------------
2  # Minmal required version of libraries  #                                               Search all libraries on the system
3  #-------------------------------------------------------------------------------  #-------------------------------------------------------------------------------
4  set(minimal_wxWidgets_version 2.8.0)  # Do not search Lib in /usr/lib64. Hope it is not overwritten in find_package or others macro
5  set(minimal_GTK2_version 2.10)  SET(FIND_LIBRARY_USE_LIB64_PATHS FALSE)
 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()  
6    
7  SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS " ")  ## Linux only libraries
8  SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS " ")  if(Linux)
9        # Most plugins (if not all) and PCSX2 core need gtk2, so
10  #-------------------------------------------------------------------------------      # set the required flags
11  #                                                                       FindStuff      find_package(GTK2 REQUIRED gtk)
12  #-------------------------------------------------------------------------------      if(GTK2_FOUND)
13  #----------------------------------------          # From version 2.21.3 gtk moved gdk-pixbuf into a separate module
14  #                                               Required          # Cmake need to be fixed. For the moment uses a manual detection.
15  #----------------------------------------          find_path(GDK_PIXBUF_INCLUDE_DIRS NAMES gdk-pixbuf/gdk-pixbuf.h PATHS
16  if(Linux)                       # Linux only              /usr/include/gdk-pixbuf-2.0
17          # gtk required              /usr/include)
18          find_package(GTK2 REQUIRED gtk)          if (GDK_PIXBUF_INCLUDE_DIRS)
19                set(GTK2_INCLUDE_DIRS "${GDK_PIXBUF_INCLUDE_DIRS}" "${GTK2_INCLUDE_DIRS}")
20          # gtk found              # Remove duplicates when cmake will be fixed
21          if(GTK2_FOUND)              list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS)
22                  # add gtk include directories          endif (GDK_PIXBUF_INCLUDE_DIRS)
23                  include_directories(${GTK2_INCLUDE_DIRS})      endif(GTK2_FOUND)
         #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)  
24    
25        find_package(X11)
26        # Manually find Xxf86vm because it is not done in the module...
27        FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm       ${X11_LIB_SEARCH_PATH})
28        MARK_AS_ADVANCED(X11_Xxf86vm_LIB)
29  endif(Linux)  endif(Linux)
30    
31  #------------------------------------------------------------  ## Use cmake package to find module
32    find_package(ALSA)
33  # wx required  find_package(BZip2)
34  find_package(wxWidgets REQUIRED base core adv)  find_package(JPEG)
35    find_package(OpenGL)
36  # wx found  # Tell cmake that we use SDL as a library and not as an application
37  if(wxWidgets_FOUND)  set(SDL_BUILDING_LIBRARY TRUE)
38      if(Linux)                   # Linux only  find_package(SDL)
39          # Force the use of 32 bit library  find_package(Subversion)
40          STRING(REGEX REPLACE "/usr/lib/wx" "${32_LD_LIBRARY_PATH}/wx"  # The requierement of wxWidgets is checked in SelectPcsx2Plugins module
41              wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")  # Does not requier the module (allow to compile non-wx plugins)
42      endif(Linux)  find_package(wxWidgets COMPONENTS base core adv)
43          include(${wxWidgets_USE_FILE})  if(NOT FORCE_INTERNAL_ZLIB)
44  #else(wxWidgets_FOUND)      find_package(ZLIB)
45  #       message(FATAL_ERROR "wxWidgets libraries and include files not found.\  endif(NOT FORCE_INTERNAL_ZLIB)
 #                       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)  
46    
47  # if we found zlib on the system, use it else use project one  ## Use pcsx2 package to find module
48  if(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)  include(FindA52)
49          # add zlib include directories  include(FindCg)
50          include_directories(${ZLIB_INCLUDE_DIRS})  include(FindGlew)
51  else(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)  include(FindPortAudio)
52    if(NOT FORCE_INTERNAL_SOUNDTOUCH)
53        include(FindSoundTouch)
54    endif(NOT FORCE_INTERNAL_SOUNDTOUCH)
55    include(FindSparseHash)
56    
57    # Note for include_directory: The order is important to avoid a mess between include file from your system and the one of pcsx2
58    # If you include first 3rdparty, all 3rdpary include will have a higer priority...
59    # If you include first /usr/include, all system include will have a higer priority over the pcsx2 one...
60    # Current implementation:
61    # 1/ include 3rdparty sub-directory that we will used (either request or fallback)
62    # 2/ include system one
63    #----------------------------------------
64    #         Fallback on 3rdparty libraries
65    #----------------------------------------
66    # Note to avoid some conflict with system include, we must include 3rdparty first
67    if(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB)
68          # use project one          # use project one
69          set(projectZLIB TRUE)          set(projectZLIB TRUE)
70  endif(ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB)      set(ZLIB_FOUND TRUE)
71        # Set path
72  #------------------------------------------------------------      set(ZLIB_LIBRARIES pcsx2_zlib)
73        include_directories(${PROJECT_SOURCE_DIR}/3rdparty/zlib)
74        message(STATUS "Use internal pcsx2 zlib library")
75    endif(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB)
76    
77    if(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH)
78            # use project one
79            set(projectSoundTouch TRUE)
80            set(SOUNDTOUCH_FOUND TRUE)
81        # Set path
82            set(SOUNDTOUCH_LIBRARIES pcsx2_SoundTouch)
83        include_directories(${PROJECT_SOURCE_DIR}/3rdparty/soundtouch_linux_include)
84        message(STATUS "Use internal pcsx2 SoundTouch library")
85    endif(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH)
86    
87  #----------------------------------------  #----------------------------------------
88  #                                               Optional  #                   Use system include (if not 3rdparty one)
89  #----------------------------------------  #----------------------------------------
90  if(Linux)                       # Linux only  if(Linux)
91          # x11 optional      # GTK2
92          find_package(X11)          if(GTK2_FOUND)
93                    include_directories(${GTK2_INCLUDE_DIRS})
94            endif(GTK2_FOUND)
95    
96          # x11 found          # x11
97          if(X11_FOUND)          if(X11_FOUND)
                 # add x11 include directories  
98                  include_directories(${X11_INCLUDE_DIR})                  include_directories(${X11_INCLUDE_DIR})
         #else(X11_FOUND)  
         #       message(FATAL_ERROR "X11 libraries and include files not found.  
         #                       Please install X11.")  
99          endif(X11_FOUND)          endif(X11_FOUND)
100  endif(Linux)  endif(Linux)
101    
102      # Manually find Xxf86vm because it is not done in the module...  # A52
103      FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm       ${X11_LIB_SEARCH_PATH})  if(A52_FOUND)
     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  
104          include_directories(${A52_INCLUDE_DIR})          include_directories(${A52_INCLUDE_DIR})
105  else(A52_FOUND AND NOT FORCE_INTERNAL_A52)  endif(A52_FOUND)
         # use project one  
         set(projectA52 TRUE)  
     set(A52_LIBRARIES A52)  
 endif(A52_FOUND AND NOT FORCE_INTERNAL_A52)  
   
106    
107  # ALSA optional  # ALSA
 find_package(ALSA)  
   
 # ALSA found  
108  if(ALSA_FOUND)  if(ALSA_FOUND)
         # add ALSA include directories  
109          include_directories(${ALSA_INCLUDE_DIRS})          include_directories(${ALSA_INCLUDE_DIRS})
110  endif(ALSA_FOUND)  endif(ALSA_FOUND)
111    
112  #------------------------------------------------------------  # bzip2
113    if(BZIP2_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  
114          include_directories(${BZIP2_INCLUDE_DIR})          include_directories(${BZIP2_INCLUDE_DIR})
115  else(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2)  endif(BZIP2_FOUND)
         # use project one  
         set(projectBZip2 TRUE)  
         set(BZIP2_LIBRARIES bzip2)  
 endif(BZIP2_FOUND AND NOT FORCE_INTERNAL_BZIP2)  
   
 #------------------------------------------------------------  
   
 # Cg optional  
 include(FindCg)  
116    
117  # found Cg  # Cg
118  if(CG_FOUND)  if(CG_FOUND)
119          # add Cg include directories          include_directories(${CG_INCLUDE_DIRS})
         include_directories(${CG_INCLUDE_DIR})  
120  endif(CG_FOUND)  endif(CG_FOUND)
121    
122  #------------------------------------------------------------  # Jpeg
123    if(JPEG_FOUND)
124            include_directories(${JPEG_INCLUDE_DIR})
125    endif(JPEG_FOUND)
126    
127  # GLEW optional  # GLEW
 include(FindGlew)  
   
 # found GLEW  
128  if(GLEW_FOUND)  if(GLEW_FOUND)
         # add GLEW include directories  
129          include_directories(${GLEW_INCLUDE_PATH})          include_directories(${GLEW_INCLUDE_PATH})
130  endif(GLEW_FOUND)  endif(GLEW_FOUND)
131    
132  #------------------------------------------------------------  # OpenGL
   
 # OpenGL optional  
 find_package(OpenGL)  
   
 # opengl found  
133  if(OPENGL_FOUND)  if(OPENGL_FOUND)
         # add OpenGL include directories  
134          include_directories(${OPENGL_INCLUDE_DIR})          include_directories(${OPENGL_INCLUDE_DIR})
135  endif(OPENGL_FOUND)  endif(OPENGL_FOUND)
136    
137  #------------------------------------------------------------  # PortAudio
   
 # PortAudio optional  
 include(FindPortAudio)  
   
 # found PortAudio  
138  if(PORTAUDIO_FOUND)  if(PORTAUDIO_FOUND)
         # add PortAudio include directories  
139          include_directories(${PORTAUDIO_INCLUDE_DIR})          include_directories(${PORTAUDIO_INCLUDE_DIR})
140  endif(PORTAUDIO_FOUND)  endif(PORTAUDIO_FOUND)
141    
142  #------------------------------------------------------------  # SDL
   
 # SDL optional  
 set(SDL_BUILDING_LIBRARY TRUE)  
 find_package(SDL)  
   
 # SDL found  
143  if(SDL_FOUND)  if(SDL_FOUND)
         # add SDL include directories  
144          include_directories(${SDL_INCLUDE_DIR})          include_directories(${SDL_INCLUDE_DIR})
145  endif(SDL_FOUND)  endif(SDL_FOUND)
146    
147  #------------------------------------------------------------  # SoundTouch
148    if(SOUNDTOUCH_FOUND AND NOT projectSoundTouch)
 # SoundTouch optional  
 #include(FindSoundTouch)  
   
 # found SoundTouch        
 if(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH)  
         # add SoundTouch include directories  
149          include_directories(${SOUNDTOUCH_INCLUDE_DIR})          include_directories(${SOUNDTOUCH_INCLUDE_DIR})
150  else(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH)  endif(SOUNDTOUCH_FOUND AND NOT projectSoundTouch)
         # use project one  
         set(projectSoundTouch TRUE)  
         set(SOUNDTOUCH_LIBRARIES SoundTouch)  
   
         # found  
         set(SOUNDTOUCH_FOUND TRUE)  
 endif(SOUNDTOUCH_FOUND AND NOT FORCE_INTERNAL_SOUNDTOUCH)  
151    
152  #------------------------------------------------------------  # SPARSEHASH
153    if(SPARSEHASH_FOUND)
154            include_directories(${SPARSEHASH_INCLUDE_DIR})
155    endif(SPARSEHASH_FOUND)
156    
157  # Subversion optional  # Wx
158  find_package(Subversion)  if(wxWidgets_FOUND)
159        if(Linux)
160  # subversion found          # Force the use of 32 bit library configuration on
161  if(Subversion_FOUND)          # 64 bits machine with 32 bits library in /usr/lib32
162          set(SVN TRUE)          if(CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32")
163  else(Subversion_FOUND)              STRING(REGEX REPLACE "/usr/lib/wx" "/usr/lib32/wx"
164          set(SVN FALSE)                  wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")
165  endif(Subversion_FOUND)          endif(CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32")
166        endif(Linux)
 #-------------------------------------------------------------------------------  
 #                                                               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)  
 #---------------------------------------  
167    
168  #-------------------------------------------------------------------------------          include(${wxWidgets_USE_FILE})
169  #                       [TODO] Write CMakeLists.txt for these plugins.  endif(wxWidgets_FOUND)
 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)  
 #-------------------------------------------------------------------------------  
170    
171    # Zlib
172    if(ZLIB_FOUND AND NOT projectZLIB)
173            include_directories(${ZLIB_INCLUDE_DIRS})
174    endif(ZLIB_FOUND AND NOT projectZLIB)

Legend:
Removed from v.31  
changed lines
  Added in v.62

  ViewVC Help
Powered by ViewVC 1.1.22