aboutsummaryrefslogtreecommitdiff
path: root/tools/depends/target/Toolchain_binaddons.cmake.in
blob: 69c9ac748691e29c823aa0c59b8e188f219c7884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
set(OS "@platform_os@")
set(CPU "@use_cpu@")
set(PLATFORM "@target_platform@")

set(CMAKE_FIND_ROOT_PATH @CMAKE_FIND_ROOT_PATH@)

# set CORE_SYSTEM_NAME and CMAKE_SYSTEM_NAME (sets CMAKE_CROSSCOMPILING)
if(OS STREQUAL linux)
  set(CMAKE_SYSTEM_NAME Linux)
  set(CORE_SYSTEM_NAME linux)
  if(PLATFORM STREQUAL raspberry-pi)
    set(CORE_SYSTEM_NAME rbpi)
  endif()
elseif(OS STREQUAL android)
  set(CMAKE_SYSTEM_NAME Android)
  set(CORE_SYSTEM_NAME android)
elseif(OS STREQUAL osx)
  set(CMAKE_SYSTEM_NAME Darwin)
  set(CORE_SYSTEM_NAME osx)
elseif(OS STREQUAL ios)
  set(CMAKE_SYSTEM_NAME Darwin)
  set(CORE_SYSTEM_NAME ios)
endif()

if(CORE_SYSTEM_NAME STREQUAL ios OR CORE_SYSTEM_NAME STREQUAL osx)
  set(CMAKE_OSX_SYSROOT @use_sdk_path@)
  list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT} ${CMAKE_OSX_SYSROOT}/usr /usr/X11R6)
  set(CMAKE_LIBRARY_PATH @CMAKE_FIND_ROOT_PATH@/lib:@use_sdk_path@/lib:/usr/X11R6/lib)
  set(CMAKE_INCLUDE_PATH @CMAKE_FIND_ROOT_PATH@/include:@use_sdk_path@/include:/usr/X11R6/include)
endif()
set(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
set(CMAKE_C_COMPILER @CC@)
set(CMAKE_CXX_COMPILER @CXX@)
set(CMAKE_AR @AR@ CACHE FILEPATH "Archiver")
set(CMAKE_LINKER @LD@ CACHE FILEPATH "Linker")

# where is the target environment
if(NOT "@use_toolchain@" STREQUAL "")
  list(APPEND CMAKE_FIND_ROOT_PATH @use_toolchain@/sysroot/usr)
endif()

# add RBPI's firmware directories
if(CORE_SYSTEM_NAME STREQUAL rbpi)
  list(APPEND CMAKE_FIND_ROOT_PATH @use_firmware@/opt/vc)
  list(APPEND CMAKE_LIBRARY_PATH @CMAKE_FIND_ROOT_PATH@/lib:@use_firmware@/opt/vc/lib)
  list(APPEND CMAKE_INCLUDE_PATH @CMAKE_FIND_ROOT_PATH@/include:@use_firmware@/opt/vc/include)
endif()

# add Android directories and tools
if(CORE_SYSTEM_NAME STREQUAL android)
  set(NDKROOT @use_ndk@)
  set(SDKROOT @use_sdk_path@)
  set(SDK_PLATFORM @use_sdk@)
  string(REPLACE ":" ";" SDK_BUILDTOOLS_PATH "@build_tools_path@")
endif()

set(CMAKE_C_FLAGS "@platform_cflags@ @platform_includes@")
set(CMAKE_CXX_FLAGS "@platform_cxxflags@ @platform_includes@")
set(CMAKE_C_FLAGS_RELEASE "@platform_cflags_release@ @platform_includes@")
set(CMAKE_CXX_FLAGS_RELEASE "@platform_cxxflags_release@ @platform_includes@")
set(CMAKE_C_FLAGS_DEBUG "@platform_cflags_debug@ @platform_includes@")
set(CMAKE_CXX_FLAGS_DEBUG "@platform_cxxflags_debug@ @platform_includes@")
set(CMAKE_CPP_FLAGS "@platform_cflags@ @platform_includes@")
set(CMAKE_LD_FLAGS "@platform_ldflags@")
set(ENV{CFLAGS} ${CMAKE_C_FLAGS})
set(ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS})
set(ENV{CPPFLAGS} ${CMAKE_CPP_FLAGS})
set(ENV{LDFLAGS} ${CMAKE_LD_FLAGS})
# 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)

# Binary Addons
if(NOT CORE_SYSTEM_NAME STREQUAL linux)
  set(ADDONS_PREFER_STATIC_LIBS ON)
endif()

set(KODI_DEPENDSBUILD 1)