[x265] [PATCH] cmake: support IPhone cross compile on Mac OS X platform

Min Chen chenm003 at 163.com
Fri Jun 24 00:42:39 CEST 2016


# HG changeset patch
# User Min Chen <min.chen at multicorewareinc.com>
# Date 1466721751 18000
# Node ID c4215deac61f8a4d56d0e7247b9913276fc9555b
# Parent  626fcbac7ffba723dabd3a9f0507c4c80f3e7bc9
cmake: support IPhone cross compile on Mac OS X platform

diff -r 626fcbac7ffb -r c4215deac61f build/arm-ios/ios.cmake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/arm-ios/ios.cmake	Thu Jun 23 17:42:31 2016 -0500
@@ -0,0 +1,17 @@
+# CMake toolchain file for cross compiling x265 for ARM arch
+# This feature is only supported as experimental. Use with caution.
+# Please report bugs on bitbucket
+# Run cmake with: cmake -DCMAKE_TOOLCHAIN_FILE=crosscompile.cmake -G "Unix Makefiles" ../../source && ccmake ../../source
+
+set(CROSS_COMPILE_ARM 1)
+set(CMAKE_SYSTEM_NAME Darwin)
+set(CMAKE_SYSTEM_PROCESSOR armv7l)
+
+# specify the cross compiler
+set(CMAKE_C_COMPILER clang)
+set(CMAKE_CXX_COMPILER clang++)
+
+# specify the target environment
+set(CMAKE_FIND_ROOT_PATH ${IOS_PLATFORM_SDK})
+
+
diff -r 626fcbac7ffb -r c4215deac61f build/arm-ios/make-Makefiles.bash
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/arm-ios/make-Makefiles.bash	Thu Jun 23 17:42:31 2016 -0500
@@ -0,0 +1,7 @@
+#!/bin/bash
+# Run this from within a bash shell
+
+IOS_PLATFORM_SDK=`xcrun --show-sdk-path --sdk iphoneos`
+IOS_CFLAGS="-arch armv7 -mfpu=neon -pthread -isysroot $IOS_PLATFORM_SDK -miphoneos-version-min=7.0 -Qunused-arguments"
+
+cmake -DCMAKE_TOOLCHAIN_FILE=ios.cmake -DCMAKE_C_FLAGS="$IOS_CFLAGS" -DCMAKE_CXX_FLAGS="$IOS_CFLAGS" -DIOS_PLATFORM_SDK="$IOS_PLATFORM_SDK" -G "Unix Makefiles" ../../source && ccmake ../../source
diff -r 626fcbac7ffb -r c4215deac61f source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Jun 16 12:57:38 2016 +0530
+++ b/source/CMakeLists.txt	Thu Jun 23 17:42:31 2016 -0500
@@ -187,7 +187,11 @@
         endif()
     endif()
     if(ARM AND CROSS_COMPILE_ARM)
-        set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm)
+        if(APPLE)
+            #set(ARM_ARGS -arch armv7 -arch armv7s -arch arm64)
+        else()
+            set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm)
+        endif()
     elseif(ARM)
         find_package(Neon)
         if(CPU_HAS_NEON)



More information about the x265-devel mailing list