Skip to content

Commit

Permalink
Updates to cmake files:
Browse files Browse the repository at this point in the history
- new FindEmbedded - it looks for presence of RPI or IMX6
- if Embedded found:
    - OpenGL find is skipped (this might find libGL.so on IMX6 otherwise)
    - pkgconfig is skipped (this might find Mesa libs on RPI if installed)

(that means, for IMX6 GLES2 will be used, on RPI as well with preference
of /opt/vc if found)
  • Loading branch information
mk01 committed Aug 8, 2015
1 parent 8dedf20 commit 58c4fcc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ find_package(platform REQUIRED)
add_definitions(-DUSE_DEMUX)

if(NOT WIN32)
find_package(OpenGL)
find_package(EMBEDDED)
if(NOT EMBEDDED_FOUND)
find_package(OpenGL)
endif()

if(OPENGL_FOUND)
set(INCLUDES ${OPENGL_INCLUDE_DIR})
set(DEPLIBS ${OPENGL_LIBRARIES})
Expand Down
12 changes: 12 additions & 0 deletions FindEMBEDDED.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# - Try to find embedded platforms (RPI/IMX6)
# Once done this will define
#
# EMBEDDED_FOUND - system is RPI / IMX6 and we most probably want to compile for GLES2 support
# (don't configure for OpenGL)

string(REGEX MATCH "^arm" TARGET_ARCH_ARM "${CMAKE_SYSTEM_PROCESSOR}")
if(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM)
return()
endif(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM)

find_path(EMBEDDED_FOUND NAMES include/linux/imxfb.h include/bcm_host.h PATHS /opt/vc)
6 changes: 4 additions & 2 deletions FindOpenGLES2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
# OPENGLES2_LIBRARIES - Link these to use OpenGLES2

find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
if(PKG_CONFIG_FOUND AND NOT EMBEDDED_FOUND)
pkg_check_modules(OpenGLES2 glesv2)
endif(PKG_CONFIG_FOUND)
elseif(EMBEDDED_FOUND)
set(CMAKE_PREFIX_PATH ${EMBEDDED_FOUND} ${CMAKE_PREFIX_PATH})
endif(PKG_CONFIG_FOUND AND NOT EMBEDDED_FOUND)

if(NOT OPENGLES2_FOUND)
if("${CORE_SYSTEM_NAME}" STREQUAL "ios")
Expand Down

0 comments on commit 58c4fcc

Please sign in to comment.