aboutsummaryrefslogtreecommitdiff
path: root/tools/depends/target/Toolchain_binaddons.cmake.in
blob: eadaa485be5e66bcb1e862d73d0dc352ecc0a79c (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
set(OS "@platform_os@")
set(CPU "@use_cpu@")
set(PLATFORM "@target_platform@")
set(APP_RENDER_SYSTEM @app_rendersystem@)

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_PLATFORM_NAME rbpi)
    set(ENABLE_LDGOLD OFF CACHE BOOL "Disabling Gnu Gold Linker" FORCE)
    if(NOT APP_RENDER_SYSTEM)
      set(APP_RENDER_SYSTEM gles)
    endif()
  endif()
  if(NOT APP_RENDER_SYSTEM)
    set(APP_RENDER_SYSTEM gl)
  endif()
elseif(OS STREQUAL android)
  set(CMAKE_SYSTEM_NAME Android)
  set(CORE_SYSTEM_NAME android)
  if(NOT APP_RENDER_SYSTEM)
    set(APP_RENDER_SYSTEM gles)
  endif()
elseif(OS STREQUAL osx)
  set(CMAKE_SYSTEM_NAME Darwin)
  set(CORE_SYSTEM_NAME osx)
  if(NOT APP_RENDER_SYSTEM)
    set(APP_RENDER_SYSTEM gl)
  endif()
elseif(OS STREQUAL ios)
  set(CMAKE_SYSTEM_NAME Darwin)
  set(CORE_SYSTEM_NAME ios)
  if(NOT APP_RENDER_SYSTEM)
    set(APP_RENDER_SYSTEM gles)
  endif()
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")
set(CMAKE_OBJDUMP @OBJDUMP@ CACHE FILEPATH "Objdump")
set(CMAKE_RANLIB @RANLIB@ CACHE FILEPATH "Ranlib")

if(@use_ccache@ STREQUAL "yes")
  set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "@CCACHE@")
endif()

# 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_PLATFORM_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_path@)
  set(SDKROOT @use_sdk_path@)
  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)
set(CMAKE_FIND_FRAMEWORK LAST)

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

set(KODI_DEPENDSBUILD 1)