cmake: add a new GTK3.0 option

Thanks #micove for the patch
This commit is contained in:
Gregory Hainaut 2014-12-07 22:06:39 +01:00
parent 5ce4b85edd
commit 800262fc14
4 changed files with 29 additions and 10 deletions

View File

@ -41,6 +41,7 @@ for ARG in "$@"; do
--asan ) flags+=(-DUSE_ASAN=TRUE) ;; --asan ) flags+=(-DUSE_ASAN=TRUE) ;;
--wx28 ) flags+=(-DWX28_API=TRUE) ;; --wx28 ) flags+=(-DWX28_API=TRUE) ;;
--wx30 ) flags+=(-DWX28_API=FALSE) ;; --wx30 ) flags+=(-DWX28_API=FALSE) ;;
--gtk3 ) flags+=(-DGTK3_API=TRUE) ;;
--64-bit-dont-work ) flags+=(-D64BIT_BUILD_DONT_WORK=TRUE) ;; --64-bit-dont-work ) flags+=(-D64BIT_BUILD_DONT_WORK=TRUE) ;;
--no-simd ) flags+=(-DDISABLE_ADVANCE_SIMD=TRUE) ;; --no-simd ) flags+=(-DDISABLE_ADVANCE_SIMD=TRUE) ;;
-D* ) flags+=($ARG) ;; -D* ) flags+=($ARG) ;;
@ -51,21 +52,25 @@ for ARG in "$@"; do
echo "--dev / --devel : Build PCSX2 as a Development build." echo "--dev / --devel : Build PCSX2 as a Development build."
echo "--debug : Build PCSX2 as a Debug build." echo "--debug : Build PCSX2 as a Debug build."
echo "--release : Build PCSX2 as a Release build." echo "--release : Build PCSX2 as a Release build."
echo
echo "--clean : Do a clean build." echo "--clean : Do a clean build."
echo "--extra : Build all plugins"
echo
echo "** Developper option **" echo "** Developper option **"
echo "--clang : Build with Clang/llvm" echo "--clang : Build with Clang/llvm"
echo "--extra : Build all plugins" echo "--asan : Enable Address sanitizer"
echo "--asan : Enable with Address sanitizer"
echo echo
echo "--wx28 : Force wxWidget 2.8" echo "--wx28 : Force wxWidget 2.8"
echo "--wx30 : Allow to use wxWidget 3.0" echo "--wx30 : Allow to use wxWidget 3.0"
echo "--glsl : Replace CG backend of ZZogl by GLSL" echo "--glsl : Replace CG backend of ZZogl by GLSL"
echo "--egl : Replace GLX by EGL (ZZogl plugins only)" echo "--egl : Replace GLX by EGL (ZZogl plugins only)"
echo "--sdl2 : Build with SDL2 (crash if wx is linked to SDL1)" echo "--sdl2 : Build with SDL2 (crash if wx is linked to SDL1)"
echo "--gles : Replace openGL backend of GSdx by openGLES3" echo "--gles : Replace openGL backend of GSdx by openGLES3.1"
echo echo
echo "** Hardcode Developper option **"
echo "--64-bit-dont-work : Don't use it!" echo "--64-bit-dont-work : Don't use it!"
echo "--no-simd : Only allow sse2" echo "--no-simd : Only allow sse2"
echo "--gtk3 : replace GTK2 by GTK3"
exit 1 exit 1
esac esac
done done

View File

@ -34,6 +34,7 @@ option(XDG_STD "Use XDG standard path instead of the standard PCSX2 path")
option(EXTRA_PLUGINS "Build various 'extra' plugins") option(EXTRA_PLUGINS "Build various 'extra' plugins")
option(SDL2_API "Use SDL2 on spu2x and onepad") option(SDL2_API "Use SDL2 on spu2x and onepad")
option(WX28_API "Force wxWidget 2.8 lib") option(WX28_API "Force wxWidget 2.8 lib")
option(GTK3_API "Use GTK3 api")
if(PACKAGE_MODE) if(PACKAGE_MODE)
if(NOT DEFINED PLUGIN_DIR) if(NOT DEFINED PLUGIN_DIR)
@ -239,6 +240,7 @@ else()
set(ASAN_FLAG "") set(ASAN_FLAG "")
endif() endif()
# Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG}") set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG}")
# c++ only flags # c++ only flags
set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof") set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof")

View File

@ -29,7 +29,11 @@ macro(check_lib var lib)
include_directories(${${var}_INCLUDE}) include_directories(${${var}_INCLUDE})
_internal_message("-- ${lib} found") _internal_message("-- ${lib} found")
set(${var}_FOUND 1 CACHE INTERNAL "") set(${var}_FOUND 1 CACHE INTERNAL "")
else() elseif(${var}_LIBRARIES)
_internal_message("-- ${lib} not found (miss include)")
elseif(${var}_INCLUDE)
_internal_message("-- ${lib} not found (miss lib)")
else()
_internal_message("-- ${lib} not found") _internal_message("-- ${lib} not found")
endif() endif()
endif() endif()

View File

@ -1,12 +1,6 @@
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Search all libraries on the system # Search all libraries on the system
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
if(Linux)
# Most plugins (if not all) and PCSX2 core need gtk2, so set the required flags
find_package(GTK2 REQUIRED gtk)
find_package(X11)
endif()
## Use cmake package to find module ## Use cmake package to find module
find_package(ALSA) find_package(ALSA)
find_package(BZip2) find_package(BZip2)
@ -50,12 +44,26 @@ else()
find_package(SDL) find_package(SDL)
endif() endif()
if (Linux)
find_package(X11)
# Most plugins (if not all) and PCSX2 core need gtk2, so set the required flags
if (GTK3_API)
check_lib(GTK3 gtk+-3.0 gtk/gtk.h)
else()
find_package(GTK2 REQUIRED gtk)
endif()
endif()
#---------------------------------------- #----------------------------------------
# Use system include # Use system include
#---------------------------------------- #----------------------------------------
if(Linux) if(Linux)
if(GTK2_FOUND) if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS}) include_directories(${GTK2_INCLUDE_DIRS})
elseif(GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
# A lazy solution
set(GTK2_LIBRARIES ${GTK3_LIBRARIES})
endif() endif()
if(X11_FOUND) if(X11_FOUND)