Compare commits

..

6 Commits

Author SHA1 Message Date
paring cdd878fc7a
chore: remove unnecessary pathces 2023-05-23 15:29:30 +09:00
paring 40e8b4c49c
fix: win32 build 2023-05-23 15:29:01 +09:00
paring d3a482effe
feat: enable libmfx 2023-05-23 14:49:58 +09:00
paring dcb59ed774
feat: win32 build script 2023-05-23 13:32:17 +09:00
paring 1b692e4f8f
fix: build issue in win64 2023-05-23 13:15:10 +09:00
paring 9604e5d967 wip: use gcc for windows 2023-05-22 19:50:18 +09:00
13 changed files with 54 additions and 140 deletions

2
build-current.sh Executable file → Normal file
View File

@ -1,3 +1,3 @@
export OPENH264_OS=$(uname | tr A-Z a-z | tr -d \\-0-9. | sed -E 's/^(net|open|free)bsd/bsd/') export OPENH264_OS=$(uname | tr A-Z a-z | tr -d \\-0-9. | sed -E 's/^(net|open|free)bsd/bsd/')
CC=gcc CXX=g++ AR=ar bash build.sh $@ CC=gcc CXX=g++ AR=ar bash build.sh

View File

View File

@ -1,5 +0,0 @@
export OPENH264_ARCH=arm64
export OPENH264_OS=darwin
export FFMPEG_ARCH=arm64
bash build.sh --arch arm64

View File

@ -1,5 +1,5 @@
set -x export FFBUILD_FLAGS="--enable-ffnvcodec --enable-dxva2 --enable-amf --enable-libmfx"
export FFBUILD_PLATFORM="win"
export MFX_HOST=x86_64-w64-mingw32
export TOOLCHAIN=x86_64-w64-mingw32 FFMPEG_OS=mingw32 OPENH264_ARCH=x86_64 OPENH264_OS=mingw_nt CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ AR=x86_64-w64-mingw32-gcc-ar bash build.sh --arch x86_64
OPENH264_OS=mingw_nt OPENH264_ARCH=x86_64 CC=$TOOLCHAIN-gcc CXX=$TOOLCHAIN-g++ AR=$TOOLCHAIN-ar bash build.sh

6
build-win32.sh Normal file → Executable file
View File

@ -1,3 +1,5 @@
source win-env.sh export FFBUILD_FLAGS="--enable-ffnvcodec --enable-dxva2 --enable-amf --enable-libmfx"
export FFBUILD_PLATFORM="win"
export MFX_HOST=i686-w64-mingw32
FFMPEG_OS=win32 FFMPEG_MSBUILD=1 OPENH264_ARCH=i686 OPENH264_OS=msvc CC=cl CXX=cl AR=lib bash build.sh --arch i686 FFMPEG_OS=mingw32 OPENH264_ARCH=i686 OPENH264_OS=mingw_nt CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ AR=i686-w64-mingw32-gcc-ar bash build.sh --arch i686

View File

@ -1,3 +0,0 @@
source win-env.sh
FFMPEG_OS=win64 FFMPEG_MSBUILD=1 OPENH264_ARCH=x86_64 OPENH264_OS=msvc CC=cl CXX=cl AR=lib bash build.sh --arch x86_64

View File

@ -2,10 +2,6 @@ export ARCH=$(uname -m)
# do not use all cpus because my computer dies # do not use all cpus because my computer dies
export JOBS=$(awk -v count=$(nproc) 'BEGIN { print ( int( count - 1 ) ) }') export JOBS=$(awk -v count=$(nproc) 'BEGIN { print ( int( count - 1 ) ) }')
if [[ "$(uname)" == "Darwin" ]]; then
export JOBS=$(awk -v count=$(sysctl -n hw.ncpu) 'BEGIN { print ( int ( count - 1 ) ) }')
fi
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
--arch) --arch)
@ -32,11 +28,12 @@ mkdir -p $PREFIX
mkdir -p $workDir mkdir -p $workDir
mkdir -p $outDir mkdir -p $outDir
bash scripts/build-iconv.sh
case $FFBUILD_PLATFORM in case $FFBUILD_PLATFORM in
win) win)
bash scripts/build-ffnvcodec.sh bash scripts/build-ffnvcodec.sh
# disabled due to build error bash scripts/build-libmfx.sh
# bash scripts/build-libmfx.sh
;; ;;
esac esac

View File

