2010-01-21 15:12:50 +00:00
#-------------------------------------------------------------------------------
2010-06-04 17:17:55 +00:00
# Search all libraries on the system
2010-01-21 15:12:50 +00:00
#-------------------------------------------------------------------------------
2010-06-04 17:17:55 +00:00
# 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 )
2010-01-22 04:36:49 +00:00
2010-08-02 07:33:11 +00:00
## Linux only libraries
2010-06-04 17:17:55 +00:00
if ( Linux )
2011-05-23 21:34:45 +00:00
# Most plugins (if not all) and PCSX2 core need gtk2, so set the required flags
2012-05-07 16:29:06 +00:00
find_package ( GTK2 REQUIRED gtk )
2010-08-02 07:33:11 +00:00
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
/ u s r / i n c l u d e / g d k - p i x b u f - 2 . 0
/ u s r / i n c l u d e )
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 )
2014-04-17 18:24:12 +00:00
endif ( )
endif ( )
2010-08-02 07:33:11 +00:00
2010-06-04 17:17:55 +00:00
find_package ( X11 )
2014-04-17 18:24:12 +00:00
endif ( )
2010-08-02 07:33:11 +00:00
## Use cmake package to find module
2010-06-04 17:17:55 +00:00
find_package ( ALSA )
find_package ( BZip2 )
2011-01-20 20:45:07 +00:00
find_package ( Gettext ) # translation tool
2014-03-25 16:29:47 +00:00
find_package ( Git )
2010-06-23 10:07:18 +00:00
find_package ( JPEG )
2010-06-04 17:17:55 +00:00
find_package ( OpenGL )
# Tell cmake that we use SDL as a library and not as an application
2012-08-15 10:22:19 +00:00
set ( SDL_BUILDING_LIBRARY TRUE )
find_package ( SDL )
2011-05-14 11:03:02 +00:00
# The requirement of wxWidgets is checked in SelectPcsx2Plugins module
# Does not require the module (allow to compile non-wx plugins)
2011-02-15 14:37:30 +00:00
# Force the unicode build (the variable is only supported on cmake 2.8.3 and above)
2011-05-09 20:32:50 +00:00
# Warning do not put any double-quote for the argument...
# set(wxWidgets_CONFIG_OPTIONS --unicode=yes --debug=yes) # In case someone want to debug inside wx
2014-03-26 10:37:49 +00:00
#
2013-03-05 12:38:22 +00:00
# Fedora uses an extra non-standard option ... Arch must be the first option.
2014-03-26 10:37:49 +00:00
if ( Fedora )
2013-03-05 12:38:22 +00:00
set ( wxWidgets_CONFIG_OPTIONS --arch i686 --unicode=yes )
2013-01-02 13:34:38 +00:00
else ( )
set ( wxWidgets_CONFIG_OPTIONS --unicode=yes )
endif ( )
2010-08-02 07:33:11 +00:00
find_package ( wxWidgets COMPONENTS base core adv )
2012-08-15 10:22:19 +00:00
find_package ( ZLIB )
2010-08-02 07:33:11 +00:00
## Use pcsx2 package to find module
2012-12-13 16:11:53 +00:00
include ( FindAio )
2012-05-01 10:54:52 +00:00
## Include cg because of zzogl-cg and zerogs
2012-04-19 21:53:00 +00:00
#if(NOT GLSL_API)
2012-04-19 21:22:08 +00:00
include ( FindCg )
2014-04-17 18:24:12 +00:00
#endif()
2013-06-16 08:43:50 +00:00
include ( FindEGL )
2013-07-13 11:39:45 +00:00
include ( FindGLES2 )
2010-06-04 17:17:55 +00:00
include ( FindGlew )
2011-09-06 19:07:55 +00:00
include ( FindLibc )
2010-06-22 14:36:50 +00:00
include ( FindPortAudio )
2012-08-15 10:22:19 +00:00
include ( FindSoundTouch )
2010-06-21 11:05:30 +00:00
include ( FindSparseHash )
2010-06-04 17:17:55 +00:00
# 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...
2014-03-26 10:37:49 +00:00
# Current implementation:
2010-06-04 17:17:55 +00:00
# 1/ include 3rdparty sub-directory that we will used (either request or fallback)
# 2/ include system one
#----------------------------------------
# Fallback on 3rdparty libraries
#----------------------------------------
2012-08-15 10:22:19 +00:00
# Empty
2011-02-26 20:02:22 +00:00
2010-01-22 04:36:49 +00:00
#----------------------------------------
2010-06-04 17:17:55 +00:00
# Use system include (if not 3rdparty one)
2010-01-22 04:36:49 +00:00
#----------------------------------------
2010-06-04 17:17:55 +00:00
if ( Linux )
if ( GTK2_FOUND )
include_directories ( ${ GTK2_INCLUDE_DIRS } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-01-22 04:36:49 +00:00
if ( X11_FOUND )
include_directories ( ${ X11_INCLUDE_DIR } )
2014-04-17 18:24:12 +00:00
endif ( )
endif ( )
2010-01-22 04:36:49 +00:00
2012-12-13 16:11:53 +00:00
if ( AIO_FOUND )
include_directories ( ${ AIO_INCLUDE_DIR } )
endif ( )
2010-01-22 04:36:49 +00:00
if ( ALSA_FOUND )
include_directories ( ${ ALSA_INCLUDE_DIRS } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-01-22 04:36:49 +00:00
2010-06-19 13:59:16 +00:00
if ( BZIP2_FOUND )
2010-05-12 11:25:30 +00:00
include_directories ( ${ BZIP2_INCLUDE_DIR } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-01-22 04:36:49 +00:00
if ( CG_FOUND )
2010-06-23 15:45:05 +00:00
include_directories ( ${ CG_INCLUDE_DIRS } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-01-22 04:36:49 +00:00
2012-09-23 18:52:44 +00:00
if ( EGL_FOUND )
include_directories ( ${ EGL_INCLUDE_DIR } )
endif ( )
2010-06-23 10:07:18 +00:00
if ( JPEG_FOUND )
include_directories ( ${ JPEG_INCLUDE_DIR } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-06-23 10:07:18 +00:00
2010-01-22 04:36:49 +00:00
if ( GLEW_FOUND )
2010-10-30 11:24:03 +00:00
include_directories ( ${ GLEW_INCLUDE_DIR } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-01-22 04:36:49 +00:00
2013-07-13 11:39:45 +00:00
if ( GLESV2_FOUND )
include_directories ( ${ GLESV2_INCLUDE_DIR } )
endif ( )
2010-01-21 15:12:50 +00:00
if ( OPENGL_FOUND )
include_directories ( ${ OPENGL_INCLUDE_DIR } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-01-21 15:12:50 +00:00
2010-01-22 04:36:49 +00:00
if ( PORTAUDIO_FOUND )
include_directories ( ${ PORTAUDIO_INCLUDE_DIR } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-01-22 04:36:49 +00:00
2012-08-15 10:22:19 +00:00
if ( SDL_FOUND )
2010-01-21 15:12:50 +00:00
include_directories ( ${ SDL_INCLUDE_DIR } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-01-21 15:12:50 +00:00
2012-08-15 10:22:19 +00:00
if ( SOUNDTOUCH_FOUND )
2010-05-23 07:51:43 +00:00
include_directories ( ${ SOUNDTOUCH_INCLUDE_DIR } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-01-21 15:12:50 +00:00
2010-06-21 11:05:30 +00:00
if ( SPARSEHASH_FOUND )
include_directories ( ${ SPARSEHASH_INCLUDE_DIR } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-06-04 17:17:55 +00:00
if ( wxWidgets_FOUND )
if ( Linux )
2010-06-05 11:56:52 +00:00
# Force the use of 32 bit library configuration on
# 64 bits machine with 32 bits library in /usr/lib32
2014-07-05 10:09:17 +00:00
if ( _ARCH_64 AND !64BIT_BUILD )
2011-07-10 08:52:16 +00:00
## There is no guarantee that wx-config is a link to a 32 bits library. So you need to force the destinity
# Library can go into 3 path major paths (+ multiarch but you will see that later when implementation is done)
# 1/ /usr/lib32 (32 bits only)
# 2/ /usr/lib64 (64 bits only)
# 3/ /usr/lib (32 or 64 bits depends on distributions)
if ( EXISTS "/usr/lib32/wx" )
2011-05-10 09:26:39 +00:00
STRING ( REGEX REPLACE "/usr/lib/wx" "/usr/lib32/wx" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}" )
STRING ( REGEX REPLACE "/usr/lib64/wx" "/usr/lib32/wx" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}" )
2011-07-10 08:52:16 +00:00
endif ( EXISTS "/usr/lib32/wx" )
if ( EXISTS "/usr/lib/wx" )
2011-05-10 09:26:39 +00:00
STRING ( REGEX REPLACE "/usr/lib64/wx" "/usr/lib/wx" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}" )
2011-07-10 08:52:16 +00:00
endif ( EXISTS "/usr/lib/wx" )
2011-10-31 10:25:24 +00:00
# Multiarch ubuntu/debian
STRING ( REGEX REPLACE "/usr/lib/x86_64-linux-gnu" "/usr/lib/i386-linux-gnu" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}" )
2014-04-17 18:24:12 +00:00
endif ( )
2014-03-26 10:37:49 +00:00
# Some people are trying to compile with wx 3.0 ...
### 3.0
# -I/usr/lib/i386-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
# -L/usr/lib/i386-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
### 2.8
# -I/usr/lib/i386-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread
# -L/usr/lib/i386-linux-gnu -pthread -Wl,-z,relro -L/usr/lib/i386-linux-gnu -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
if ( "${wxWidgets_INCLUDE_DIRS}" MATCHES "3.0" )
message ( WARNING "\nWxwidget 3.0 is installed on your system whereas PCSX2 required 2.8 !!!\nPCSX2 will try to use 2.8 but if it would be better to fix your setup.\n" )
STRING ( REGEX REPLACE "unicode" "unicode-release" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}" )
STRING ( REGEX REPLACE "3\\.0" "2.8" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}" )
STRING ( REGEX REPLACE "3\\.0" "2.8" wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}" )
endif ( )
2014-04-17 18:24:12 +00:00
endif ( )
2010-06-05 11:56:52 +00:00
2010-06-04 17:17:55 +00:00
include ( ${ wxWidgets_USE_FILE } )
2014-04-17 18:24:12 +00:00
endif ( )
2010-06-04 17:17:55 +00:00
2012-08-15 10:22:19 +00:00
if ( ZLIB_FOUND )
2010-06-04 17:17:55 +00:00
include_directories ( ${ ZLIB_INCLUDE_DIRS } )
2014-04-17 18:24:12 +00:00
endif ( )
2014-07-05 12:54:56 +00:00
#----------------------------------------
# Use project-wide include directories
#----------------------------------------
include_directories ( ${ CMAKE_SOURCE_DIR } /common/include
$ { C M A K E _ S O U R C E _ D I R } / c o m m o n / i n c l u d e / U t i l i t i e s
$ { C M A K E _ S O U R C E _ D I R } / c o m m o n / i n c l u d e / x 8 6 e m i t t e r
# File generated by Cmake
$ { C M A K E _ B I N A R Y _ D I R } / c o m m o n / i n c l u d e
# WORKAROUND Some issue with multiarch on Debian/Ubuntu
/ u s r / i n c l u d e / i 3 8 6 - l i n u x - g n u
# WORKAROUND Clang integration issue with multiarch on Debian
#/usr/include/i386-linux-gnu/c++
#/usr/include/i386-linux-gnu/c++/4.8
)