diff options
author | fuzzard <fuzzard@users.noreply.github.com> | 2022-03-07 10:17:32 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-07 10:17:32 +1000 |
commit | 93116c6f40af6a1384d951b284a9e73cd4a2ce30 (patch) | |
tree | c5de1362e4f4f556718eef78768c1ae67058e93a | |
parent | 5f0875497cf351d4994541c141e85fd1a7b87fe2 (diff) | |
parent | b1b7c4b0ae873f456f6a6de7b46066263d47e7e2 (diff) |
Merge pull request #21077 from fuzzard/depends_ffmpegcmake
[tools/depends][target] Use CMakeLists.txt for ffmpeg
-rw-r--r-- | cmake/modules/FindGnuTLS.cmake | 7 | ||||
-rw-r--r-- | tools/depends/target/ffmpeg/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tools/depends/target/ffmpeg/Makefile | 93 |
3 files changed, 33 insertions, 72 deletions
diff --git a/cmake/modules/FindGnuTLS.cmake b/cmake/modules/FindGnuTLS.cmake index 62e3ea7a88..53ee411f0c 100644 --- a/cmake/modules/FindGnuTLS.cmake +++ b/cmake/modules/FindGnuTLS.cmake @@ -5,11 +5,14 @@ # GNUTLS_INCLUDE_DIRS - the gnutls include directory # GNUTLS_LIBRARIES - The gnutls libraries +# Suppress PkgConfig Mismatch warning, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html +set(FPHSA_NAME_MISMATCHED 1) include(FindPkgConfig) -find_package(PkgConfig) +find_package(PkgConfig QUIET) +unset(FPHSA_NAME_MISMATCHED) if(PKG_CONFIG_FOUND) - pkg_check_modules (GNUTLS gnutls) + pkg_check_modules(GNUTLS gnutls QUIET) endif() if(NOT GNUTLS_FOUND) diff --git a/tools/depends/target/ffmpeg/CMakeLists.txt b/tools/depends/target/ffmpeg/CMakeLists.txt index 94689abb88..2748b0fbb5 100644 --- a/tools/depends/target/ffmpeg/CMakeLists.txt +++ b/tools/depends/target/ffmpeg/CMakeLists.txt @@ -83,19 +83,21 @@ elseif(CORE_SYSTEM_NAME STREQUAL android) list(APPEND ffmpeg_conf --cpu=cortex-a9) elseif(CPU MATCHES x86_64) list(APPEND ffmpeg_conf --cpu=x86_64) + list(APPEND ffmpeg_conf --extra-cflags=-mno-stackrealign) else() list(APPEND ffmpeg_conf --cpu=i686 --disable-mmx) + list(APPEND ffmpeg_conf --extra-cflags=-mno-stackrealign) endif() elseif(CORE_SYSTEM_NAME STREQUAL darwin_embedded) list(APPEND ffmpeg_conf --disable-crystalhd --enable-videotoolbox --target-os=darwin - --disable-securetransport ) elseif(CORE_SYSTEM_NAME STREQUAL osx) list(APPEND ffmpeg_conf --disable-crystalhd --enable-videotoolbox --target-os=darwin + --disable-securetransport ) endif() @@ -123,6 +125,7 @@ else() endif() if(EXTRA_FLAGS) + string(REPLACE " " ";" EXTRA_FLAGS ${EXTRA_FLAGS}) list(APPEND ffmpeg_conf ${EXTRA_FLAGS}) endif() diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile index a5dc316744..7e5f41b7b3 100644 --- a/tools/depends/target/ffmpeg/Makefile +++ b/tools/depends/target/ffmpeg/Makefile @@ -2,81 +2,34 @@ include ../../Makefile.include include FFMPEG-VERSION ../../download-files.include DEPS = ../../Makefile.include FFMPEG-VERSION Makefile ../../download-files.include -export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig - -# configuration settings -ffmpg_config = --prefix=$(PREFIX) --extra-version="kodi-$(VERSION)" -ffmpg_config += --cc="$(CC)" --cxx="$(CXX)" --ar=$(AR) --ranlib=$(RANLIB) --strip=$(STRIP) -ffmpg_config += --extra-cflags="$(CFLAGS)" -ffmpg_config += --extra-cxxflags="$(CXXFLAGS)" -ffmpg_config += --extra-ldflags="$(LDFLAGS)" -ffmpg_config += --pkg-config=$(NATIVEPREFIX)/bin/pkg-config +BUILD_TYPE = Release +ifeq ($(DEBUG_BUILD),yes) + BUILD_TYPE = Debug +endif -ffmpg_config += --disable-doc -ffmpg_config += --disable-devices -ffmpg_config += --disable-programs -ffmpg_config += --disable-sdl2 -ffmpg_config += --enable-gpl -ffmpg_config += --enable-postproc -ffmpg_config += --enable-runtime-cpudetect -ffmpg_config += --enable-pthreads -ffmpg_config += --enable-gnutls -ffmpg_config += --enable-libdav1d -ffmpg_config += $(FFMPEG_CONFIGURE_OPTIONS) +CMAKE_ARGS=-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \ + -DCMAKE_MODULE_PATH=$(CMAKE_SOURCE_DIR)/cmake/modules \ + -DPKG_CONFIG_PATH=$(PREFIX)/lib/pkgconfig \ + -DCMAKE_INSTALL_PREFIX=$(PREFIX) \ + -DFFMPEG_VER=$(VERSION) \ + -DENABLE_DAV1D=ON \ + -DEXTRA_FLAGS="$(FFMPEG_CONFIGURE_OPTIONS)" -CONFIGARCH= --arch=$(CPU) +ifeq ($(USE_CCACHE), yes) + CMAKE_ARGS+= -DENABLE_CCACHE=$(USE_CCACHE) \ + -DCCACHE_PROGRAM=$(CCACHE) +endif ifeq ($(CROSS_COMPILING), yes) - ffmpg_config += --enable-cross-compile - ffmpg_config += --pkg-config-flags=--static - ffmpg_config += --enable-pic -endif -ifeq ($(OS), linux) - ffmpg_config += --target-os=$(OS) + CMAKE_ARGS+= -DPKG_CONFIG_EXECUTABLE=$(NATIVEPREFIX)/bin/pkg-config \ + -DCROSSCOMPILING=$(CROSS_COMPILING) endif + ifeq ($(OS), android) ifeq ($(findstring arm64, $(CPU)), arm64) - ffmpg_config += --cpu=cortex-a53 - CONFIGARCH= --arch=aarch64 - else - ifeq ($(findstring arm, $(CPU)), arm) - ffmpg_config += --cpu=cortex-a9 - else - ifeq ($(CPU), x86_64) - ffmpg_config += --cpu=$(CPU) - else - ffmpg_config += --cpu=i686 --disable-mmx - endif - ffmpg_config += --extra-cflags='-mno-stackrealign' - endif + CMAKE_ARGS+= -DENABLE_NEON=YES endif - ffmpg_config += --target-os=$(OS) --extra-libs=-liconv -endif -ifeq ($(OS), darwin_embedded) - ffmpg_config += --disable-crystalhd --enable-videotoolbox - ffmpg_config += --target-os=darwin endif -ifeq ($(OS), osx) - ffmpg_config += --disable-crystalhd --enable-videotoolbox - ffmpg_config += --target-os=darwin - ffmpg_config += --disable-securetransport -endif -ifeq ($(findstring arm, $(CPU)), arm) - ffmpg_config += --disable-armv5te --disable-armv6t2 -endif -ifeq ($(findstring mips, $(CPU)), mips) - ffmpg_config += --disable-mips32r2 --disable-mipsdsp --disable-mipsdspr2 -endif -ifeq ($(CPU),x86) - ffmpg_config += --x86asmexe=$(NATIVEPREFIX)/bin/nasm -else ifeq ($(CPU),x86_64) - ffmpg_config += --x86asmexe=$(NATIVEPREFIX)/bin/nasm -endif -ifeq ($(Configuration), Release) - ffmpg_config += --disable-debug -endif - -ffmpg_config +=$(CONFIGARCH) all: .installed-$(PLATFORM) @@ -85,15 +38,17 @@ $(TARBALLS_LOCATION)/$(ARCHIVE): $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE) $(DEPS) rm -rf $(PLATFORM); mkdir -p $(PLATFORM) + rm -rf $(PLATFORM); mkdir -p $(PLATFORM)/build cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); ./configure $(ffmpg_config) + cd $(PLATFORM); cp ../CMakeLists.txt ./ + cd $(PLATFORM)/build; $(CMAKE) $(CMAKE_ARGS) .. .build-$(PLATFORM): $(PLATFORM) - $(MAKE) -C $(PLATFORM) + $(MAKE) -C $(PLATFORM)/build touch $@ .installed-$(PLATFORM): .build-$(PLATFORM) - $(MAKE) -C $(PLATFORM) install + $(MAKE) -C $(PLATFORM)/build install touch $@ clean: |