@ -1,99 +0,0 @@
Subject: [PATCH] fix for vcpkg
fix missing mfx_driver_store_loader related symbols
---
Index: CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt (revision 7e4d221c36c630c1250b23a5dfa15657bc04c10c)
+++ b/CMakeLists.txt (revision 5ebef171699530ca01594a5cef10a68811f4d105)
@@ -40,6 +39,7 @@
src/mfx_load_plugin.cpp
src/mfx_plugin_hive.cpp
src/mfx_win_reg_key.cpp
+ src/mfx_driver_store_loader.cpp
)
endif (CMAKE_SYSTEM_NAME MATCHES "Windows")
@@ -56,6 +56,12 @@
configure_file (${CMAKE_SOURCE_DIR}/libmfx.pc.cmake ${CMAKE_BINARY_DIR}/libmfx.pc @ONLY)
add_library( mfx STATIC ${SOURCES} )
+
+if (CMAKE_SYSTEM_NAME MATCHES "Windows")
+ set_target_properties(mfx
+ PROPERTIES PREFIX lib)
+endif (CMAKE_SYSTEM_NAME MATCHES "Windows")
+
install (DIRECTORY ${CMAKE_SOURCE_DIR}/mfx DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h")
install (FILES ${CMAKE_BINARY_DIR}/libmfx.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
install (TARGETS mfx ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
Index: libmfx.pc.cmake
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/libmfx.pc.cmake b/libmfx.pc.cmake
--- a/libmfx.pc.cmake (revision 7e4d221c36c630c1250b23a5dfa15657bc04c10c)
+++ b/libmfx.pc.cmake (revision 388559e9e8234eb0989e1598a9beea4035a04132)
@@ -9,6 +9,6 @@
Requires:
Requires.private:
Conflicts:
-Libs: -L${libdir} -lsupc++ ${libdir}/libmfx.a
+Libs: -L${libdir} -lsupc++ ${libdir}/libmfx.lib
Libs.private:
Cflags: -I${includedir} -I@INTELMEDIASDK_PATH@
Index: src/mfx_driver_store_loader.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/mfx_driver_store_loader.cpp b/src/mfx_driver_store_loader.cpp
--- a/src/mfx_driver_store_loader.cpp (revision 388559e9e8234eb0989e1598a9beea4035a04132)
+++ b/src/mfx_driver_store_loader.cpp (revision 5ebef171699530ca01594a5cef10a68811f4d105)
@@ -24,6 +24,8 @@
#include "mfx_dispatcher_log.h"
#include "mfx_load_dll.h"
+#pragma comment(lib, "Ole32.lib")
+
namespace MFX
{
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9446bc4..a8a3288 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,16 +3,7 @@ cmake_minimum_required(VERSION 2.6)
project( libmfx )
# FIXME Adds support for using system/other install of intel media sdk
-find_path ( INTELMEDIASDK_PATH mfx/mfxvideo.h
- HINTS "${CMAKE_SOURCE_DIR}"
-)
-
-if (INTELMEDIASDK_PATH_NOTFOUND)
- message( FATAL_ERROR "Intel MEDIA SDK include not found" )
-else (INTELMEDIASDK_PATH_NOTFOUND)
- message(STATUS "Intel Media SDK is here: ${INTELMEDIASDK_PATH}")
-endif (INTELMEDIASDK_PATH_NOTFOUND)
-
+set(INTELMEDIASDK_PATH "${CMAKE_CURRENT_LIST_DIR}")
set(SOURCES
src/main.cpp
diff --git a/libmfx.pc.cmake b/libmfx.pc.cmake
index fabb541..5d248fe 100644
--- a/libmfx.pc.cmake
+++ b/libmfx.pc.cmake
@@ -11,4 +11,4 @@ Requires.private:
Conflicts:
Libs: -L${libdir} -lsupc++ ${libdir}/libmfx.lib
Libs.private:
-Cflags: -I${includedir} -I@INTELMEDIASDK_PATH@
+Cflags: -I${includedir}

View File

@ -1,6 +1,7 @@
set -x
export ffmpegPath=$workDir/ffmpeg export ffmpegPath=$workDir/ffmpeg
export amfPath=$workDir/amf export amfPath=$workDir/amf
# export CFLAGS=-L$PREFIX/lib
git clone https://github.com/FFmpeg/FFmpeg -b release/6.0 $ffmpegPath --depth 1 git clone https://github.com/FFmpeg/FFmpeg -b release/6.0 $ffmpegPath --depth 1
@ -12,13 +13,14 @@ cp -r $amfPath/amf/public/include $PREFIX/include/AMF
make distclean make distclean
if [[ $FFMPEG_MSVC == 1 ]]; then flags="--cc=$CC --cxx=$CXX"
flags="--toolchain=msvc"
fi
LDFLAGS="-arch $ARCH" ./configure --disable-gpl --disable-nonfree --disable-doc --disable-network \ CFLAGS="-static-libgcc -static-libstdc++ -static -I$PREFIX/include/mfx" \
--disable-ffprobe --disable-ffplay --enable-static --disable-shared \ CXXCLAGS="-static-libgcc -static-libstdc++ -static -I$PREFIX/include/mfx" \
--enable-libopenh264 --cc="${CC:-clang -arch $ARCH}" --cxx="${CXX:-g++ -arch $ARCH}" \ LDFLAGS="-static-libgcc -static-libstdc++ -static" \
./configure --disable-gpl --disable-nonfree --disable-doc \
--disable-ffprobe --disable-ffplay --enable-ffmpeg --enable-static --disable-shared \
--enable-libopenh264 \
--prefix=$PREFIX --enable-cross-compile --arch=$ARCH \ --prefix=$PREFIX --enable-cross-compile --arch=$ARCH \
--pkg-config-flags="--static" --target-os=$FFMPEG_OS \ --pkg-config-flags="--static" --target-os=$FFMPEG_OS \
${flags} ${FFBUILD_FLAGS} ${flags} ${FFBUILD_FLAGS}

21
scripts/build-iconv.sh Normal file
View File

@ -0,0 +1,21 @@
export iconvPath=$workDir/iconv
rm -rf $iconvPath
cd $workDir
wget -O iconv.tar.gz https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz
tar zxvf iconv.tar.gz
mv libiconv* $iconvPath
rm iconv.tar.gz
cd $iconvPath
./configure --prefix=$PREFIX --enable-static --disable-shared --with-pic --enable-extra-encodings --disable-doc
make -j$JOBS
make install

View File

@ -9,18 +9,16 @@ cd $projectDir
git init git init
git remote add origin https://github.com/lu-zero/mfx_dispatch git remote add origin https://github.com/lu-zero/mfx_dispatch
git fetch --depth 1 origin 5a3f178be7f406cec920b9f52f46c1ae29f29bb2 git fetch --depth 1 origin "5a3f178be7f406cec920b9f52f46c1ae29f29bb2"
git checkout FETCH_HEAD git checkout FETCH_HEAD
git apply ../../patches/mfx.patch export CFLAGS="$CFLAGS -static-libgcc -static-libstdc++ -static"
export CXXFLAGS="$CXXFLAGS -static-libgcc -static-libstdc++ -static"
export LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
rm -rf build autoreconf -i
mkdir build
cd build ./configure --prefix=$PREFIX --disable-shared --enable-static --with-pic --host=$MFX_HOST
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_C_FLAGS=-m32 -DCMAKE_GENERATOR_PLATFORM=x86 .. make -j$JOBS
make install
cmake --build . --config Release
cmake --install .

View File

@ -2,6 +2,9 @@ set -x
export OPENH264_VERSION=2.3.1 export OPENH264_VERSION=2.3.1
CFLAGS+="-static -static-libgcc -static-libstdc++"
LDFLAGS+="-static-libgcc -static-libstdc++ -static"
# TODO: detect platform # TODO: detect platform
# export CISCO_BINARY_PLATFORM=mac # export CISCO_BINARY_PLATFORM=mac
# export CISCO_BINARY_ARCH=x64 # export CISCO_BINARY_ARCH=x64
@ -16,7 +19,7 @@ git clone https://github.com/cisco/openh264 $projectDir -b v$OPENH264_VERSION --
cd $projectDir cd $projectDir
args="PREFIX=$PREFIX OS=$OPENH264_OS ARCH=$OPENH264_ARCH CC=\"${CC:-clang}\" CXX=\"${CXX:-g++}\" AR=\"${AR:-ar}\"" args="PREFIX=$PREFIX OS=$OPENH264_OS ARCH=$OPENH264_ARCH CC=$CC CXX=$CXX AR=$AR"
make clean make clean

View File

@ -1,2 +0,0 @@
export FFBUILD_FLAGS="--enable-ffnvcodec --enable-dxva2 --enable-amf"
export FFBUILD_PLATFORM="win"