~phablet-team/aethercast/fix-for-microsoft-dongle

« back to all changes in this revision

Viewing changes to cmake/LinuxCrossCompile.cmake

  • Committer: Tarmac
  • Author(s): Simon Fels
  • Date: 2016-03-02 14:25:01 UTC
  • mfrom: (119.2.3 support-cross-compile)
  • Revision ID: tarmac-20160302142501-wfzthvz4e91grs7w
Add cross-compilation support.

Approved by PS Jenkins bot, Thomas Voß.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
set(CMAKE_SYSTEM_NAME Linux)
 
2
set(CMAKE_SYSTEM_VERSION 1)
 
3
 
 
4
set(AC_NDK_PATH $ENV{AC_NDK_PATH} CACHE STRING "path of mir android bundle")
 
5
 
 
6
if (NOT DEFINED AC_TARGET_MACHINE)
 
7
  set(AC_TARGET_MACHINE $ENV{AC_TARGET_MACHINE} CACHE STRING "target machine")
 
8
endif()
 
9
if (NOT DEFINED AC_GCC_VARIANT)
 
10
  set(AC_GCC_VARIANT $ENV{AC_GCC_VARIANT} CACHE STRING "gcc variant required")
 
11
endif()
 
12
 
 
13
set(CMAKE_C_COMPILER   /usr/bin/${AC_TARGET_MACHINE}-gcc${AC_GCC_VARIANT})
 
14
set(CMAKE_CXX_COMPILER /usr/bin/${AC_TARGET_MACHINE}-g++${AC_GCC_VARIANT})
 
15
 
 
16
# where to look to find dependencies in the target environment
 
17
set(CMAKE_FIND_ROOT_PATH  "${AC_NDK_PATH}")
 
18
 
 
19
#treat the chroot's includes as system includes
 
20
include_directories(SYSTEM "${AC_NDK_PATH}/usr/include" "${AC_NDK_PATH}/usr/include/${AC_TARGET_MACHINE}")
 
21
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH "${AC_NDK_PATH}/usr/include" "${AC_NDK_PATH}/usr/include/${AC_TARGET_MACHINE}" )
 
22
 
 
23
# Add the chroot libraries as system libraries
 
24
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
 
25
  "${AC_NDK_PATH}/lib"
 
26
  "${AC_NDK_PATH}/lib/${AC_TARGET_MACHINE}"
 
27
  "${AC_NDK_PATH}/usr/lib"
 
28
  "${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}"
 
29
)
 
30
 
 
31
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
 
32
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
 
33
set(CMAKE_EXECUTABLE_RUNTIME_C_FLAG "-Wl,-rpath-link,")
 
34
set(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG "-Wl,-rpath-link,")
 
35
set(CMAKE_INSTALL_RPATH "${AC_NDK_PATH}/lib:${AC_NDK_PATH}/lib/${AC_TARGET_MACHINE}:${AC_NDK_PATH}/usr/lib:${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}")
 
36
 
 
37
set(ENV{PKG_CONFIG_PATH} "${AC_NDK_PATH}/usr/lib/pkgconfig:${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}/pkgconfig")
 
38
set(ENV{PKG_CONFIG_SYSROOT_DIR} "${AC_NDK_PATH}")
 
39
 
 
40
#use only the cross compile system
 
41
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 
42
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 
43
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)