Fix OSX build (#952)

This commit is contained in:
Murat Seker 2020-09-14 20:37:48 +02:00 committed by GitHub
parent 9b729f8913
commit 5e922be4d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 7 deletions

View File

@ -68,7 +68,11 @@ ELSE()
ENDIF()
if ( NOT DEFINED PLATFORM )
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )
if ( APPLE )
SET( PLATFORM "osx")
elseif ( WIN32 )
SET( PLATFORM "windows")
elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )
SET( PLATFORM "x11")
elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64")
SET( PLATFORM "rpi")
@ -79,10 +83,6 @@ if ( NOT DEFINED PLATFORM )
elseif ( ("${SYSTEM_CPUINFO}" MATCHES "amlogic" OR "${SYSTEM_CPUINFO}" MATCHES "odroid-c2" OR "${SYSTEM_CPUINFO}" MATCHES "vero4k") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
SET( PLATFORM "amlogic64" )
endif()
elseif ( APPLE )
SET( PLATFORM "osx")
elseif ( WIN32 )
SET( PLATFORM "windows")
endif()
if ( PLATFORM )
message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}")
@ -108,7 +108,7 @@ ENDMACRO()
if ( "${PLATFORM}" MATCHES "osx" )
# add specific prefix paths
FIRSTSUBDIR(SUBDIRQT "/usr/local/Cellar/qt5")
FIRSTSUBDIR(SUBDIRQT "/usr/local/Cellar/qt")
FIRSTSUBDIR(SUBDIRPY "/usr/local/opt/python3/Frameworks/Python.framework/Versions")
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${SUBDIRQT} ${SUBDIRPY} "/usr/local/opt/qt5" )
include_directories("/opt/X11/include/")

View File

@ -4,7 +4,10 @@ SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb)
find_package(XCB COMPONENTS SHM IMAGE RENDER RANDR REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5X11Extras REQUIRED)
if (NOT APPLE)
find_package(Qt5X11Extras REQUIRED)
endif()
include_directories(${XCB_INCLUDE_DIRS})
@ -19,3 +22,6 @@ target_link_libraries(xcb-grabber
${XCB_LIBRARIES}
)
if (NOT APPLE)
target_link_libraries(xcb-grabber Qt5::X11Extras)
endif()

View File

@ -7,7 +7,10 @@
#include <xcb/xcb_event.h>
#include <QCoreApplication>
#ifndef __APPLE__
#include <QX11Info>
#endif
#include <memory>
@ -427,7 +430,11 @@ xcb_render_pictformat_t XcbGrabber::findFormatForVisual(xcb_visualid_t visual) c
if (formats == nullptr)
return {};
#ifdef __APPLE__
int screen = 0;
#else
int screen = QX11Info::appScreen();
#endif
xcb_render_pictscreen_iterator_t sit =
xcb_render_query_pict_formats_screens_iterator(formats.get());