forked from wateret/mengde
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable arm cross building (wateret#56)
This will enable cross building for ARM - Tested with Raspberry Pi 3 with rpi SDL backend
- Loading branch information
1 parent
08c209e
commit 8da40ce
Showing
5 changed files
with
116 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Notice: this file is used in cross building for ARMv7l | ||
# find_package() will be looking for host machine | ||
# and it will not be correct for cross building for ARM target. | ||
# As RootFS will be prepared with required packages, | ||
# we assume they are installed as described in below folders. | ||
|
||
if(NOT DEFINED ROOTFS_ARM) | ||
message(FATAL_ERROR "ROOTFS_ARM is required for cross building") | ||
endif() | ||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | ||
message(FATAL_ERROR "ARM cross build is currently supported only in Linux") | ||
endif() | ||
if(NOT EXISTS "${ROOTFS_ARM}/lib/arm-linux-gnueabihf") | ||
message(FATAL_ERROR "ROOTFS_ARM path doesn't seem to be a correct ARM rootfs") | ||
endif() | ||
|
||
set(Boost_VERSION 105500) | ||
set(Boost_FOUND True) | ||
set(BOOST_INCLUDEDIR ${ROOTFS_ARM}/usr/include/boost) | ||
set(BOOST_LIBRARYDIR ${ROOTFS_ARM}/usr/lib/arm-linux-gnueabihf) | ||
set(Boost_INCLUDE_DIRS ${ROOTFS_ARM}/usr/include/boost) | ||
set(SDL2_INCLUDE_DIR ${ROOTFS_ARM}/usr/include/SDL2) | ||
set(SDL2_TTF_INCLUDE_DIR ${ROOTFS_ARM}/usr/include/SDL2) | ||
set(LUA_INCLUDE_DIR ${ROOTFS_ARM}/usr/include/lua5.2) | ||
|
||
set(SDL2_LIBRARY SDL2main SDL2 pthread) | ||
set(SDL2_TTF_LIBRARIES SDL2_ttf) | ||
set(Boost_LIBRARIES boost_filesystem boost_system) | ||
set(LUA_LIBRARIES lua5.2 m) | ||
|
||
# include path for system | ||
include_directories(${ROOTFS_ARM}/usr/include/arm-linux-gnueabihf) | ||
|
||
# library path for system | ||
link_directories(${ROOTFS_ARM}/usr/lib/arm-linux-gnueabihf | ||
${BOOST_LIBRARYDIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
include(CMakeForceCompiler) | ||
|
||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR armv7l) | ||
|
||
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) | ||
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) | ||
|
||
# where is the target environment | ||
set(ROOTFS_ARM $ENV{ROOTFS_ARM}) | ||
set(CMAKE_SHARED_LINKER_FLAGS | ||
"${CMAKE_SHARED_LINKER_FLAGS} --sysroot=${ROOTFS_ARM}" | ||
CACHE INTERNAL "" FORCE) | ||
set(CMAKE_EXE_LINKER_FLAGS | ||
"${CMAKE_EXE_LINKER_FLAGS} --sysroot=${ROOTFS_ARM}" | ||
CACHE INTERNAL "" FORCE) | ||
|
||
set(CMAKE_FIND_ROOT_PATH ${ROOTFS_ARM}) | ||
# 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) | ||
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) |