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(Gettext) # translation tool |
32 |
find_package(JPEG) |
33 |
find_package(OpenGL) |
34 |
# Tell cmake that we use SDL as a library and not as an application |
35 |
set(SDL_BUILDING_LIBRARY TRUE) |
36 |
find_package(SDL) |
37 |
find_package(Subversion) |
38 |
# The requierement of wxWidgets is checked in SelectPcsx2Plugins module |
39 |
# Does not requier the module (allow to compile non-wx plugins) |
40 |
# Force the unicode build (the variable is only supported on cmake 2.8.3 and above) |
41 |
set(wxWidgets_CONFIG_OPTIONS "--unicode=yes") |
42 |
find_package(wxWidgets COMPONENTS base core adv) |
43 |
if(NOT FORCE_INTERNAL_ZLIB) |
44 |
find_package(ZLIB) |
45 |
endif(NOT FORCE_INTERNAL_ZLIB) |
46 |
|
47 |
## Use pcsx2 package to find module |
48 |
include(FindCg) |
49 |
include(FindGlew) |
50 |
include(FindPortAudio) |
51 |
if(NOT FORCE_INTERNAL_SOUNDTOUCH) |
52 |
include(FindSoundTouch) |
53 |
endif(NOT FORCE_INTERNAL_SOUNDTOUCH) |
54 |
include(FindSparseHash) |
55 |
|
56 |
# Note for include_directory: The order is important to avoid a mess between include file from your system and the one of pcsx2 |
57 |
# If you include first 3rdparty, all 3rdpary include will have a higer priority... |
58 |
# If you include first /usr/include, all system include will have a higer priority over the pcsx2 one... |
59 |
# Current implementation: |
60 |
# 1/ include 3rdparty sub-directory that we will used (either request or fallback) |
61 |
# 2/ include system one |
62 |
#---------------------------------------- |
63 |
# Fallback on 3rdparty libraries |
64 |
#---------------------------------------- |
65 |
# Note to avoid some conflict with system include, we must include 3rdparty first |
66 |
if(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB) |
67 |
# use project one |
68 |
set(projectZLIB TRUE) |
69 |
set(ZLIB_FOUND TRUE) |
70 |
# Set path |
71 |
set(ZLIB_LIBRARIES pcsx2_zlib) |
72 |
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/zlib) |
73 |
message(STATUS "Use internal pcsx2 zlib library") |
74 |
endif(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB) |
75 |
|
76 |
if(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH) |
77 |
# use project one |
78 |
set(projectSoundTouch TRUE) |
79 |
set(SOUNDTOUCH_FOUND TRUE) |
80 |
# Set path |
81 |
set(SOUNDTOUCH_LIBRARIES pcsx2_SoundTouch) |
82 |
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/soundtouch_linux_include) |
83 |
message(STATUS "Use internal pcsx2 SoundTouch library") |
84 |
endif(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH) |
85 |
|
86 |
#---------------------------------------- |
87 |
# Use system include (if not 3rdparty one) |
88 |
#---------------------------------------- |
89 |
if(Linux) |
90 |
# GTK2 |
91 |
if(GTK2_FOUND) |
92 |
include_directories(${GTK2_INCLUDE_DIRS}) |
93 |
endif(GTK2_FOUND) |
94 |
|
95 |
# x11 |
96 |
if(X11_FOUND) |
97 |
include_directories(${X11_INCLUDE_DIR}) |
98 |
endif(X11_FOUND) |
99 |
endif(Linux) |
100 |
|
101 |
# ALSA |
102 |
if(ALSA_FOUND) |
103 |
include_directories(${ALSA_INCLUDE_DIRS}) |
104 |
endif(ALSA_FOUND) |
105 |
|
106 |
# bzip2 |
107 |
if(BZIP2_FOUND) |
108 |
include_directories(${BZIP2_INCLUDE_DIR}) |
109 |
endif(BZIP2_FOUND) |
110 |
|
111 |
# Cg |
112 |
if(CG_FOUND) |
113 |
include_directories(${CG_INCLUDE_DIRS}) |
114 |
endif(CG_FOUND) |
115 |
|
116 |
# Jpeg |
117 |
if(JPEG_FOUND) |
118 |
include_directories(${JPEG_INCLUDE_DIR}) |
119 |
endif(JPEG_FOUND) |
120 |
|
121 |
# GLEW |
122 |
if(GLEW_FOUND) |
123 |
include_directories(${GLEW_INCLUDE_DIR}) |
124 |
endif(GLEW_FOUND) |
125 |
|
126 |
# OpenGL |
127 |
if(OPENGL_FOUND) |
128 |
include_directories(${OPENGL_INCLUDE_DIR}) |
129 |
endif(OPENGL_FOUND) |
130 |
|
131 |
# PortAudio |
132 |
if(PORTAUDIO_FOUND) |
133 |
include_directories(${PORTAUDIO_INCLUDE_DIR}) |
134 |
endif(PORTAUDIO_FOUND) |
135 |
|
136 |
# SDL |
137 |
if(SDL_FOUND) |
138 |
include_directories(${SDL_INCLUDE_DIR}) |
139 |
endif(SDL_FOUND) |
140 |
|
141 |
# SoundTouch |
142 |
if(SOUNDTOUCH_FOUND AND NOT projectSoundTouch) |
143 |
include_directories(${SOUNDTOUCH_INCLUDE_DIR}) |
144 |
endif(SOUNDTOUCH_FOUND AND NOT projectSoundTouch) |
145 |
|
146 |
# SPARSEHASH |
147 |
if(SPARSEHASH_FOUND) |
148 |
include_directories(${SPARSEHASH_INCLUDE_DIR}) |
149 |
endif(SPARSEHASH_FOUND) |
150 |
|
151 |
# Wx |
152 |
if(wxWidgets_FOUND) |
153 |
if(Linux) |
154 |
# Force the use of 32 bit library configuration on |
155 |
# 64 bits machine with 32 bits library in /usr/lib32 |
156 |
if(CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32") |
157 |
STRING(REGEX REPLACE "/usr/lib/wx" "/usr/lib32/wx" |
158 |
wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}") |
159 |
endif(CMAKE_SIZEOF_VOID_P MATCHES "8" AND EXISTS "/usr/lib32") |
160 |
endif(Linux) |
161 |
|
162 |
include(${wxWidgets_USE_FILE}) |
163 |
endif(wxWidgets_FOUND) |
164 |
|
165 |
# Zlib |
166 |
if(ZLIB_FOUND AND NOT projectZLIB) |
167 |
include_directories(${ZLIB_INCLUDE_DIRS}) |
168 |
endif(ZLIB_FOUND AND NOT projectZLIB) |