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
10 changed files with 51 additions and 127 deletions

5
build-win.sh Executable file
View File

@ -0,0 +1,5 @@
export FFBUILD_FLAGS="--enable-ffnvcodec --enable-dxva2 --enable-amf --enable-libmfx"
export FFBUILD_PLATFORM="win"
export MFX_HOST=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

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

@ -28,11 +28,12 @@ mkdir -p $PREFIX
mkdir -p $workDir
mkdir -p $outDir
bash scripts/build-iconv.sh
case $FFBUILD_PLATFORM in
win)
bash scripts/build-ffnvcodec.sh
# disabled due to build error
# bash scripts/build-libmfx.sh
bash scripts/build-libmfx.sh
;;
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 amfPath=$workDir/amf
# export CFLAGS=-L$PREFIX/lib
git clone https://github.com/FFmpeg/FFmpeg -b release/6.0 $ffmpegPath --depth 1
@ -14,17 +15,14 @@ make distclean
flags="--cc=$CC --cxx=$CXX"
if [[ -z $FFMPEG_MSVC ]]; then
flags="--toolchain=msvc"
fi
./configure --disable-gpl --disable-nonfree --disable-doc --disable-network \
--disable-ffprobe --disable-ffplay --enable-static --disable-shared \
CFLAGS="-static-libgcc -static-libstdc++ -static -I$PREFIX/include/mfx" \
CXXCLAGS="-static-libgcc -static-libstdc++ -static -I$PREFIX/include/mfx" \
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 \
--pkg-config-flags="--static" --target-os=$FFMPEG_OS \
--extra-ldflags="-libpath:$PREFIX/lib" \
--extra-cflags="-I$PREFIX/include/mfx" \
${flags} ${FFBUILD_FLAGS}
make -j$JOBS

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 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 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
mkdir build
autoreconf -i
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 ..
cmake --build . --config Release
cmake --install .
make -j$JOBS
make install

View File

@ -2,6 +2,9 @@ set -x
export OPENH264_VERSION=2.3.1
CFLAGS+="-static -static-libgcc -static-libstdc++"
LDFLAGS+="-static-libgcc -static-libstdc++ -static"
# TODO: detect platform
# export CISCO_BINARY_PLATFORM=mac
# export CISCO_BINARY_ARCH=x64

View File

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