1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-03-09 23:38:56 +00:00

update cmake minimum requirement from 2.8 to 3.0.2 due to usage of version comparasion of if command

check valac version to decide whether or not to use new Gdk.Monitor class
This commit is contained in:
Derek Dai 2017-03-24 01:08:18 +08:00
parent 19d60ad66a
commit b2fae367bf
No known key found for this signature in database
GPG key ID: E109CC97553EF009
3 changed files with 12 additions and 4 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 3.0.2)
project(Miraclecast) project(Miraclecast)

View file

@ -17,10 +17,18 @@ find_library(READLINE REQUIRED)
pkg_check_modules(GIO2 REQUIRED gio-2.0) pkg_check_modules(GIO2 REQUIRED gio-2.0)
pkg_check_modules(GDK3 REQUIRED gdk-3.0) pkg_check_modules(GDK3 REQUIRED gdk-3.0)
execute_process(COMMAND ${VALAC} --version
OUTPUT_VARIABLE VALAC_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "Vala " "" VALAC_VERSION "${VALAC_VERSION}")
if(VALAC_VERSION VERSION_GREATER 0.34.0)
list(APPEND VALA_EXTRA_OPTIONS -D VALA_VERSION_NEWER_THEN_0_34)
endif()
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --atleast-version 3.22 gdk-3.0 execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --atleast-version 3.22 gdk-3.0
RESULT_VARIABLE GDK_VERSION_NEWER_THEN_3_22) RESULT_VARIABLE GDK_VERSION_NEWER_THEN_3_22)
if(NOT GDK_VERSION_NEWER_THEN_3_22) if(NOT GDK_VERSION_NEWER_THEN_3_22)
set(VALA_EXTRA_OPTIONS -D GDK_VERSION_NEWER_THEN_3_22) list(APPEND VALA_EXTRA_OPTIONS -D GDK_VERSION_NEWER_THEN_3_22)
endif() endif()
set(RES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/res) set(RES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/res)

View file

@ -330,7 +330,7 @@ private class WfdCtl : GLib.Application
info("P2P group formed"); info("P2P group formed");
} }
#if GDK_VERSION_NEWER_THEN_3_22 #if GDK_VERSION_NEWER_THEN_3_22 && VALA_VERSION_NEWER_THEN_0_34
private void get_monitor_geometry(out Gdk.Rectangle g) throws Error private void get_monitor_geometry(out Gdk.Rectangle g) throws Error
{ {
Gdk.Monitor m; Gdk.Monitor m;
@ -441,7 +441,7 @@ private class WfdCtl : GLib.Application
} }
int n_monitors; int n_monitors;
#if GDK_VERSION_NEWER_THEN_3_22 #if GDK_VERSION_NEWER_THEN_3_22 && VALA_VERSION_NEWER_THEN_0_34
n_monitors = display.get_n_monitors(); n_monitors = display.get_n_monitors();
#else #else
n_monitors = display.get_default_screen().get_n_monitors(); n_monitors = display.get_default_screen().get_n_monitors();