Skip to content

Commit

Permalink
Add support for ARM (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marginal committed Apr 6, 2021
1 parent cf90285 commit fccf6b3
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "aom"]
path = aom
url = https://aomedia.googlesource.com/aom
[submodule "gas-preprocessor"]
path = gas
url = https://github.com/FFmpeg/gas-preprocessor.git
1 change: 1 addition & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Building
Prerequisites
-------
* Requires Xcode 6.1 and macOS 10.10 SDK or later.
* Before building, update submodules with `git submodule update --init --recursive`.
* ffmpeg and its dependencies require "CMake" and the "yasm" assembler to build. You can obtain them
through [Homebrew](https://brew.sh) via `brew install cmake yasm`.

Expand Down
4 changes: 0 additions & 4 deletions QLVideo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
AB0527E31D2947BB009A809B /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB7C714819F8A6970006104E /* libiconv.dylib */; };
AB0527E41D2947CF009A809B /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB7C714019F8A5C50006104E /* libbz2.dylib */; };
AB0527E51D2947D1009A809B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB7C714619F8A6730006104E /* libz.dylib */; };
AB0680CF1EDB924C00534129 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0680CD1EDB913400534129 /* QTKit.framework */; };
AB2ACD9E1A696F72002411DF /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB2ACD9D1A696F72002411DF /* AVFoundation.framework */; };
AB66474F261ABBCB00D23514 /* libaom.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AB66474E261ABBB600D23514 /* libaom.a */; };
AB66477D261B43B500D23514 /* libaom.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AB66474E261ABBB600D23514 /* libaom.a */; };
Expand Down Expand Up @@ -160,7 +159,6 @@
AB00C5D21A682FB700D71399 /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Localizable.strings; sourceTree = "<group>"; };
AB0527C81D2946F1009A809B /* bench.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = bench.m; sourceTree = "<group>"; };
AB0527CE1D294732009A809B /* benchmark */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = benchmark; sourceTree = BUILT_PRODUCTS_DIR; };
AB0680CD1EDB913400534129 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = System/Library/Frameworks/QTKit.framework; sourceTree = SDKROOT; };
AB0B80BF1EED41F1008A22DC /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/schema.strings; sourceTree = "<group>"; };
AB0B80C11EED4204008A22DC /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/schema.strings; sourceTree = "<group>"; };
AB0B80C21EED4215008A22DC /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -274,7 +272,6 @@
ABE23BD81D25914C004E9D26 /* AudioToolbox.framework in Frameworks */,
ABE23BD31D258F6C004E9D26 /* VideoToolbox.framework in Frameworks */,
ABE23BDB1D2591F8004E9D26 /* CoreMedia.framework in Frameworks */,
AB0680CF1EDB924C00534129 /* QTKit.framework in Frameworks */,
AB7C715019F9E2A50006104E /* libavfilter.a in Frameworks */,
AB7C715119F9E2A80006104E /* libavformat.a in Frameworks */,
AB7C715219F9E2AB0006104E /* libavcodec.a in Frameworks */,
Expand Down Expand Up @@ -415,7 +412,6 @@
AB93B0F7196CA60500708B2E /* QuickLook.framework */,
AB93B0F9196CA60500708B2E /* ApplicationServices.framework */,
AB93B0FB196CA60500708B2E /* CoreServices.framework */,
AB0680CD1EDB913400534129 /* QTKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down
31 changes: 18 additions & 13 deletions buildaom
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@ if [ "${ACTION}" == "clean" ]; then
echo Remove "${OUTDIR}"
if [ -n "${OUTDIR}" ]; then
rm -rf "${OUTDIR}"
for ARCH in $ARCHS; do
rm -rf "${OUTDIR}/${ARCH}"
done
fi
else
# For cmake & yasm
PATH=$PATH:/usr/local/bin

if [ ! -f "${SRCROOT}/${TARGET_NAME}/CMakeLists.txt" ]; then
echo Clone to ${SRCROOT}/${TARGET_NAME}
cd "${SRCROOT}"
git submodule update --init
fi
echo Build in ${OUTDIR}
mkdir -p "${OUTDIR}"
cd "${OUTDIR}"
if [ -f CMakeCache.txt ]; then
echo Skipping cmake
else
cmake "${SRCROOT}/${TARGET_NAME}" -DCMAKE_BUILD_TYPE=${CONFIGURATION} -DCONFIG_AV1_ENCODER=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TOOLS=0 -DENABLE_SSE4_2=0 -DENABLE_AVX=0 -DENABLE_AVX2=0
fi
make -j`sysctl -n hw.physicalcpu` ${ACTION}
BUILT=""
for ARCH in $ARCHS; do
mkdir -p "${OUTDIR}/${ARCH}"
cd "${OUTDIR}/${ARCH}"
if [ -f CMakeCache.txt ]; then
echo Skipping cmake
elif [ $ARCH == arm64 ]; then
cmake "${SRCROOT}/${TARGET_NAME}" -DCMAKE_BUILD_TYPE=${CONFIGURATION} -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DCONFIG_AV1_ENCODER=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TOOLS=0 -DAOM_TARGET_CPU=arm64 -DCONFIG_RUNTIME_CPU_DETECT=0
else
cmake "${SRCROOT}/${TARGET_NAME}" -DCMAKE_BUILD_TYPE=${CONFIGURATION} -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DCONFIG_AV1_ENCODER=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TOOLS=0 -DENABLE_SSE4_2=0 -DENABLE_AVX=0 -DENABLE_AVX2=0
fi
make -j`sysctl -n hw.physicalcpu` ${ACTION}
BUILT="${BUILT} ${OUTDIR}/${ARCH}/libaom.a"
done
lipo -create $BUILT -output ${OUTDIR}/libaom.a
fi
53 changes: 35 additions & 18 deletions buildffmpeg
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,45 @@ if [ "${ACTION}" == "clean" ]; then
echo Remove "${OUTDIR}"
if [ -n "${OUTDIR}" ]; then
rm -rf "${OUTDIR}"
for ARCH in $ARCHS; do
rm -rf "${OUTDIR}/${ARCH}"
done
fi
else
# For yasm
PATH=$PATH:/usr/local/bin
# For yasm and gas
PATH=$PATH:${SRCROOT}/gas:/usr/local/bin

if [ ! -x "${SRCROOT}/${TARGET_NAME}/configure" ]; then
echo Clone to ${SRCROOT}/${TARGET_NAME}
cd "${SRCROOT}"
git submodule update --init
fi
echo Build in ${OUTDIR}
mkdir -p "${OUTDIR}"
cd "${OUTDIR}"
if [ -f config.h ]; then
echo Skipping configure
else
if [ "${CONFIGURATION}" == "Debug" ]; then
FLAGS="--disable-optimizations"
BUILT=""
for ARCH in $ARCHS; do
mkdir -p "${OUTDIR}/${ARCH}"
cd "${OUTDIR}/${ARCH}"
if [ -f config.h ]; then
echo Skipping configure
else
FLAGS=
if [ "${CONFIGURATION}" == "Debug" ]; then
FLAGS="--disable-optimizations"
else
FLAGS=
fi
if [ $ARCH == arm64 ]; then
FLAGS="$FLAGS --enable-cross-compile --enable-vfp --enable-neon"
elif [ $ARCH == x86_64 ]; then
FLAGS="$FLAGS --cpu=core2"
fi
"${SRCROOT}/${TARGET_NAME}/configure" --arch=${ARCH} --cc="clang -arch ${ARCH} -L${TARGET_BUILD_DIR}/aom" ${FLAGS} --extra-cflags=-I${SRCROOT}/aom --extra-ldexeflags=-liconv --disable-stripping --enable-gpl --enable-hardcoded-tables --disable-doc --disable-pthreads --disable-indevs --disable-outdevs --disable-network --disable-avdevice --disable-muxers --disable-encoders --disable-bsfs --disable-filters --disable-protocols --disable-autodetect --enable-appkit --enable-avfoundation --enable-bzlib --enable-coreimage --enable-iconv --enable-libaom --enable-zlib --enable-audiotoolbox --enable-videotoolbox --enable-muxer=image2 --enable-encoder=png --enable-protocol=file
fi
"${SRCROOT}/${TARGET_NAME}/configure" --cc=clang --arch=x86_64 --cpu=core2 --extra-cflags=-I${SRCROOT}/aom --extra-ldexeflags="-liconv -L${TARGET_BUILD_DIR}/aom" --disable-stripping --enable-gpl --enable-hardcoded-tables --disable-doc --disable-pthreads --disable-indevs --disable-outdevs --disable-network --disable-avdevice --disable-muxers --disable-encoders --disable-bsfs --disable-filters --disable-protocols --disable-autodetect --enable-appkit --enable-avfoundation --enable-bzlib --enable-coreimage --enable-iconv --enable-libaom --enable-zlib --enable-audiotoolbox --enable-videotoolbox --enable-muxer=image2 --enable-encoder=png --enable-protocol=file ${FLAGS}
fi
make -j`sysctl -n hw.physicalcpu` ${ACTION}
make -j`sysctl -n hw.physicalcpu` ${ACTION}
# Assumes there aren't any material client impacting differences in config between archs
cp -p ${OUTDIR}/${ARCH}/config.h ${OUTDIR}/
cp -p ${OUTDIR}/${ARCH}/libavutil/*.h ${OUTDIR}/libavutil/
done
for LIB in libavcodec libavfilter libavformat libavutil libpostproc libswresample libswscale; do
BUILT=""
for ARCH in $ARCHS; do
BUILT="${BUILT} ${OUTDIR}/${ARCH}/${LIB}/${LIB}.a"
done
mkdir -p ${OUTDIR}/${LIB}
lipo -create $BUILT -output "${OUTDIR}/${LIB}/${LIB}.a"
done
fi
1 change: 1 addition & 0 deletions gas
Submodule gas added at 4daa61

0 comments on commit fccf6b3

Please sign in to comment.