termux-packages/packages/swift/swift-utils-build-script-impl

32 lines
1.3 KiB
Plaintext

diff --git a/swift/utils/build-script-impl b/swift/utils/build-script-impl
index b1d060328bc..218c9215260 100755
--- a/swift/utils/build-script-impl
+++ b/swift/utils/build-script-impl
@@ -1430,6 +1430,26 @@ function android_cross_swift_flags() {
echo -n "${TERMUX_SWIFT_FLAGS}"
}
+function android_cross_cmake_options() {
+ local -n options=$1
+ options+=(
+ -DCMAKE_SYSTEM_NAME=Android
+ -DCMAKE_SYSTEM_VERSION=@TERMUX_PKG_API_LEVEL@
+ -DCMAKE_SYSTEM_PROCESSOR=@TERMUX_ARCH@
+ -DCMAKE_ANDROID_STANDALONE_TOOLCHAIN="@TERMUX_STANDALONE_TOOLCHAIN@"
+ -DCMAKE_C_FLAGS="$CFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS"
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS"
+ -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
+ -DCMAKE_MODULE_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
+ -DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
+ -DCMAKE_FIND_ROOT_PATH=@TERMUX_PREFIX@
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
+ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
+ -DCMAKE_HAVE_LIBC_PTHREAD=True
+ )
+}
+
function cmake_config_opt() {
product=$1
if [[ "${CMAKE_GENERATOR}" == "Xcode" ]] ; then