Skip to content
Open
Show file tree
Hide file tree
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
21 changes: 17 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,31 @@ project ("openGLES 2.0 for Raspberry Pi tutorials")

SET(COMPILE_DEFINITIONS -Werror)

if (CROSS_COMPILE)
message("Cross compilation mode enabled.")

# Some cmake systems has bug, and uses install rpath
# always, even while building
# (CMAKE_BUILD_RPATH is always equal to CMAKE_INSTALL_RPATH).
# In cross-compilation case such rpath would be wrong.
# E.g. we don't need rpath=/opt/vc/lib
# but we need rpath=${ROOTFS}/opt/vc/lib
# Currently the we just hardcode that linker flag.
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-rpath,${CMAKE_SOURCE_DIR}/libs/ilclient:${CMAKE_SYSROOT}/opt/vc/lib")
endif(CROSS_COMPILE)

include_directories(
/opt/vc/include
/opt/vc/include/interface/vcos/pthreads
/opt/vc/include/interface/vmcs_host/linux
${CMAKE_SYSROOT}/opt/vc/include
${CMAKE_SYSROOT}/opt/vc/include/interface/vcos/pthreads
${CMAKE_SYSROOT}/opt/vc/include/interface/vmcs_host/linux
# ${CMAKE_SOURCE_DIR}/libs/glm/
${CMAKE_SOURCE_DIR}/libs/ilclient
${CMAKE_SOURCE_DIR}/common
)

link_directories(
${CMAKE_SOURCE_DIR}/libs/ilclient
/opt/vc/lib
${CMAKE_SYSROOT}/opt/vc/lib
)


Expand Down
4 changes: 3 additions & 1 deletion encode_OGL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ target_link_libraries(encode_OGL
${GL_LIBS}
${CAM_LIBS}
${ILC_LIBS}
m
pthread
)
set (CMAKE_C_FLAGS "-DOMX_SKIP64BIT -lpthread -lm")
set (CMAKE_C_FLAGS "-DOMX_SKIP64BIT")
36 changes: 36 additions & 0 deletions raspberry-toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)

# Setup rootfs directory here
SET(PIROOT /home/stepan/projects/alpha_racing/raspberry-rootfs/rootfs)

# Directory to raspberry cross compiling tools
SET(PITOOLS /opt/tools)

SET(TOOLROOT ${PITOOLS}/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64)

# specify the cross compiler
SET(CMAKE_C_COMPILER ${TOOLROOT}/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER ${TOOLROOT}/bin/arm-linux-gnueabihf-g++)

SET(CMAKE_SYSROOT ${PIROOT})
SET(CMAKE_FIND_ROOT_PATH ${PIROOT})


# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)


# Some cmake systems has bug, and uses install rpath
# always, even while building.
# In cross-compilation case such rpath would be wrong.
# E.g. we don't need rpath=/opt/vc/lib
# but we need rpath=${ROOTFS}/opt/vc/lib
# Currently we should hardcode that linker flag in project CMakeLists.txt
SET(CMAKE_SKIP_BUILD_RPATH True)

set(CROSS_COMPILE True)