Skip to content

Fix cmake for rapsberry-pi cross compilation #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,22 @@ set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
set_property(CACHE GLSystem PROPERTY STRINGS "Desktop OpenGL" "OpenGL ES")

#-------------------------------------------------------------------------------
#check if we're running on Raspberry Pi
#check if we're building for Raspberry Pi
MESSAGE("Looking for bcm_host.h")

# First try the non standard path (raspbian and co)
if(EXISTS "/opt/vc/include/bcm_host.h")
MESSAGE("bcm_host.h found")
set(BCMHOST found)
set(RPI_ROOT_PATH "/opt/vc")
endif()

if(EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/include/bcm_host.h")
set(BCMHOST found)
set(RPI_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}/usr")
endif()

if (DEFINED BCMHOST)
MESSAGE("bcm_host.h found")
set(GLSystem "OpenGL ES")
else()
MESSAGE("bcm_host.h not found")
Expand All @@ -28,7 +39,7 @@ endif()
#-------------------------------------------------------------------------------
#check if we're running on olinuxino
MESSAGE("Looking for libMali.so")
if(EXISTS "/usr/lib/libMali.so")
if(EXISTS "${CMAKE_FIND_ROOT_PATH}/usr/lib/libMali.so")
MESSAGE("libMali.so found")
set(GLSystem "OpenGL ES")
else()
Expand Down Expand Up @@ -112,10 +123,10 @@ endif()

if(DEFINED BCMHOST)
LIST(APPEND COMMON_INCLUDE_DIRS
"/opt/vc/include"
"/opt/vc/include/interface/vcos"
"/opt/vc/include/interface/vmcs_host/linux"
"/opt/vc/include/interface/vcos/pthreads"
"${RPI_ROOT_PATH}/include"
"${RPI_ROOT_PATH}/include/interface/vcos"
"${RPI_ROOT_PATH}/include/interface/vmcs_host/linux"
"${RPI_ROOT_PATH}/include/interface/vcos/pthreads"
)
else()
if(${GLSystem} MATCHES "Desktop OpenGL")
Expand All @@ -134,7 +145,7 @@ endif()
if(DEFINED BCMHOST)
link_directories(
${Boost_LIBRARY_DIRS}
"/opt/vc/lib"
"${CMAKE_FIND_ROOT_PATH}/lib"
)
else()
link_directories(
Expand Down