blob: 76f479cf39b1aa46712780d267813a998b104df1 (
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
set(DEPENDS_PATH "@prefix@/@deps_dir@")
set(NATIVEPREFIX "@prefix@/@tool_dir@")
set(TARBALL_DIR "@use_tarballs@")
set(OS "@platform_os@")
set(CMAKE_SYSTEM_PROCESSOR @host_cpu@)
set(CPU "@use_cpu@")
set(PLATFORM "@target_platform@")
# 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)
set(CORE_PLATFORM_NAME @target_platform@)
set(APP_RENDER_SYSTEM @app_rendersystem@ CACHE STRING "Render system to use: \"gl\" or \"gles\"")
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 darwin_embedded)
set(CMAKE_SYSTEM_NAME Darwin)
set(CORE_SYSTEM_NAME darwin_embedded)
if(PLATFORM STREQUAL appletvos)
set(CORE_PLATFORM_NAME tvos)
else()
set(CORE_PLATFORM_NAME ios)
endif()
endif()
if(CORE_SYSTEM_NAME STREQUAL darwin_embedded)
# Necessary to build the main Application (but not other dependencies)
# with Xcode (and a bundle with Makefiles) (https://cmake.org/Bug/view.php?id=15329)
if(NOT PROJECT_SOURCE_DIR MATCHES "tools/depends")
message(STATUS "Toolchain enabled ${CORE_PLATFORM_NAME} bundle for project ${PROJECT_NAME}")
set(CMAKE_MACOSX_BUNDLE YES)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
# Need to set this attribute to "" in order to
# completely disable code signing
# see: https://gitlab.kitware.com/cmake/cmake/issues/19112
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
if(CORE_PLATFORM_NAME STREQUAL tvos)
set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "3")
set(CMAKE_XCODE_ATTRIBUTE_TVOS_DEPLOYMENT_TARGET 11.0)
else()
set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 11.0)
endif()
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(CMAKE_OSX_SYSROOT @use_sdk_path@)
set(CMAKE_XCODE_ATTRIBUTE_ARCHS ${CPU})
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_AS @AS@ CACHE FILEPATH "Assembler")
set(CMAKE_LINKER @LD@ CACHE FILEPATH "Linker")
set(CMAKE_NM @NM@ CACHE FILEPATH "Nm")
set(CMAKE_STRIP @STRIP@ CACHE PATH "strip binary" FORCE)
set(CMAKE_OBJDUMP @OBJDUMP@ CACHE FILEPATH "Objdump")
set(CMAKE_RANLIB @RANLIB@ CACHE FILEPATH "Ranlib")
if(NOT "@use_ccache@" STREQUAL "")
set(CMAKE_CXX_COMPILER_LAUNCHER @CCACHE@)
set(CMAKE_C_COMPILER_LAUNCHER @CCACHE@)
endif()
# where is the target environment
set(CMAKE_FIND_ROOT_PATH @prefix@/@deps_dir@)
set(CMAKE_LIBRARY_PATH @prefix@/@deps_dir@/lib)
if(NOT "@use_toolchain@" STREQUAL "")
list(APPEND CMAKE_FIND_ROOT_PATH @use_toolchain@ @use_toolchain@/@use_host@ @use_toolchain@/@use_host@/sysroot @use_toolchain@/@use_host@/sysroot/usr @use_toolchain@/@use_host@/libc @use_toolchain@/lib/@use_host@/sysroot @use_toolchain@/usr @use_toolchain@/sysroot/usr)
set(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH}:@use_toolchain@/usr/lib/@use_host@:@use_toolchain@/lib/@use_host@")
endif()
if(NOT "@use_sdk_path@" STREQUAL "")
list(APPEND CMAKE_FIND_ROOT_PATH @use_sdk_path@ @use_sdk_path@/usr)
endif()
# add Android directories and tools
if(CORE_SYSTEM_NAME STREQUAL android)
set(NDKROOT @use_ndk_path@)
set(SDKROOT @use_sdk_path@)
set(TOOLCHAIN @use_toolchain@)
set(HOST @use_host@)
list(APPEND CMAKE_LIBRARY_PATH ${TOOLCHAIN}/sysroot/usr/lib/${HOST}/@use_ndk_api@)
string(REPLACE ":" ";" SDK_BUILDTOOLS_PATH "@build_tools_path@")
endif()
set(CMAKE_ASM_NASM_FLAGS "@platform_asflags@")
set(CMAKE_C_FLAGS "@platform_cflags@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
set(CMAKE_CXX_FLAGS "@platform_cxxflags@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
set(CMAKE_C_FLAGS_RELEASE "@platform_cflags_release@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
set(CMAKE_CXX_FLAGS_RELEASE "@platform_cxxflags_release@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
set(CMAKE_C_FLAGS_DEBUG "@platform_cflags_debug@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
set(CMAKE_CXX_FLAGS_DEBUG "@platform_cxxflags_debug@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
set(CMAKE_CPP_FLAGS "@platform_cflags@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
set(CMAKE_EXE_LINKER_FLAGS "-L@prefix@/@deps_dir@/lib @platform_ldflags@")
set(ENV{CFLAGS} ${CMAKE_C_FLAGS})
set(ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS})
set(ENV{CPPFLAGS} ${CMAKE_CPP_FLAGS})
set(ENV{LDFLAGS} ${CMAKE_EXE_LINKER_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)
set(ENV{PKG_CONFIG_LIBDIR} @prefix@/@deps_dir@/lib/pkgconfig:@prefix@/@deps_dir@/share/pkgconfig)
# Binary Addons
if(NOT CORE_SYSTEM_NAME STREQUAL linux)
set(ADDONS_PREFER_STATIC_LIBS ON)
endif()
# common usage in autoconf to refer to host arch tool use
set(CC_FOR_BUILD "@CC_FOR_BUILD@")
set(CXX_FOR_BUILD "@CXX_FOR_BUILD@")
set(LD_FOR_BUILD "@LD_FOR_BUILD@")
set(CC_BINARY_FOR_BUILD "@CC_FOR_BUILD@")
set(CXX_BINARY_FOR_BUILD "@CXX_FOR_BUILD@")
set(AR_FOR_BUILD "@AR_FOR_BUILD@")
set(RANLIB_FOR_BUILD "@RANLIB_FOR_BUILD@")
set(AS_FOR_BUILD "@AS_FOR_BUILD@")
set(NM_FOR_BUILD "@NM_FOR_BUILD@")
set(STRIP_FOR_BUILD "@STRIP_FOR_BUILD@")
set(READELF_FOR_BUILD "@READELF_FOR_BUILD@")
set(OBJDUMP_FOR_BUILD "@OBJDUMP_FOR_BUILD@")
# flags for host arch building
set(CFLAGS_FOR_BUILD "@host_includes@ -I@prefix@/@tool_dir@/include")
set(LDFLAGS_FOR_BUILD "@host_includes@ -L@prefix@/@tool_dir@/lib")
# other build tools
find_program(NASM nasm HINTS "${NATIVEPREFIX}/bin" REQUIRED)
# common autoconf build tools
find_program(AUTOCONF autoconf HINTS "${NATIVEPREFIX}/bin" REQUIRED)
find_program(ACLOCAL aclocal HINTS "${NATIVEPREFIX}/bin" REQUIRED)
find_program(AUTOHEADER autoheader HINTS "${NATIVEPREFIX}/bin" REQUIRED)
find_program(AUTOMAKE automake HINTS "${NATIVEPREFIX}/bin" REQUIRED)
find_program(AUTOM4TE autom4te HINTS "${NATIVEPREFIX}/bin" REQUIRED)
find_program(AUTOPOINT autopoint HINTS "${NATIVEPREFIX}/bin" REQUIRED)
find_program(AUTORECONF autoreconf HINTS "${NATIVEPREFIX}/bin" REQUIRED)
find_program(LIBTOOL libtool HINTS "${NATIVEPREFIX}/bin" REQUIRED)
find_program(LIBTOOLIZE libtoolize HINTS "${NATIVEPREFIX}/bin" REQUIRED)
set(ENV{ACLOCAL_PATH} "${DEPENDS_PATH}/share/aclocal:${NATIVEPREFIX}/share/aclocal")
set(ENVPATH "${NATIVEPREFIX}/bin:$ENV{PATH}")
# Dependency build tool config files
find_file(MESON-CROSS "cross-file.meson" PATHS "${DEPENDS_PATH}/share" NO_CMAKE_FIND_ROOT_PATH REQUIRED)
# autoconf config.site
find_file(CONFIG_SITE "config.site" PATHS "${DEPENDS_PATH}/share" NO_CMAKE_FIND_ROOT_PATH REQUIRED)
# Env variables for non cmake target environments
set(PROJECT_TARGETENV "AS=${CMAKE_AS}"
"AR=${CMAKE_AR}"
"CC=${CMAKE_C_COMPILER}"
"CXX=${CMAKE_CXX_COMPILER}"
"NM=${CMAKE_NM}"
"LD=${CMAKE_LINKER}"
"STRIP=${CMAKE_STRIP}"
"RANLIB=${CMAKE_RANLIB}"
"OBJDUMP=${CMAKE_OBJDUMP}"
"CFLAGS=${CMAKE_C_FLAGS}"
"CPPFLAGS=${CMAKE_CPP_FLAGS}"
"LDFLAGS=${CMAKE_EXE_LINKER_FLAGS}"
"PKG_CONFIG_LIBDIR=$ENV{PKG_CONFIG_LIBDIR}"
"AUTOM4TE=${AUTOM4TE}"
"AUTOMAKE=${AUTOMAKE}"
"AUTOCONF=${AUTOCONF}"
"AUTORECONF=${AUTORECONF}"
"ACLOCAL=${ACLOCAL}"
"ACLOCAL_PATH=$ENV{ACLOCAL_PATH}"
"AUTOPOINT=${AUTOPOINT}"
"AUTOHEADER=${AUTOHEADER}"
"LIBTOOL=${LIBTOOL}"
"LIBTOOLIZE=${LIBTOOLIZE}"
"CONFIG_SITE=${CONFIG_SITE}"
)
# Env variables for non cmake host environments
set(PROJECT_BUILDENV CC_FOR_BUILD=${CC_FOR_BUILD}
CXX_FOR_BUILD=${CXX_FOR_BUILD}
LD_FOR_BUILD=${LD_FOR_BUILD}
CC_BINARY_FOR_BUILD=${CC_FOR_BUILD}
CXX_BINARY_FOR_BUILD=${CXX_FOR_BUILD}
AR_FOR_BUILD=${AR_FOR_BUILD}
RANLIB_FOR_BUILD=${RANLIB_FOR_BUILD}
AS_FOR_BUILD=${AS_FOR_BUILD}
NM_FOR_BUILD=${NM_FOR_BUILD}
STRIP_FOR_BUILD=${STRIP_FOR_BUILD}
READELF_FOR_BUILD=${READELF_FOR_BUILD}
OBJDUMP_FOR_BUILD=${OBJDUMP_FOR_BUILD}
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD}
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD}
)
# variable to easily set host/target env for non cmake internal dep builds
set(DEP_BUILDENV ${CMAKE_COMMAND} -E env ${PROJECT_TARGETENV} ${PROJECT_BUILDENV})
set(KODI_DEPENDSBUILD 1)
|