aboutsummaryrefslogtreecommitdiff
path: root/tools/depends
diff options
context:
space:
mode:
authorfuzzard <fuzzard@kodi.tv>2022-06-15 20:05:17 +1000
committerfuzzard <fuzzard@kodi.tv>2022-06-17 22:22:43 +1000
commit56279cbd3cc458f54911236d12d5205311093b70 (patch)
treef46b98b6dcd637dc7d79fd47555acc529670bcce /tools/depends
parent7455c5ce0d9132ab338df35c4d35820b1529e16d (diff)
[tools/depends] Generate Native toolchain file
Diffstat (limited to 'tools/depends')
-rw-r--r--tools/depends/.gitignore1
-rw-r--r--tools/depends/configure.ac12
-rw-r--r--tools/depends/native/Toolchain-Native.cmake.in79
3 files changed, 90 insertions, 2 deletions
diff --git a/tools/depends/.gitignore b/tools/depends/.gitignore
index 802018c2dc..4f750fb752 100644
--- a/tools/depends/.gitignore
+++ b/tools/depends/.gitignore
@@ -31,6 +31,7 @@
/pre-depends/
/pre-build-deps/
Toolchain.cmake
+Toolchain-Native.cmake
config.site
config.site.native
/native/*/*native/
diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac
index 061120180b..0868ce5b1d 100644
--- a/tools/depends/configure.ac
+++ b/tools/depends/configure.ac
@@ -2,8 +2,10 @@ AC_PREREQ(2.59)
AC_INIT([xbmc-depends], [2.00], [https://github.com/xbmc/xbmc])
:${CFLAGS=""}
AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_FILES([target/config.site native/config.site.native Makefile.include target/Toolchain.cmake
- target/config-binaddons.site target/Toolchain_binaddons.cmake])
+AC_CONFIG_FILES([native/config.site.native Makefile.include
+ target/config.site target/config-binaddons.site
+ target/Toolchain.cmake target/Toolchain_binaddons.cmake
+ native/Toolchain-Native.cmake])
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
@@ -195,6 +197,7 @@ case $build in
# acquire build platform (native) sdk sysroot.
build_platform=macosx
native_sdk_path=[`$use_xcrun --show-sdk-path`]
+ host_sysroot="$native_sdk_path"
host_includes="${host_includes} -isysroot $native_sdk_path"
CC_FOR_BUILD=[`$use_xcrun --find clang`]
@@ -203,6 +206,8 @@ case $build in
# Android NDK currently only x86_64 prebuilts - Arctic Fox 2020.3.1
android_toolchain_name="darwin-x86_64"
+ host_cxxflags="-std=c++17 -stdlib=libc++"
+
if test "x$prefix" = "xNONE"; then
prefix=/Users/Shared/xbmc-depends
fi
@@ -714,6 +719,8 @@ AC_SUBST(need_libiconv)
AC_SUBST(use_gplv3)
AC_SUBST(use_ccache)
AC_SUBST(host_includes)
+AC_SUBST(host_sysroot)
+AC_SUBST(host_cxxflags)
AC_SUBST(app_rendersystem)
AC_SUBST(app_winsystem)
AC_SUBST(ffmpeg_options)
@@ -829,6 +836,7 @@ cp -vf target/config-binaddons.site $prefix/$tool_dir/share
cp -vf target/Toolchain.cmake $prefix/$deps_dir/share
cp -vf target/Toolchain_binaddons.cmake $prefix/$deps_dir/share
cp -vf native/config.site.native $prefix/$tool_dir/share/config.site
+cp -vf native/Toolchain-Native.cmake $prefix/$tool_dir/share
echo -e "\n\n#------- configuration -------#"
diff --git a/tools/depends/native/Toolchain-Native.cmake.in b/tools/depends/native/Toolchain-Native.cmake.in
new file mode 100644
index 0000000000..c5f5643ab6
--- /dev/null
+++ b/tools/depends/native/Toolchain-Native.cmake.in
@@ -0,0 +1,79 @@
+set(NATIVEPREFIX "@prefix@/@tool_dir@")
+
+set(TARBALL_DIR "@use_tarballs@")
+
+set(OS "@build_os@")
+set(CMAKE_SYSTEM_PROCESSOR @host_cpu@)
+set(CPU "@use_buildcpu@")
+
+if(OS STREQUAL linux)
+ set(CMAKE_SYSTEM_NAME Linux)
+elseif(OS STREQUAL osx)
+ set(CMAKE_SYSTEM_NAME Darwin)
+endif()
+
+if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ if(CPU STREQUAL "arm")
+ set(CPU arm64)
+ endif()
+ if(CPU STREQUAL arm64)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0)
+ else()
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
+ endif()
+
+ set(CMAKE_OSX_SYSROOT "@host_sysroot@")
+endif()
+set(CMAKE_SYSTEM_VERSION 1)
+
+# specify the cross compiler
+set(CMAKE_C_COMPILER @CC_FOR_BUILD@)
+set(CMAKE_CXX_COMPILER @CXX_FOR_BUILD@)
+set(CMAKE_AR @AR_FOR_BUILD@ CACHE FILEPATH "Archiver")
+SET(CMAKE_AS @AS_FOR_BUILD@ CACHE FILEPATH "Assembler")
+set(CMAKE_LINKER @LD_FOR_BUILD@ CACHE FILEPATH "Linker")
+set(CMAKE_NM @NM_FOR_BUILD@ CACHE FILEPATH "Nm")
+set(CMAKE_STRIP @STRIP_FOR_BUILD@ CACHE PATH "strip binary" FORCE)
+set(CMAKE_OBJDUMP @OBJDUMP_FOR_BUILD@ CACHE FILEPATH "Objdump")
+set(CMAKE_RANLIB @RANLIB_FOR_BUILD@ CACHE FILEPATH "Ranlib")
+
+if(NOT "@use_ccache@" STREQUAL "")
+ set(CMAKE_CXX_COMPILER_LAUNCHER @CCACHE@)
+ set(CMAKE_C_COMPILER_LAUNCHER @CCACHE@)
+endif()
+
+set(CMAKE_C_FLAGS "@host_includes@ -I@prefix@/@tool_dir@/include")
+set(CMAKE_CXX_FLAGS "@host_cxxflags@ @host_includes@ -I@prefix@/@tool_dir@/include")
+set(CMAKE_EXE_LINKER_FLAGS "@host_includes@ -L@prefix@/@tool_dir@/lib")
+
+# where is the target environment
+set(CMAKE_FIND_ROOT_PATH @prefix@/@tool_dir@)
+set(CMAKE_LIBRARY_PATH @prefix@/@tool_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 "@host_sysroot@" STREQUAL "")
+ list(APPEND CMAKE_FIND_ROOT_PATH @host_sysroot@ @host_sysroot@/usr)
+endif()
+
+# 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)
+
+# 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} "${NATIVEPREFIX}/share/aclocal")
+set(ENV{PATH} "${NATIVEPREFIX}/bin:$ENV{PATH}")