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

Contents of /trunk/cmake/SearchForStuff.cmake

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 5 months ago) by william
File size: 5162 byte(s)
re-commit (had local access denied errors when committing)
1 #-------------------------------------------------------------------------------
2 # Search all libraries on the system
3 #-------------------------------------------------------------------------------
4 # Do not search Lib in /usr/lib64. Hope it is not overwritten in find_package or others macro
5 SET(FIND_LIBRARY_USE_LIB64_PATHS FALSE)
6
7 ## Linux only libraries
8 if(Linux)
9 # Most plugins (if not all) and PCSX2 core need gtk2, so
10 # set the required flags
11 find_package(GTK2 REQUIRED gtk)
12 if(GTK2_FOUND)
13 # From version 2.21.3 gtk moved gdk-pixbuf into a separate module
14 # 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 /usr/include/gdk-pixbuf-2.0
17 /usr/include)
18 if (GDK_PIXBUF_INCLUDE_DIRS)
19 set(GTK2_INCLUDE_DIRS "${GDK_PIXBUF_INCLUDE_DIRS}" "${GTK2_INCLUDE_DIRS}")
20 # Remove duplicates when cmake will be fixed
21 list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS)
22 endif (GDK_PIXBUF_INCLUDE_DIRS)
23 endif(GTK2_FOUND)
24
25 find_package(X11)
26 endif(Linux)
27
28 ## Use cmake package to find module
29 find_package(ALSA)
30 find_package(BZip2)
31 find_package(JPEG)
32 find_package(OpenGL)
33 # Tell cmake that we use SDL as a library and not as an application
34 set(SDL_BUILDING_LIBRARY TRUE)
35 find_package(SDL)
36 find_package(Subversion)
37 # The requierement of wxWidgets is checked in SelectPcsx2Plugins module
38 # Does not requier the module (allow to compile non-wx plugins)
39 find_package(wxWidgets COMPONENTS base core adv)
40 if(NOT FORCE_INTERNAL_ZLIB)
41 find_package(ZLIB)
42 endif(NOT FORCE_INTERNAL_ZLIB)
43
44 ## Use pcsx2 package to find module
45 include(FindCg)
46 include(FindGlew)
47 include(FindPortAudio)
48 if(NOT FORCE_INTERNAL_SOUNDTOUCH)
49 include(FindSoundTouch)
50 endif(NOT FORCE_INTERNAL_SOUNDTOUCH)
51 include(FindSparseHash)
52
53 # Note for include_directory: The order is important to avoid a mess between include file from your system and the one of pcsx2
54 # If you include first 3rdparty, all 3rdpary include will have a higer priority...
55 # If you include first /usr/include, all system include will have a higer priority over the pcsx2 one...
56 # Current implementation:
57 # 1/ include 3rdparty sub-directory that we will used (either request or fallback)
58 # 2/ include system one
59 #----------------------------------------
60 # Fallback on 3rdparty libraries
61 #----------------------------------------
62 # Note to avoid some conflict with system include, we must include 3rdparty first
63 if(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB)
64 # use project one
65 set(projectZLIB TRUE)
66 set(ZLIB_FOUND TRUE)
67 # Set path
68 set(ZLIB_LIBRARIES pcsx2_zlib)
69 include_directories(${PROJECT_SOURCE_DIR}/3rdparty/zlib)
70 message(STATUS "Use internal pcsx2 zlib library")
71 endif(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB)
72
73 if(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH)
74 # use project one
75 set(projectSoundTouch TRUE)
76 set(SOUNDTOUCH_FOUND TRUE)
77 # Set path
78 set(SOUNDTOUCH_LIBRARIES pcsx2_SoundTouch)
79 include_directories(${PROJECT_SOURCE_DIR}/3rdparty/soundtouch_linux_include)
80 message(STATUS "Use internal pcsx2 SoundTouch library")
81 endif(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH)
82
83 #----------------------------------------
84 # Use system include (if not 3rdparty one)
85 #----------------------------------------
86 if(Linux)
87 # GTK2
88 if(GTK2_FOUND)
89 include_directories(${GTK2_INCLUDE_DIRS})
90 endif(GTK2_FOUND)
91
92 # x11
93 if(X11_FOUND)
94 include_directories(${X11_INCLUDE_DIR})
95 endif(X11_FOUND)
96 endif(Linux)
97
98 # ALSA
99 if(ALSA_FOUND)
100 include_directories(${ALSA_INCLUDE_DIRS})
101 endif(ALSA_FOUND)
102
103 # bzip2
104 if(BZIP2_FOUND)
105 include_directories(${BZIP2_INCLUDE_DIR})
106 endif(BZIP2_FOUND)
107
108 # Cg
109 if(CG_FOUND)
110 include_directories(${CG_INCLUDE_DIRS})
111 endif(CG_FOUND)
112
113 # Jpeg
114 if(JPEG_FOUND)
115 include_directories(${JPEG_INCLUDE_DIR})
116 endif(JPEG_FOUND)
117
118 # GLEW
119 if(GLEW_FOUND)
120 include_directories(${GLEW_INCLUDE_DIR})
121 endif(GLEW_FOUND)
122
123 # OpenGL
124 if(OPENGL_FOUND)
125 include_directories(${OPENGL_INCLUDE_DIR})
126 endif(OPENGL_FOUND)
127
128 # PortAudio
129 if(PORTAUDIO_FOUND)
130 include_directories(${PORTAUDIO_INCLUDE_DIR})
131 endif(PORTAUDIO_FOUND)
132
133 # SDL
134 if(SDL_FOUND)
135 include_directories(${SDL_INCLUDE_DIR})
136 endif(SDL_FOUND)
137
138 # SoundTouch
139 if(SOUNDTOUCH_FOUND AND NOT projectSoundTouch)
140 include_directories(${SOUNDTOUCH_INCLUDE_DIR})
141 endif(SOUNDTOUCH_FOUND AND NOT projectSoundTouch)
142
143 # SPARSEHASH
144 if(SPARSEHASH_FOUND)
145 include_directories(${SPARSEHASH_INCLUDE_DIR})
146 endif(SPARSEHASH_FOUND)
147
148 # Wx
149 if(wxWidgets_FOUND)
150 if(Linux)
151 # Force the use of 32 bit library configuration on
152 # 64 bits machine with 32 bits library in /usr/lib32
153 if(CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32")
154 STRING(REGEX REPLACE "/usr/lib/wx" "/usr/lib32/wx"
155 wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")
156 endif(CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32")
157 endif(Linux)
158
159 include(${wxWidgets_USE_FILE})
160 endif(wxWidgets_FOUND)
161
162 # Zlib
163 if(ZLIB_FOUND AND NOT projectZLIB)
164 include_directories(${ZLIB_INCLUDE_DIRS})
165 endif(ZLIB_FOUND AND NOT projectZLIB)

  ViewVC Help
Powered by ViewVC 1.1.22